Sharon
Sharon

Reputation: 93

Build only the VS Setup project via command line

I have a solution that contains many projects and a setup project (.vdproj). I want to be able to build ONLY the setup project via command line.

I tried to use

devenv /build Debug "C:\\MySolution\MySolution.sln" /project "CSharpWinApp\CSharpWinApp.vdproj" /projectconfig Debug 

but it also built the rest of my solution projects and I want to avoid it. I tried it few times in a row - no project has changed but it stil built it all. I tried to remove the .vdproj project dependencies but it didn't work. I got the message "This dependency was added by the project system and cannot be removed".

Any suggestions?

Upvotes: 6

Views: 11497

Answers (2)

Hassan Boutougha
Hassan Boutougha

Reputation: 3919

you can isolate your setup in a setup solution to be sure that it will not compile your application. for building your setup project you can do this with TFSBuild 2010 as follow:

First, to automate the building of .vdproj project, you’re going to need to write your own msbuild file because they are not in msbuild format and therefore TFS Build does not know what to do with them. I found some good examples on the net on how to do this, but I updated mine a little for 2010. Here it is:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> 
  <Target Name="Build"> 
    <PropertyGroup>
      <DevEnv>$(ProgramFiles)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com</DevEnv>
      <SolutionFile>$(MSBuildProjectDirectory)\MySolution.sln</SolutionFile>
      <ProjectFile>$(MSBuildProjectDirectory)\MySetupProject\MySetup.vdproj</ProjectFile>
      <Configuration>Release</Configuration>
    </PropertyGroup>
    <Exec Command="$(DevEnv)  $(SolutionFile) /Rebuild $(Configuration)  /Project  $(ProjectFile)  /ProjectConfig  $(Configuration) /Log" ContinueOnError="false" IgnoreExitCode="false" WorkingDirectory="$(MSBuildProjectDirectory)" /> 
  </Target> 
</Project>

thank to Leonard Woody

Upvotes: 2

base2
base2

Reputation: 1010

Use the following command line to build setup projects.
Note: Support for setup projects has been dropped from Visual Studio 2012.

devenv "c:\your solution file.sln"  /Project "c:\your setup project file.vdproj" /Build "Release" 

If you really have to use msbuild, create a msbuild project file and use the Exec task to call the command line above as demonstrated in Hassan's answer.

Upvotes: 11

Related Questions