Visual Studio WiX 安装程序项目在重建时删除 msi 输出
我从最近离开的承包商那里继承了一个 WiX 项目。
当我构建 WiX 安装程序项目时,没有问题 - .msi 已按预期构建并输出。
但是,当我“重建”WiX 安装程序项目时,.msi 再次由 light.exe 构建得很好,但随后被“CoreClean”删除。
更多信息:wix 项目打包(和引用)单个 Web 项目。
这是输出的片段:
ICE105: ICE105 - Validates the package to make sure that it can be installed in true Per-User mode
ICE105: Created 05/01/2008. Last Modified 05/21/2008.
Laying out media.
Moving file 'C:\Users\codemonkey\AppData\Local\Temp\nxkfdvui\AmazonWebsiteInstaller.msi' to 'C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.msi'.
Done executing task "Light".
...
...
Target "CoreClean" in file "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets" from project "C:\web\main\Amazon.Webby.Install\Amazon.Webby.Install.wixproj" (target "Clean" depends on it):
Task "ReadLinesFromFile"
Done executing task "ReadLinesFromFile".
Task "FindUnderPath"
Comparison path is "bin\Release\".
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "obj\Release\".
Done executing task "FindUnderPath".
Task "Delete"
Deleting file "C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.msi".
Deleting file "C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.wixpdb".
Deleting file "obj\Release\MainWixComponents.wixobj".
Deleting file "obj\Release\UploadContent.wixobj".
Deleting file "obj\Release\WebSiteContent.wixobj".
Deleting file "obj\Release\Product.Generated.wixobj".
Done executing task "Delete".
...
...
我在涉及 msi 或输出文件夹的安装程序项目文件中找不到任何删除任务,因此这是 Visual Studio 进行重建并认为需要清除不包含的文件的结果't。
这似乎是“C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets”中的相关部分,导致删除新建的 msi:
<!--
==================================================================================================
CoreClean
Cleans all of the compile and link outputs as well as any intermediate files generated along
the way.
==================================================================================================
-->
<PropertyGroup>
<CoreCleanDependsOn></CoreCleanDependsOn>
</PropertyGroup>
<Target
Name="CoreClean"
DependsOnTargets="$(CoreCleanDependsOn)">
...
<!-- Delete those files. -->
<Delete Files="@(_CleanPriorFileWritesInOutput);@(_CleanPriorFileWritesInIntermediate)" TreatErrorsAsWarnings="true">
<Output TaskParameter="DeletedFiles" ItemName="_CleanPriorFileWritesDeleted" />
</Delete>
...
有什么想法吗?
谢谢。
I have inherited a WiX project from a contractor that recently left.
When I build the WiX installer project, there is no problem - the .msi is built and output as expected.
But when I "rebuild" the WiX installer project, again the .msi is built just fine by light.exe, but it subsequently gets deleted by a "CoreClean".
Further info: The wix project packages (and references) a single web project.
This is a snippet of the output:
ICE105: ICE105 - Validates the package to make sure that it can be installed in true Per-User mode
ICE105: Created 05/01/2008. Last Modified 05/21/2008.
Laying out media.
Moving file 'C:\Users\codemonkey\AppData\Local\Temp\nxkfdvui\AmazonWebsiteInstaller.msi' to 'C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.msi'.
Done executing task "Light".
...
...
Target "CoreClean" in file "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets" from project "C:\web\main\Amazon.Webby.Install\Amazon.Webby.Install.wixproj" (target "Clean" depends on it):
Task "ReadLinesFromFile"
Done executing task "ReadLinesFromFile".
Task "FindUnderPath"
Comparison path is "bin\Release\".
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "obj\Release\".
Done executing task "FindUnderPath".
Task "Delete"
Deleting file "C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.msi".
Deleting file "C:\web\main\Amazon.Webby.Install\bin\Release\AmazonWebsiteInstaller.wixpdb".
Deleting file "obj\Release\MainWixComponents.wixobj".
Deleting file "obj\Release\UploadContent.wixobj".
Deleting file "obj\Release\WebSiteContent.wixobj".
Deleting file "obj\Release\Product.Generated.wixobj".
Done executing task "Delete".
...
...
I can't find any delete task in the installer project file that involve the msi or output folder, so it's a result of visual studio doing a rebuild and thinking it needs to clean out files that it doesn't.
This seems to be the relevant section in "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets" causing the delete of the newly built msi:
<!--
==================================================================================================
CoreClean
Cleans all of the compile and link outputs as well as any intermediate files generated along
the way.
==================================================================================================
-->
<PropertyGroup>
<CoreCleanDependsOn></CoreCleanDependsOn>
</PropertyGroup>
<Target
Name="CoreClean"
DependsOnTargets="$(CoreCleanDependsOn)">
...
<!-- Delete those files. -->
<Delete Files="@(_CleanPriorFileWritesInOutput);@(_CleanPriorFileWritesInIntermediate)" TreatErrorsAsWarnings="true">
<Output TaskParameter="DeletedFiles" ItemName="_CleanPriorFileWritesDeleted" />
</Delete>
...
Any ideas?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道它已经很旧了,但是 SourceForge 中提到了这个错误:
http://sourceforge.net/tracker/?func=detail&atid=642714&aid=1719357&group_id=105970
您使用的是 3.0.4102.0 之后的版本吗?
关于评论中的错误是否真的已修复,似乎确实存在一些争论。
I know it's old but this is mentioned as a fixed bug in SourceForge:
http://sourceforge.net/tracker/?func=detail&atid=642714&aid=1719357&group_id=105970
Are you using a version post 3.0.4102.0?
There does seem to be some debate as to whether the bug is really fixed in the comments.
为了解决这个问题,我从 wixproj 文件中取出了所有 InitialTargets 步骤(即 msbuild.exe 调用),并将它们移动到从预构建事件项目属性调用的批处理脚本中。我这样做是因为还有另一个问题 - 加载项目时正在构建目标项目,这意味着打开解决方案需要很长时间。无论如何,将所有内容移至批处理文件中解决了这两个问题。
To resolve this I took all the InitialTargets steps (which were msbuild.exe calls) out of the wixproj file and moved them into a batch script called from the pre-build event project property. I did this because there was another problem - the targeted projects were being built as the project was loaded, which meant that it took a long time to open the solution. At any rate, moving everything into a batch file resolved both problems.