0

I have a legacy application where I want to migrate the build to VSTS. In the application is a web project and a WCF API that I want to include in the build, and a WIN RT client project that should not be included. So I instead of having a single Visual Studio task to build the sln file, I have 2 which build the web and WCF projects individually one after the other. See enter image description here

Although the build is successful, I get these warnings and I would like to know how to fix them; enter image description here

The log files can be found here; https://1drv.ms/f/s!ArKf9AZKW_zWgRapkZ_IUT-DrhY0

The property groups in my csproj file are;

 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

If I replace the build for 2 project csproj files with one with the overall sln file, I get these error messages;

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2049):C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2049,5): Error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Bing.Maps.Xaml, Version=1.313.0825.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2049):C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(2049,5): Error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.VCLibs, Version=12.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(2606):C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(2606,5): Error : Copying file Service References\SurveyServiceReference\M.Survey.SurveyAdminApp.SurveyServiceReference.AssignedJobs.datasource to obj\Release\Package\PackageTmp\Service References\SurveyServiceReference\M.Survey.SurveyAdminApp.SurveyServiceReference.AssignedJobs.datasource failed. Could not find file 'Service References\SurveyServiceReference\M.Survey.SurveyAdminApp.SurveyServiceReference.AssignedJobs.datasource'. Process 'msbuild.exe' exited with code '1'.

arame3333
  • 9,887
  • 26
  • 122
  • 205

3 Answers3

0

Make sure you add the parameters to the MsBuild Arguments and that these are a valid combination for your project, e.g.:

/p:Configuration=Release /p:Platform=AnyCPU

Or edit the project file and make sure the default Configuration and Platform are specified in the first PropertyGroup:

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
</PropertyGroup>
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
0

It turned out it caused by the variable BuildPlatform = any cpu in your build definition.

You should change the variable BuildPlatform with the value anycpu (no blank space) to align with the value in PropertyGroups of your .csproj.

enter image description here

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Ok. I tried that originally but I had problems because in the sln file there is a WinRT project that I do not want included in the build. It looks like this caused the build to fail. How do I specify not to include that project in the build? – arame3333 Nov 29 '17 at 07:41
  • Also I want to get the web project and the wcf api to be deployed in 2 seperate locations, not sure how I do that. I think I need the build to locate the artifacts in 2 seperate drop folders – arame3333 Nov 29 '17 at 07:54
  • I updated the question to let you see the error messages I get when I try to build the solution. – arame3333 Nov 29 '17 at 07:59
  • I updated my answer. You can change the variable `BuildPlatform` with the value `anucpu`, then it should build correctly and copy the packages to `$(Build.ArtifactStagingDirectory)`. – Marina Liu Nov 29 '17 at 08:38
  • I now get this message "d:\a\1\s\M.Survey.sln.metaproj(0,0): Warning MSB4126: The specified solution configuration "release|anycpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration." – arame3333 Nov 29 '17 at 14:16
  • What's the result if you leave it blank? – Marina Liu Nov 30 '17 at 07:23
  • Still get d:\a\1\s\M.Survey.sln.metaproj(0,0): Warning MSB4126: The specified solution configuration "release|AnyCPU" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration. – arame3333 Nov 30 '17 at 09:48
  • Can you share an example code in one drive which can reproduce the error? – Marina Liu Nov 30 '17 at 09:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/160183/discussion-between-arame3333-and-marina-liu-msft). – arame3333 Nov 30 '17 at 10:34
0

The Visual studio build task does have this weird behavior. When building a solution or .sln file, you have to provide the build platform in the following manner: With a space in between

enter image description here

However, when you are building a project or a .csproj file, you have to provide the build platform in the following manner: Without any space in between

enter image description here

If building the project individually doesn't work for you, and you need to build the solution, then this SO post will help you make solution level changes in Visual Studio so when you build in VSTS, the task will only build the desired projects. Hope this helps.

ThePretendProgrammer
  • 1,449
  • 10
  • 16