开发者

Why does ILMerge do nothing when publishing?

开发者 https://www.devze.com 2023-01-11 22:01 出处:网络
ILMerge usually merges my assemblies fine when building a Release开发者_如何学编程, but when Publishing for ClickOnce the resulting EXE doesn\'t contain the DLLs that were supposed to be merged.

ILMerge usually merges my assemblies fine when building a Release开发者_如何学编程, but when Publishing for ClickOnce the resulting EXE doesn't contain the DLLs that were supposed to be merged.

I think ILMerge is working, but Publish is overwriting the new merged assembly with the old original one. I made a Post-Build event that stopped the build right after ilmerge ran, and it was merged as expected.

Why is this happening, and is there a workaround?


ClickOnce performs a build before doing the publish. If you want something changed about your deployment, you'll have to assemble the files manually and edit the deployment manifest (.application file) and application manifest (yourapp.exe.manifest file) with MageUI and re-sign the files.


Apparently, after the project builds, and the post-build script runs, Publish recopies the output files from the obj directory to the bin directory (probably because it modified the manifest file). At least in Visual Studio 2010.

I fixed this by adding this to my post-build script after the ilmerge line:

ECHO Copying assembly from bin back to obj directory: COPY "$(TargetFileName)" "....\obj\$(ConfigurationName)" COPY "$(TargetFileName)" "....\obj\$(ConfigurationName)"

It copies the file back into the obj directory so Publish can do its thing with the right files.

0

精彩评论

暂无评论...
验证码 换一张
取 消