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.
I gave Hans credit for answering this question, but after some experimentation I've got a solution which comes slightly closer to home:
HOW TO COMPILE CIL/MSIL INSIDE VISUAL STUDIO
The following hack gets you a project which:
Follow these steps:
Here's the XML:
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" Inputs="$(MSBuildAllProjects);@(Compile);" Outputs="@(IntermediateAssembly);$(NonExistentFile);">
<GetFrameworkPath>
<Output TaskParameter="Path" PropertyName="FrameworkPath" />
</GetFrameworkPath>
<PropertyGroup>
<IlAsmCommand>"$(FrameworkPath)\Ilasm.exe" /NOLOGO /DLL /OUTPUT:"@(IntermediateAssembly)" </IlAsmCommand>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' " >
<IlAsmCommand>$(IlAsmCommand) /DEBUG </IlAsmCommand>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' " ><IlAsmCommand>$(IlAsmCommand) /OPTIMIZE </IlAsmCommand></PropertyGroup>
<PropertyGroup Condition=" '$(AssemblyOriginatorKeyFile)' != '' " >
<IlAsmCommand>$(IlAsmCommand) /KEY:"$(AssemblyOriginatorKeyFile)" </IlAsmCommand>
</PropertyGroup>
<Exec Command="$(IlAsmCommand) @(Compile->'"%(FullPath)"', ' ')"
Outputs="@(IntermediateAssembly)" />
<CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''" />
</Target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With