Welcome to MSDN Blogs Sign in | Join | Help

Nikhil Singhal's Blog

.Net Programming tips and gotchas
Visual Studio Setup/deployment projects and Team Foundation Server
Team Foundation servers use MSBuild to build our projects. MSBuild does not support the Visual Studio Setup/Deployment projects natively. In many of today's applications it's a must to have msi based installs created via Visual Studio.
Till someone actually takes the time to build a custom task library to handle vdproj files in MSBuild, we will have to use a hack to make our vdproj files get built on MSBuild. The hack is simple. After the compilation of the main solution is done, we invoke the Visual studio command line to build the vdproj project and copy the msi and setup.exe to the appropriate output folder.
The following simple steps will get you going in the correct direction.
  1. Find your TFSBuild.proj file in TFS source control for your project. Generally, if you had selected all defaults when creating a build definition, it would reside under TFSProject/TeamBuildTypes/{Build/Release} folder.
  2. Make sure your vdproj project is part of the main solution. Or else, you could create a standalone solution with the same name as the vdproj project. Either way,
  3. Edit the TFSBuild.proj file and add the following XML snippet (generally after the <ItemGroup> node).
  4. Replace the folder and files in the snippet with your project specific paths and names. Also, in the example below, I have shown the build type to be {Release/Any CPU}. You would replace this with your build specific settings.
  5. Check this file back in and fire a build. You are good to go!!!

<!-- Hack to build setup projects using MSBuild -->

<Target Name="AfterCompile">
<
Exec Command="&quot;$(ProgramFiles)\Microsoft Visual Studio 9.0\Common7\IDE\devenv&quot; &quot;$(SolutionRoot)\MyAppSetup\MyAppSetup.vdproj&quot; /Build &quot;Release|Any CPU&quot;"/>
<
Copy SourceFiles="$(SolutionRoot)\MyAppSetup\Release\MyApp.msi; $(SolutionRoot)\MyAppSetup\Release\setup.exe" DestinationFolder="$(OutDir)\Setup\" />
</Target>

Posted: Wednesday, June 11, 2008 11:04 PM by Nikhil Singhal
Filed under: ,

Comments

Team System News said:

Nikhil Singhal on Visual Studio Setup/Deployment projects and Team Foundation Server Jamie Kurtz on...

# June 17, 2008 8:44 AM

harikrishnan said:

Hi Nikhil,

I have followed the same step given by you.. unfortunately the build runs for ever.. do you have any idea.. i am really tired making vdproj/msi/setup copied into drop folder..

your advice please..

this is my configuration

<Target Name="AfterCompile">

   <Exec Command="&quot;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv&quot; &quot;$(SolutionRoot)\ADAMS R1 Install\ADAMS R1 Install.vdproj&quot; /Build &quot;Release|Any CPU&quot;"/>

   <Copy SourceFiles="$(BuildProjectFolderPath)/../../ACA R.5/Source/ADAMS/ADAMS R1 Install/Release/ACA R1 Install.msi" DestinationFolder="$(OutDir)"/>

   <Copy SourceFiles="$(BuildProjectFolderPath)/../../ACA R.5/Source/ADAMS/ADAMS R1 Install/Release\setup.exe" DestinationFolder="$(OutDir)"/>

 </Target>

# March 10, 2009 10:15 AM

Bill said:

Thanks for the great idea!!! I added your snippet to our build script and it works fine. I am new to the whole msbuild area so this was very helpful.

# May 6, 2009 3:23 PM

Kannan said:

When i execute the above mentioned command, i get this message

"The files mentioned could not be loaded'.

This then points to the vdproj file. And i have the error telling me that Team build failed. Exited with code 1

Please help

# June 12, 2009 5:16 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker