Reference hell accessing .netstandard with framework VS2019 preview

蹲街弑〆低调 提交于 2020-03-04 21:33:43

问题


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

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

I choose PackageReference in project file

I answer yes to accept licensing

Then I can see the following

And I can get my project working.

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.

Instead the references look like

and I can not get my project working.

[Update]

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

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

The program worked!


回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/60199981/reference-hell-accessing-netstandard-with-framework-vs2019-preview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!