我有一个 Visual Studio 安装项目,其中一些已部署文件是由预构建事件创建的。但是,当我构建项目时,Visual Studio 首先 进行预构建验证,然后然后 运行预构建事件。因此预构建验证失败,并显示错误消息“错误:无法找到文件...”。
有人知道解决这个问题的方法吗?
(细节可能并不重要,但它是一个用于 Python 应用程序的 Windows 安装程序。预构建事件调用 PyInstaller,它将 py 文件打包为单个 exe 文件。然后这个 exe 文件和一些 DLL 和资源文件由安装项目打包为 Windows 安装程序。)
最佳答案
您必须能够使用 MSBuild Targets 而不是 Prebuild Event。我不确定具体细节,但我猜以下 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>
https://stackoverflow.com/questions/7322427/
相关文章:
android - 向 RadioGroup 和 Radiobutton 添加过渡动画
unix - SqLite3 NFS 挂载问题与锁定 - 我可以使用类似 CIFS nobrl 的东
macos - 什么类型的文件可以在 Mac 上使用 codesign 进行签名?
drupal - 如何总结 drupal 7 中 View 表的列?
visual-studio - Visual Studio 中的自定义构建规则,具有多个输出
security - 如何在 Web 应用程序中保护 HTML 电子邮件?