使用VS2019预览版访问.netstandard的参考地狱 [英] Reference hell accessing .netstandard with framework VS2019 preview

查看:414
本文介绍了使用VS2019预览版访问.netstandard的参考地狱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果执行以下步骤,则可以使我的.net标准2.0程序包在.net Framework 4.7.2 dll中工作

I can get my .net standard 2.0 package working in a .net framework 4.7.2 dll if I do the following steps

在我的标准项目VS2019 61.4中。 4右键单击该项目并选择pack以创建.nupkg
,然后为
包设置一个nuget包源。在我的框架项目中,我安装nuget包
我得到以下对话框

In my standard project VS2019 61.4.4 right click the project and select pack to create the .nupkg Then I set up a nuget package source for the package In my framework project I install nuget package I get the following dialog

我在项目文件中选择PackageReference

I choose PackageReference in project file

我回答是,接受许可

然后我可以看到以下内容

Then I can see the following

我可以使我的项目正常工作。

And I can get my project working.

但是在另一台运行VS2019 16.5.0预览版的计算机上2.0,没有出现询问我选择包管理器格式的对话框。

However on a different machine running VS2019 16.5.0 Preview 2.0, I do not get the dialog asking me to choose the package manager format.

相反,引用看起来像

我无法使我的项目正常工作。

and I can not get my project working.

[更新]

在跟随Lance的链接将packages.config迁移到PackageReference
之后,项目看起来像

After following Lance's link to migrate packages.config to PackageReference The project looks like

我能够通过右键单击引用并选择 Remove Unused来删除不需要的软件包。引用

I was able to remove the unwanted packages by right clicking references and choosing Remove Unused References

该程序有效!

推荐答案

开始 Tools => Nuget Package Manager => General =>软件包管理您可以通过在首次安装软件包时允许格式选择来控制行为。启用该复选框并重新启动VS,此更改将生效。

Go Tools=>Nuget Package Manager =>General => Package Management You can control the behavior by Allow format selection on first package install. Enable the checkbox and restart VS, this change will take effect.

并且请注意,该对话框仅在我们在当前项目中安装第一个软件包时出现。因此,如果您创建一个新项目并安装软件包,它将出现。而且,由于您曾经在该项目中安装过程序包,因此该对话框将不再出现在WindowsFormApp2中。

And note the dialog only appears when we install first package in current project. So if you create a new project and install package, it will appear. And since you once installed packages in that project, the dialog won't appear in WindowsFormApp2 any more.

(但是您可以轻松地将packages.config迁移到PackageReference,请参见)。

(But you can easily migrate packages.config to PackageReference, see this).

这篇关于使用VS2019预览版访问.netstandard的参考地狱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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