compiling to IL code

C

CSharper

Could someone tell me how to compile a project to IL code? Let me
explain the reason. I have a program which will read a resource file
and creates some output. In this scenario, the program doesn't change,
but every month, I need to do a new release and and only thing it
changes is the resource file. I try to find a way to add a resource
file to an exe and I never find a solution to this. ILMerge doesn't
merge the resource file.

One thing I can do is rebuild the project with the resource everytime,
but I am pretty sure there must be a better way to do this?

Thanks.
 
J

Jon Skeet [C# MVP]

CSharper said:
Could someone tell me how to compile a project to IL code? Let me
explain the reason. I have a program which will read a resource file
and creates some output. In this scenario, the program doesn't change,
but every month, I need to do a new release and and only thing it
changes is the resource file. I try to find a way to add a resource
file to an exe and I never find a solution to this. ILMerge doesn't
merge the resource file.

One thing I can do is rebuild the project with the resource everytime,
but I am pretty sure there must be a better way to do this?

The "better way" is to keep the file outside the exe to start with, and
load it as a separate file.
 
C

CSharper

The "better way" is to keep the file outside the exe to start with, and
load it as a separate file.

What happen during the last couple of years, people either don't
deliver the file or put a wrong file in the zip file and it was a mess
thats why I am looking for creative alternative.
Thanks.
 
C

Cowboy \(Gregory A. Beamer\)

Why not, as Jon has mentioned, compile the resources as a separate assembly?
When done this way, you can update the resources to your heart's content
without having to recompile the executable.

If you are truly updating resources very often, you might be better served
with a system that calls in periodically and gets the latest bits. This can
be a resource file or it can be XML (encrypted XML?) or some other type of
file. Heck, it can even be a SQL compact database. :)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
 
C

CSharper

Why not, as Jon has mentioned, compile the resources as a separate assembly?
When done this way, you can update the resources to your heart's content
without having to recompile the executable.

If you are truly updating resources very often, you might be better served
with a system that calls in periodically and gets the latest bits. This can
be a resource file or it can be XML (encrypted XML?) or some other type of
file. Heck, it can even be a SQL compact database. :)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my bloghttp://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|







- Show quoted text -

Thanks both. If I understand it correctly, I could compile the
resource file itself into an assembly and then run ILMerge and create
a single exe is also an option, is that correct?
 
I

Ignacio Machin ( .NET/ C# MVP )

Could someone tell me how to compile a project to IL code? Let me
explain the reason. I have a program which will read a resource file
and creates some output. In this scenario, the program doesn't change,
but every month, I need to do a new release and and only thing it
changes is the resource file. I try to find a way to add a resource
file to an exe and I never find a solution to this. ILMerge doesn't
merge the resource file.

One thing I can do is rebuild the project with the resource everytime,
but I am pretty sure there must be a better way to do this?

Thanks.

Hi,

why don't you simply store the file outside?
Or maybe (if you have some reason not to show the resource file in the
"wild" create an external dll (class library) that implements an
interface and pack the file there.
In this case you only have to send the dll
 
I

Ignacio Machin ( .NET/ C# MVP )

What happen during the last couple of years, people either don't
deliver the file or put a wrong file in the zip file and it was a mess
thats why I am looking for creative alternative.
Thanks.- Hide quoted text -

- Show quoted text -

Hi,

There is so much you can do agains human stupidity (or carelessness),
if they forget to put the file, or to even do the process in the first
place there is nothing you can do about it
 
C

CSharper

Hi,

There is so much you can do agains human stupidity (or carelessness),
if they forget to put the file, or to even do the process in the first
place there is nothing you can do about it- Hide quoted text -

- Show quoted text -

Thanks both again. Appriciate your comments and suggestions.
 
B

Ben Voigt [C++ MVP]

CSharper said:
Could someone tell me how to compile a project to IL code? Let me
explain the reason. I have a program which will read a resource file
and creates some output. In this scenario, the program doesn't change,
but every month, I need to do a new release and and only thing it
changes is the resource file. I try to find a way to add a resource
file to an exe and I never find a solution to this. ILMerge doesn't
merge the resource file.

That's because you're using the wrong tool.

al.exe (Assembly Linker) is used to embed resources.
http://msdn2.microsoft.com/en-us/library/c405shex(VS.71).aspx

You may need to create a .netmodule instead of .exe from the C# project,
then use al.exe to combine it with the resources.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top