Visual Studio安装项目预建事件
问题描述:
我有一个Visual Studio安装项目,其中部分文件是由预生成事件创建的。但是,当我构建项目Visual Studio 第一个做了预构建验证并且然后运行了预构建事件。因此,预生成验证失败,并显示错误消息“错误:无法找到文件...”。Visual Studio安装项目预建事件
有没有人知道这方面的解决办法? (详细信息可能并不重要,但它是一个用于Python应用程序的Windows安装程序,预生成事件调用PyInstaller,它将py文件打包为单个exe文件,该exe文件以及一些DLL和资源文件是然后由安装项目打包为Windows安装程序。)
答
您必须能够使用MSBuild目标而不是预构建事件。我不确定具体情况,但我想下面的link可能会解释您的类似情况。
编辑 - 2017年7月(因搬迁链接): http://pradeepc.net/using-tfs-teambuild-to-build-setup-projects-in-visual-studio
样品从该链接复制粘贴如下 - 你可能需要修改以适应需要:
<Target Name="AfterDropBuild">
<Exec Command="devenv.exe MySolution.sln /Build &quot;Release|Any CPU&quot;" WorkingDirectory="$(SolutionRoot)" />
<ItemGroup>
<SetupFiles Include="$(SolutionRoot)/MySetup/Release/MySetup.msi" />
<SetupFiles Include="$(SolutionRoot)/MySetup/Release/Setup.exe" />
</ItemGroup>
<Copy SourceFiles="@(SetupFiles)" DestinationFolder="\Build-MachineBuild_Drop_FoldersMyProjectMSI$(BuildNumber)" />
<Copy SourceFiles="@(SetupFiles)" DestinationFolder="\Build-MachineBuild_Drop_FoldersMyProjectMSILatest_MSI" />
</Target>