.NET Core: How to use csproj-based projects alongside project.json?

旧街凉风 提交于 2019-12-21 04:41:11

问题


Is there a (preferably convenient) way to setup a C# project such that it uses both the project.json-based format introduced with .NET Core, and a traditional csproj project file? If so, how?

I'm curious because it appears this is what they do in the CoreFX repo, instead of using the xproj-based format that is generated by Visual Studio.


回答1:


Aha! It looks like I found the answer by myself in Visual Studio.

Instead of creating a Class Library (Package) project (which may be tempting because of the flashy blue icon), just create a regular PCL:

When prompted for the platforms you want to target, simply include ASP.NET Core 5.0 as one of them:

Then Visual Studio will auto-generate both the csproj and project.json files for you, and you can live happily ever after without having to (God forbid) write your own csproj file.

Full instructions can be found here on the CoreFX repo.



来源:https://stackoverflow.com/questions/35440566/net-core-how-to-use-csproj-based-projects-alongside-project-json

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