使用Linux上的Mono构建VS 2017 MSBuild csproj项目

前端之家收集整理的这篇文章主要介绍了使用Linux上的Mono构建VS 2017 MSBuild csproj项目前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有 @L_403_0@我正在尝试使用最新的Mono和.NET Core 1.0.1工具(基于MSBuild的csproj工具)在Mac和Linux上使用Travis CI构建.他们的目标是netstandard1.6.1,net45和net461.我从 Travis CI得到的错误是:

/usr/share/dotnet/sdk/1.0.1/Microsoft.Common.CurrentVersion.targets(1111,5):@H_403_4@ error MSB3644: The reference assemblies for framework@H_403_4@ “.NETFramework,Version=v4.5” were not found. To resolve this,install@H_403_4@ the SDK or Targeting Pack for this framework version or retarget your@H_403_4@ application to a version of the framework for which you have the SDK@H_403_4@ or Targeting Pack installed. Note that assemblies will be resolved@H_403_4@ from the Global Assembly Cache (GAC) and will be used in place of@H_403_4@ reference assemblies. Therefore your assembly may not be correctly@H_403_4@ targeted for the framework you intend.

Mono不支持基于VS 2017 MSBuild的csproj项目吗?如何构建我的项目?

解决方法

据我所知,这里有两种选择:

>使用this issue中所述的FrameworkPathOverride环境变量指向它们.@H_403_4@>将Travis构建限制为仅针对.NET Core构建.根据我的经验,这简单得多.

这是Noda Time .travis.yml文件,当我可以迁移时,我将在Noda Time使用它 – 至少可以说它是初步的,但它确实构建了……

language: csharp
mono: none
dotnet: 1.0.1
dist: trusty

script:
  - dotnet restore src/NodaTime
  - dotnet restore src/NodaTime.Test
  - dotnet restore src/NodaTime.Serialization.Test
  - dotnet build src/NodaTime -f netstandard1.3
  - dotnet build src/NodaTime.Test -f netcoreapp1.0
  - dotnet build src/NodaTime.Serialization.Test -f netcoreapp1.0
  - dotnet run -p src/NodaTime.Test/*.csproj -f netcoreapp1.0 -- --where=cat!=Slow
  - dotnet run -p src/NodaTime.Serialization.Test/*.csproj -f netcoreapp1.0

关于此的几点说明:

>与早期的SDK不同,我们现在需要单独恢复每个项目 – 顶级没有大的“dotnet恢复”:(@H_403_4@>当我没有在dist上运行时,我感到很惊讶:xenial,但事实并非如此. (它声称环境不支持.NET Core.)我猜这会改变.@H_403_4@>我们正在使用NUnit,目前在新SDK中测试的唯一方法是使用NUnitLite,因此运行dotnet运行测试@H_403_4@>我有点惊讶我不能只指定dotnet运行的目录名称(根据dotnet restore和dotnet build),但这似乎是事情的方式.我会找一个bug报告……

在任何一种情况下,我都建议使用基于Windows的CI构建来检查所有内容是否在Windows上构建和运行(理想情况下测试您支持的每个框架).

猜你在找的Linux相关文章