使用Visual Studio Code创建C#.sln文件 [英] Create C# .sln file with Visual Studio Code

查看:209
本文介绍了使用Visual Studio Code创建C#.sln文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Visual Studio Code创建一个新的C#解决方案.

我正在使用 yo 工具.

现在我有一个包含ASP项目的文件夹.还有另一个带有类库的文件夹.

如何从ASP项目中引用类库?

似乎我必须向 project.json 添加依赖项:

 依赖项":{"ClassLibrar.Name":"*"} 

但是要实现这一点,我需要解决方案文件.但是VS Code和 yo 不会创建这样的代码.

UPD 可以在不同的操作系统上使用VS Code,而VS仅可从Windows访问,但我想使用VS Code创建新的解决方案.

简单的要求:创建Web项目和1个以上的类库.

所有这些都将打包在docker容器中

解决方案

Visual Studio Code提供了一种创建新项目模板的方法.

  1. 导航到Visual Studio代码终端(按Ctrl +`)
  2. 键入命令 dotnet new sln
  3. 您还可以创建新项目,使用命令 dotnet new -l <​​/code>
  4. 检查可用项目模板的列表.

详细文档为

I'd like to create a new C# solution with Visual Studio Code.

I'm using yo tools.

Now I have a folder with ASP project. And another folder with class library.

How can I reference class library from asp project?

Seems I have to add dependency to the project.json:

"dependencies": {
    "ClassLibrar.Name": "*"
}

But to make this possible I need solution file. But VS Code and yo doesn't create a such one.

UPD VS Code can be used from different OS, while VS accessible only from Windows, I'd like o create a new solution with VS Code only.

Simple requirement: create web project and 1+ class libraries.

All this will be packed in docker container

解决方案

Visual Studio Code provides a way to create the new project templates.

  1. Navigate to visual studio code terminal ( press Ctrl + `)
  2. Type the command dotnet new sln
  3. You can also create the new project, check list of available project templates using command dotnet new -l

The detailed documentation is Available Here.

这篇关于使用Visual Studio Code创建C#.sln文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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