0

我正在努力从 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,但无法弄清楚我错过了什么,有什么想法吗?

4

1 回答 1

1

将构建脚本从 VS2008 转换为 VS2015

那是因为最后一个支持的 Visual StudioVCBuildVS2008,所以当你将构建脚本从 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>

希望这可以帮助。

于 2018-06-11T07:55:12.973 回答