3

I have a Visual Studio Setup project where some of the deployed files are created by a pre-build event. However, when I build the project Visual Studio first does pre-build validation and then runs the pre-build event. Thus pre-build validation fails, with the error message "ERROR: Unable to find file ...".

Does anyone know a work-around for this?

(The details may not matter, but it is a Windows Installer for a Python app. The pre-build event calls PyInstaller which packages the py files as a single exe file. This exe file and some DLL's and resource files are then packaged by the Setup project as a Windows Installer.)

Johan Råde
  • 20,480
  • 21
  • 73
  • 110

1 Answers1

0

You must be able to use MSBuild Targets instead of a Prebuild Event. I am not sure about the specifics, but I guess the following link might explain your similar situation.

Edited - July 2017 (due to relocated link): http://pradeepc.net/using-tfs-teambuild-to-build-setup-projects-in-visual-studio

Sample copied from that link is pasted below - you may want to edit to fit the need:

<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>
Arun
  • 2,493
  • 15
  • 12