.net core RC2使用自己的本地Nuget软件包:文件夹netstandard1.5包含无效版本 [英] .net core RC2 using own local Nuget Package: The folder netstandard1.5 contains an invalid version

查看:158
本文介绍了.net core RC2使用自己的本地Nuget软件包:文件夹netstandard1.5包含无效版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下project.json文件创建一个新的.net核心类库:

I create a new .net core class library with the following project.json file:

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": "dnxcore50"
    }
  },
  "scripts": {
    "postcompile": [
      "dotnet pack --no-build --configuration %compile:Configuration%"
    ]
  }
}

使用 scripts> postcompile,我正在导出该库的nuget包,该包将输出这些文件和文件夹:

With the "scripts" > "postcompile" I am exporting the nuget package for this library which outputs these files and folder:

/netstandard1.5
Solid.Common.Log.1.0.0.nupkg
Solid.Common.Log.1.0.0.symbols.nupkg

在此步骤之后,我将复制这些文件放入我之前在Visual Studio上设置的本地nuget文件夹中。

After this step, I am copying these files into my local nuget folder which I set up before on Visual Studio.

这是另一个项目的project.json文件(.net核心网络应用程序tion),我想在上面添加nuget包。

And here is the other project's project.json file (.net core web application) which i want to add the nuget package above.

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Solid.Common.Log": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

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

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "gcServer": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

所有内容都不错,但显示为无法解决...。输出为:

Everything looks fine but it says "Unable to resolve...". Here is the output:

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "D:\Projects\Playground\Solid.Disaster\.vs\restore.dg"
log  : Restoring packages for D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.json...
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethost/index.json
warn : The folder 'D:\Projects\MyNuget\Solid.Common.Log\netstandard1.5' contains an invalid version.
info :   GET https://api.nuget.org/v3-flatcontainer/solid.common.log/index.json
info :   NotFound https://api.nuget.org/v3-flatcontainer/solid.common.log/index.json 923ms
error: Unable to resolve 'Solid.Common.Log (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
log  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.json...
info : Committing restore...
log  : Writing lock file to disk. Path: D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\project.lock.json
log  : D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\Solid.Disaster.Web.xproj
log  : Restore failed in 1670ms.
Errors in D:\Projects\Playground\Solid.Disaster\src\Solid.Disaster.Web\Solid.Disaster.Web.xproj
    Unable to resolve 'Solid.Common.Log (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
NuGet Config files used:
    C:\Users\SolidWrist\AppData\Roaming\NuGet\NuGet.Config
    C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
    https://api.nuget.org/v3/index.json
    D:\Projects\MyNuget
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

可能是这里的问题吗?为什么它不能解析此nuget包?

What might be the problem here? Why can not it resolve this nuget package?

如果我将Solid.Common.Log项目作为现有项目添加到Web项目并引用它,则一切正常。但是,当我尝试将其添加为nuget程序包时,出现了此错误。

If I add Solid.Common.Log project to web project as an existing project and reference it, everything works fine. But when I try to add it as a nuget package, I am getting this error.

谢谢。

推荐答案

不是使用此命令手动移动文件,而是解决了问题:

Instead of moving the files manually using this command handles the issue:

nuget.exe add <nupkg> -Source C:\PathToLocalNuget

https://github.com/NuGet/Home/issues/2955

这篇关于.net core RC2使用自己的本地Nuget软件包:文件夹netstandard1.5包含无效版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆