VS .Net:“来自 <myProject>&"的主要输出的后期构建事件在安装程序项目中 [英] VS .Net: Post build events for "Primary Output from <myProject>" in installer project
问题描述
我在项目中使用以下构建后操作,将库合并到我的应用程序中:
I'm using the following post build actions in a project, to merge a lib into my application:
IF $(ConfigurationName) == Debug GOTO end
cp $(TargetPath) $(TargetDir)app_unmerged.exe
del $(TargetPath)
"C:\Program Files\Microsoft\ILMerge\ilmerge.exe" /internalize $(TargetDir)MyApp_unmerged.exe $(TargetDir)someLib.dll /out:$(TargetDir)myApp.exe
del $(TargetDir)myApp_unmerged.exe $(TargetDir)someLib.dll
:end
这很好用.现在我有一个安装程序项目并添加了项目输出.我希望使用来自"的主要输出",即/bin/Release 中的exe.但实际上使用的是/obj/release/myApp.exe 而不是/bin/release/myApp.exe .
This works fine. Now I have an Installer project and added the Project Output. I would expect that the "Primary Output from " is used, i.e. the exe in /bin/Release . But actually instead of /bin/release/myApp.exe , /obj/release/myApp.exe is used.
有谁知道我是否可以更改此行为并将/bin/release 中的输出用于安装程序项目?谢谢.
Does anyone know if I can change this behavior and use the output in /bin/release for the installer project? Thanks.
推荐答案
这个问题似乎没有真正的解决方案,但有一个解决方法.我在 Microsoft 连接上创建了一个票证:https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=428898
Seems there is no real solution for this problem, but a workaround exists. I created a ticket on Microsoft connect: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=428898
微软的回答:
为了执行这些后期构建操作,您需要将它们放在一个批处理文件中,然后添加适当的命令以在后期构建事件对话框中调用该批处理文件.我看到脚本中有几个实例引用了许多 Visual Studio 变量.由于我们不会将这些变量作为环境变量公开,因此您必须将它们作为参数传递给批处理文件.
In order to execute those post build actions, you will need to put them in a batch file and then add the appropiate command to invoke the batch file in the post build event dialog. I see that there are several instances in the script with references to a number of Visual Studio variables. Since we do not expose those variables as environment variables, you will have to pass them as parameters to the batch file.
希望能帮到你!
姜糖项目经理 - Visual Studio
Candy Chiang Program Manager - Visual Studio
这篇关于VS .Net:“来自 <myProject>&"的主要输出的后期构建事件在安装程序项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!