Reputation: 419
I have one solution with multiple projects inside:
Project1 - Class Library Project2 - MVC Project3 - Class Library Project4 - WCF
I now want TFS to build all projects but also automatically deploy the MVC project to http://somehost/MVC
and the WCF to http://somehost/WCF
.
I have tried to change my build definition but it is only the MVC that gets deployed.
By the way: Gated Check-in is enabled on the TFS.
Upvotes: 2
Views: 873
Reputation: 8295
I had this exact issue, and I solved it by manually editing the project files.
This way TFS will deploy both projects on build. Note the build configuration names - I've created these especially for my TFS build definitions to point at (I have 2 build definitions: Dev & QA). Applying the propery group to these definitions mean the projects don't get deployed every time you build the projects in your dev environment when running the debug config. It also means that I can deploy to different locations depending on whether I'm running a QA or Dev build.
Example:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DEV-BUILD-|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DeployOnBuild>true</DeployOnBuild>
<DeployTarget>MsDeployPublish</DeployTarget>
<MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
<MSDeployServiceUrl>http://DEV-SERVER-ADDRESS</MSDeployServiceUrl>
<DeployIisAppPath>PROJECTminder.API-MAINTENANCE</DeployIisAppPath>
<UserName><MACHINE-NAME>\BuildUser</UserName>
<Password>*****</Password>
<AuthType>Basic</AuthType>
<AllowUntrustedCertificate>true</AllowUntrustedCertificate>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'QA-BUILD|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DeployOnBuild>true</DeployOnBuild>
<DeployTarget>MsDeployPublish</DeployTarget>
<MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
<MSDeployServiceUrl>http://QA-SERVER-ADDRESS</MSDeployServiceUrl>
<DeployIisAppPath>PROJECTminder.API</DeployIisAppPath>
<UserName><MACHINE-NAME>\BuildUser</UserName>
<Password>*****</Password>
<AuthType>Basic</AuthType>
<AllowUntrustedCertificate>true</AllowUntrustedCertificate>
</PropertyGroup>
Update:
I should add that this was my solution for VS2010. I believe in newer versions (2012+) you can actually define publish profiles per project (.pubxml) which TFS will pick up.
Upvotes: 2
Reputation: 1405
I use Octopus Deploy for this. With the default build process template you can trigger a Post-build Powershell script. In this script you can create NuGet packages, create a release and deploy them to a number of servers. In the Octopus Deploy documentation is a way to create packages to deploy Create Packages with TFS. There is a blog post about the integration of TFS and Octopus Deploy here.
Upvotes: 1