将构建脚本从VS2008转换为VS2015

时间:2018-06-10 13:21:29

标签: visual-studio-2015 visual-studio-2008 msbuild msbuild-target vcbuild

我正在努力升级从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\14.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,我无法弄清楚我缺少什么,有什么想法吗?

1 个答案:

答案 0 :(得分:1)

  

将构建脚本从VS2008转换为VS2015

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

  

“未找到”VCBuild“任务”

要解决此问题,您可以使用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>

希望这有帮助。