将构建脚本从 VS2008 转换为 VS2015

Convert build script from VS2008 to VS2015

我正在努力从 VS2008 升级到 VS2015。一切都在 VS2015 中构建得很好,现在是时候让用于发布代码的构建脚本工作了。当 运行 "msbuild BuildReleaseVS2015.proj /target:CoreApplicatrion" 我得到这个错误:

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.0\bin" directory.

这是项目文件的一部分:

<?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>

我浏览了 MSDN,但无法弄清楚我遗漏了什么,有什么想法吗?

Convert build script from VS2008 to VS2015

因为最后一个支持VCBuild的Visual Studio是VS2008,所以当你将你的构建脚本从VS2008转换到VS2015时,你会得到错误:

"The "VCBuild" task was not found"

要解决此问题,您可以使用 MSBuild 而不是 VCBuild,那么目标应该是这样的:

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

你的目标:

  <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>

希望对您有所帮助。