.NET Core:如何将基于 csproj 的项目与 project.json 一起使用? [英] .NET Core: How to use csproj-based projects alongside project.json?

查看:31
本文介绍了.NET Core:如何将基于 csproj 的项目与 project.json 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种(最好是方便的)方法来设置 C# 项目,以便它同时使用 project.json 的格式,以及传统的 csproj 项目文件?如果是,怎么办?

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?

我很好奇,因为这似乎是他们在 CoreFX 存储库中所做的,而不是使用Visual Studio 生成的基于 xproj 的格式.

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.

推荐答案

啊哈!看来我自己在 Visual Studio 中找到了答案.

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

与其创建一个类库(包)项目(这可能因为闪亮的蓝色图标而很诱人),只需创建一个常规的 PCL:

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

> <em class=

当提示您选择要定位的平台时,只需将 ASP.NET Core 5.0 作为其中之一:

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

> <em class=

然后 Visual Studio 会自动为您生成 csproj 和 project.json 文件,您可以从此过上幸福的生活,而不必(上帝保佑)编写自己的 csproj 文件.

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.

可以在此处找到完整说明 在 CoreFX 存储库中.

Full instructions can be found here on the CoreFX repo.

这篇关于.NET Core:如何将基于 csproj 的项目与 project.json 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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