Multiple Embedded Files with Microsoft.CSharp.Compiler

  • Thread starter Thread starter Damien DORISON
  • Start date Start date
D

Damien DORISON

Hi,

I need to build a win application that will compile a kind of project
that contains .cs files and .bmp files. For this i use
Microsoft.CSharp.Compiler, it's Compile method handles mutliple
sources files, this is ok.
Now, i need to include several bmp files as embedded resources (i will
later use them by calling Assembly.GetManifestResourceStream()). To do
this i can specify on single bmp file by adding a DitionaryEntry
("res", "FileNameToInclude,NameOfTheResourceToRetrive") in the options
IDisctionay. This works fine for a single file.
Unfortunaltly i cannot add another file that way because Key must be
unical in IDictonary entries, and i canno't find any way to specify
multiple files to include with one signe "res" DitionaryEntry.

Anyone has an idea about this ?

Regards,

Damien DORISON
 
There's no way to do this. We are also working to deprecate this class and
namespace in favor of the CodeDom, which does allow what you want.
 
Thank you Grant for your answer, i will have to wait for a further
version in order to treate this in safe code.

Anyway i just found the temporary solution to my problem :
Microsoft.CSharp.Compiler allows incrporating one single embedded
file, if several are needed AL is the tool. with it's /embed option.
Process is more complex :
* compile the "project" (cs files) to a module using
Microsoft.CSharp.Compiler,
* link the embedded files to the module using AL.exe. For an
executable, the entrey point must be furnished (not so easy to
automate...)
The point is that we need to create a Process in order to run that
command so it's not a very "smart" way to handle the problem.

Anyway, thanks again for your post.

d
 
Back
Top