【问题标题】:Visual Studio setup project prebuild eventVisual Studio 设置项目预生成事件
【发布时间】:2011-09-06 15:34:27
【问题描述】:

我有一个 Visual Studio 安装项目,其中一些部署的文件是由预构建事件创建的。但是,当我构建项目时,Visual Studio first 会进行预构建验证,然后 然后 会运行预构建事件。因此预构建验证失败,并显示错误消息“错误:无法找到文件...”。

有人知道解决方法吗?

(细节可能无关紧要,但它是 Python 应用程序的 Windows 安装程序。预构建事件调用 PyInstaller,它将 py 文件打包为单个 exe 文件。然后,此 exe 文件和一些 DLL 和资源文件由安装项目打包为 Windows 安装程序。)

【问题讨论】:

    标签: visual-studio setup-project


    【解决方案1】:

    您必须能够使用 MSBuild 目标而不是 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 &amp;quot;Release|Any CPU&amp;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>
    

    【讨论】:

      猜你喜欢
      • 2014-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多