Search code examples
visual-studiocilililasm

Are there any examples of compiling CIL code from within a Visual Studio project


I realize that it's been asked and answered that Visual Studio does not support CIL/MSIL projects. The MSBuildContrib project has an ILASM task which allows you to compile IL files at build time.

Googled came up empty on examples for how to use this task.

Are there any examples of using ILASM as part of a Visual Studio solution? I realize that #develope and ILIDE support CIL... the objective here is to compile some CIL files as part of a Visual Studio solution.


Solution

  • You could add a "makefile project". The template is under Visual C++, General. This project type allows you to specify custom build commands for the Build, Clean and Rebuild actions. The environment will be setup automatically so you don't have to mess with paths. The C++ IDE also supports creating a custom build rule so you can automatically trigger the right tool (ilasm.exe) from the file name extension (.il).

    That's however about as good as it gets. There is no automatic mapping of multiple .il files in the project to a single build command. Writing an nmake.exe makefile is required to get that. And beware that custom build rules support got broken in vs2010.