Search code examples
visual-studio-2015visual-studio-2008msbuildmsbuild-targetvcbuild

Convert build script from VS2008 to VS2015


I am working on upgrading upgrading from VS2008 to VS2015. Everything is building in VS2015 just fine, now it is time to get the build script that is used for release code working. When running "msbuild BuildReleaseVS2015.proj /target:CoreApplicatrion" I get this error:

BuildReleaseVS2015.proj(67,5): error MSB4036: The "VCBuild" task was not found. Check the following: 
1.) The name of the task in the project file is the same as the name of the task class. 
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 
3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\14.0\bin" directory.

Here is the part of the project file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.6.2" DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <CppIncludes>..\include</CppIncludes>
    <LibsPath>..\lib</LibsPath>    
  </PropertyGroup>

  <Target Name="licenseMgr_v141">
    <Message Text="*** Target licenseMgr v141" />
    <VCBuild Projects="..\licenseMgr\LicenseLib\LicenseLib.vcxproj" Configuration="Release_v141" Rebuild="true"/>
    <VCBuild Projects="..\licenseMgr\LicenseLib\LicenseLib.vcxproj" Configuration="Debug_v141" Rebuild="true"/>
  </Target>

  <Target Name="CoreApplicatrion" DependsOnTargets="licenseMgr_v141">
    <Message Text="*** Target CoreApplicatrion" />
    <MSBuild Projects="CA\CoreApplicatrion.sln" Properties="Configuration=Release"/>
  </Target>

</Project>

I have gone through MSDN and am not able to figure out what I am missing, any thoughts?


Solution

  • Convert build script from VS2008 to VS2015

    That because the last Visual Studio which support VCBuild is VS2008, so when you convert your build script from VS2008 to VS2015, you will got the error:

    "The "VCBuild" task was not found"

    To resolve this issue, you can use MSBuild instead of VCBuild, then the target should be like this:

    <MSBuild  Projects="YourProject.vcxproj" Targets="Build" Properties="Configuration=$(Configuration);Platform=$(Platform)" />
    

    Your target:

      <Target Name="licenseMgr_v141">
        <Message Text="*** Target licenseMgr v141" />
        <MSBuild Projects="..\licenseMgr\LicenseLib\LicenseLib.vcxproj" Configuration="Release_v141" Targets="Build"/>
        <MSBuild Projects="..\licenseMgr\LicenseLib\LicenseLib.vcxproj" Configuration="Debug_v141" Targets="Build"/>
      </Target>
    

    Hope this helps.