【问题标题】:Build web api .net core on linux在 linux 上构建 web api .net core
【发布时间】:2017-02-12 11:22:06
【问题描述】:

我正在使用与 Microsoft (R) Visual Studio (R) Team Services 的持续集成。在我的 ubnuntu 服务器上成功运行 dotnet restore 命令之后,我运行构建命令 dot net build 并出现下一个错误:

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

我做错了什么?我尝试将 .net 版本修改为 4.0,我还查看了一些命令来获取 linux 的目标包,但我找不到解决方案。

我的系统运行:

  • Ubuntu 16.04.1 LTS
  • .net core 1.0.0 预览3

【问题讨论】:

  • 您可以使用flubu之类的工具来简化构建过程。关于flubu的莫拉:stackoverflow.com/questions/40890522/…顺便说一句.net核心的例子。答案是.net

标签: asp.net .net linux azure-devops ubuntu-16.04


【解决方案1】:

根据错误,你的项目引用了.net framework 4.5,你需要引用.net core。

  1. 打开 project.json
  2. 查看frameworks部分,代码应该是这样的(如果值为“net452”则修改{}):

代码:

"frameworks": {
    //"net452": { }
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

【讨论】:

    猜你喜欢
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 2021-01-23
    • 2018-05-08
    • 2019-12-20
    • 2020-12-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多