Nuget - 包还原失败.回滚“WebApplication1"的包更改.0 [英] Nuget - Package restore failed. Rolling back package changes for 'WebApplication1'. 0

查看:54
本文介绍了Nuget - 包还原失败.回滚“WebApplication1"的包更改.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我自己的自定义 nuget 包,我尚未发布并在本地进行测试.

nuget 包由 dll 文件和 nuspec 文件组成,如下所示.

<包><元数据><id>MyLib</id><version>1.0.0</version><authors>作者</authors><owners>所有者</owners><licenseUrl>许可网址</licenseUrl><projectUrl>项目网址</projectUrl><requireLicenseAcceptance>false</requireLicenseAcceptance><描述>一些描述</版权><tags>Tag1 Tage2</tags></元数据><文件><file src="binDebug
etstandard1.4*.dll" target="lib"/><file src="binDebug
etstandard1.4*.pdb" target="lib"/></文件></包>

我已将 nupkg 文件复制到一个位置并将其添加到

Visual Studio 工具 ->选项 ->包 ->源目录

错误:

Package MyLib 1.0.0 与 netcoreapp1.0 (.NETCoreApp,Version=v1.0) 不兼容.包 MyLib 1.0.0 支持:net (.NETFramework,Version=v0.0)包还原失败.回滚WebApplication1"的包更改.

不确定如何解决问题或找到更多信息.

更多信息

dll 文件是使用模板 (.Net Framework 4.5.2) 创建的

模板 ->Visual C# ->.NET 核心 ->类库(.NET 标准)

Web 应用程序是使用模板创建的.(空的 Web 应用程序)

模板 ->Visual C# ->.NET 核心 ->ASP.NET Core Web 应用程序 (.NET Core)

编辑

我在 Output 窗口下找到了更多细节

一个或多个包与 .NETCoreApp,Version=v1.0 不兼容.

我应该创建什么样的类库与 .NETCoreApp 兼容?

Edit2

我看到了这个

It's my own custom nuget package that I've not published yet and testing locally.

The nuget package consists of a dll file and nuspec file is as follows.

<?xml version="1.0"?>
<package >
  <metadata>
    <id>MyLib</id>
    <version>1.0.0</version>
    <authors>Author</authors>
    <owners>Owner</owners>
    <licenseUrl>license url</licenseUrl>
    <projectUrl>project url</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>some description</copyright>
    <tags>Tag1 Tage2</tags>
  </metadata>
  <files>
    <file src="binDebug
etstandard1.4*.dll" target="lib" />
    <file src="binDebug
etstandard1.4*.pdb" target="lib" />
  </files>
</package>

I've copied the nupkg file to a location and added it to the

Visual studio Tools -> Options -> Packages -> sources directory 

Error:

Package MyLib 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package MyLib 1.0.0 supports: net (.NETFramework,Version=v0.0)
Package restore failed. Rolling back package changes for 'WebApplication1'.

Not sure how can I resolve the issue or find more information.

More Info

The dll file was created using template (.Net Framework 4.5.2)

Templates -> Visual C# -> .NET Core -> Class Library (.NET Standard)

The web application was crated using template. (Empty Web Application)

Templates -> Visual C# -> .NET Core -> ASP.NET Core Web Application (.NET Core)

Edit

I found more details under Output window

One or more packages are incompatible with .NETCoreApp,Version=v1.0.

What kind of class library should I create which is compatible with .NETCoreApp?

Edit2

I saw this URL. it suggests to create the nupkg using dotnet.exe pack --no-build whereas earlier I downloaded the nuget.exe from nuget.org to create the package.

I tried above command but then visual studio says

"... Target pack doesn't exists in the project ... "

Followed instructions on this site as well but failed

这篇关于Nuget - 包还原失败.回滚“WebApplication1"的包更改.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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