msbuild netcoreapp2引用.net框架4.6.1

时间:2017-09-26 09:06:31

标签: msbuild tfs2017 .net-core-2.0

我的VS2017 upd3解决方案包含一个.Net核心2.0项目,该项目在同一解决方案中引用另一个项目(类库目标.net框架4.6.1)。

如果我在本地计算机上进行构建,则解决方案会成功编译。

但是TFS2017 upd2上的msbuild任务失败并出现以下错误:

##[error]C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(87,5): Error : The project "D:\AgentWork\1\s\..\..\..\xyz.csproj" targets ".NETCoreApp,Version=v2.0". Referencing ".NETFramework,Version=v4.6.1" is not possible.

仅供参考 - 将错误从德语翻译成英语。

Build Server通过安装“Visual Studio Installer”获得了“NET CORE 2.0 SDK”和最新的“Build Tools”。

Local install

Build Server install

在Visual Studio构建工具安装程序中,没有为核心应用程序安装“.net framework 4.6.1开发人员工具”的选项。

任何建议如何使构建成功。

核心项目档案......

  <Project Sdk="Microsoft.NET.Sdk">    
  <PropertyGroup Label="Globals">
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="6.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="MongoDB.Driver" Version="2.4.4" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
    <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\someproject.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>    

</Project>

someproject.csproj的Packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.1" targetFramework="net451" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net451" />
  <package id="MongoDB.Bson" version="2.4.4" targetFramework="net451" />
  <package id="MongoDB.Driver" version="2.4.4" targetFramework="net451" />
  <package id="MongoDB.Driver.Core" version="2.4.4" targetFramework="net451" />
  <package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net451" />
  <package id="RabbitMQ.Client" version="5.0.1" targetFramework="net451" />
  <package id="System.Collections" version="4.3.0" targetFramework="net451" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net451" />
  <package id="System.ComponentModel" version="4.3.0" targetFramework="net451" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net451" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net451" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net451" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net451" />
  <package id="System.IO" version="4.3.0" targetFramework="net451" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net451" requireReinstallation="true" />
  <package id="System.Linq" version="4.3.0" targetFramework="net451" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net451" />
  <package id="System.Net.Http" version="4.3.2" targetFramework="net451" requireReinstallation="true" />
  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net451" />
  <package id="System.ObjectModel" version="4.3.0" targetFramework="net451" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net451" />
  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net451" />
  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net451" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net451" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net451" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net451" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net451" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net451" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net451" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net451" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net451" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net451" />
  <package id="System.Threading" version="4.3.0" targetFramework="net451" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net451" />
  <package id="System.Threading.Timer" version="4.3.0" targetFramework="net451" />
  <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
  <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net451" requireReinstallation="true" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net451" />
</packages>

0 个答案:

没有答案