TF Build Definition with Publishing Target and Current Unit Tests

I created a build definition using TF Build. This is a nightly build for our project. It should run specific Unit Tests and should package Azure Cloud Service projects.

This build runs for a while without a packing step. This resulted in a successful build that also ran Unit tests.

Based on the following tutorial, I've added Cloud Services packaging: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-dotnet-continuous-delivery/ . It mainly has to do with setting a publish target for msbuild (/ target: Publish) in the build definition.

The problem is that when building a solution for publishing purposes, Unit test projects are not built. MSBuild will be back with the following message: Skipping unpublishable project

. I have traced this down to a generic MSBuild target file. The project will only be created when the publish is the result of a project in exe, as can be seen here: http://referencesource.microsoft.com/#MSBuildFiles/C/ProgramFiles(x86)/MSBuild/14.0/bin_/amd64/Microsoft.Common .CurrentVersion.targets, 217

What I have tried:

  • Forced building of Unit test projects in publications. I added the following msbuild to Unit test csproj files to override the default target in Publish:
    <PropertyGroup>
      <PublishDependsOn>
         Build;
      </PublishDependsOn>
    </PropertyGroup>
    
  • Setting the output type of the Unit test project to the Console application

In both cases, MSBuild will provide The specified project reference metadata for the reference "..\..csproj" is missing or has an invalid value: Project

Unit test for all projects referenced by the project.

It seems to me that I am not on the right track. Can I both build Unit test projects and build and publish Cloud Service projects?

0


source to share


2 answers


Okie, that was much easier than me.



/target

- MSBuild arguments can take multiple targets, which are built in turn. I am changing the build definition to /target:Build;Publish

be like msbuild parameters. This fixed the problem.

+1


source


I got an error (no entry point for cloud service) doing /t:Build;Publish

with my service. So I did 2 separate actions, one with Build

and one with Publish

, and it worked.



0


source







All Articles