0
votes

How can I publish my asp.net web api project created in Visual Studio 2015 which has a webjob to Azure using teambuild in TFS 2012?

The problem seems to revolve around msbuild. Locally and on the build machine, whenever I explicitly use the msbuild in C:\Program Files (x86)\Microsoft Visual Studio 14.0 it will work. When I use C:\Windows\Microsoft.NET\Framework64\v4.0.30319\, it gives me the the following output explaining that the deployment is unpublishable.

Target "_DeploymentUnpublishable: (TargetId:3)" in file "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets" from project "{poath}WebApi.csproj" (target "Publish" depends on it):
Task "Message" (TaskId:4)
  Task Parameter:Text=Skipping unpublishable project. (TaskId:4)
  Skipping unpublishable project. (TaskId:4)
Done executing task "Message". (TaskId:4)

When I queue a build from TFS I use the following arguments,

/t:Publish /ToolsVersion:14.0 /p:VisualStudioVersion=14.0 /p:ToolPath="C:\Program Files (x86)\MSBuild\14.0\Bin" /p:DeployOnBuild=true /p:PublishProfile=azureProfile.pubxml /p:Username=$user /p:Password=password
1

1 Answers

0
votes

I never found a solution to this, but I was able to get the following hack to work.

  1. Create a csproj file
  2. Add a new <Target> like below
    <Target Name="PushPackages">
        <Exec Command=""C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" {WebApiWithWebjob}.csproj /p:DeployOnBuild=true;PublishProfile=Dev.pubxml;VisualStudioVersion=14.0;Password={password}" />
    </Target>
  1. Add the csproj file as the last item to build in the build definition