Mar*_*ark 5 il cil visual-studio ilasm
我意识到已经被问及并回答Visual Studio不支持CIL/MSIL项目.该MSBuildContrib项目有ILASM任务,它允许您编译IL文件在制作的时候.
关于如何使用此任务的示例,Google搜索结果为空.
是否有任何使用ILASM作为Visual Studio解决方案的一部分的示例?我意识到#develope和ILIDE支持CIL ......这里的目标是编译一些CIL文件作为Visual Studio解决方案的一部分.
Mar*_*ark 13
我回答这个问题时给了汉斯的信任,但经过一些实验,我得到了一个更接近家的解决方案:
如何在可视化工作室内编译CIL/MSIL
以下hack为您提供了一个项目:
跟着这些步骤:
这是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>
Run Code Online (Sandbox Code Playgroud)
您可以添加一个“makefile 项目”。该模板位于 Visual C++、常规下。此项目类型允许您为“构建”、“清理”和“重建”操作指定自定义构建命令。环境将自动设置,因此您不必弄乱路径。C++ IDE 还支持创建自定义构建规则,以便您可以从文件扩展名 (.il) 自动触发正确的工具 (ilasm.exe)。
然而,这已经是最好的了。项目中的多个 .il 文件不会自动映射到单个构建命令。需要编写 nmake.exe makefile 才能获得该文件。并注意自定义构建规则支持在 vs2010 中被破坏。
| 归档时间: |
|
| 查看次数: |
2565 次 |
| 最近记录: |