如何在Visual Studio IDE中打开Visual Studio代码文件夹(项目) [英] How to open a Visual Studio Code Folder (Project) in Visual Studio IDE

查看:663
本文介绍了如何在Visual Studio IDE中打开Visual Studio代码文件夹(项目)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Studio 2015中打开Visual Studio Code文件夹?

How do I open I a Visual Studio Code folder in Visual Studio 2015?

如果我将其作为网站"打开,它将尝试将node_modules目录视为项目的常规JavaScript文件的一部分,并且当路径超过最大路径长度时,将出现错误.

If I open it as a "Web Site", it tries to treat the node_modules directory as part of the project's normal JavaScript files and hits an error when the path exceed the maximum path length.

但是,除非我先创建该类型的项目,然后将所有VS Code文件移动到该文件夹​​中,否则我无法将其打开为任何其他项目类型.

But I can't open it as any other project type unless I first create a project of that type and then move all the VS Code files into that folder.

  • 我应该尝试将其作为网站打开吗?
  • 还是应该创建一个新项目,然后将文件和文件夹复制到其中?
  • 将其作为项目有什么优势吗?
  • 如果我确实创建了一个项目,那么很难与仅使用VS Code的人一起工作?
  • 如果我使用一个项目,应该选择哪种项目类型?

推荐答案

当前无法通过Visual Studio直接打开文件夹.

为什么?因为 Visual Studio和Visual Studio Code仅共享其名称,所以不是

Why? Because Visual Studio and Visual Studio Code only shared their name, not the idea behind it. To extend Jenny O'Reilly answer:

  • Visual Studio Code是folder oriented编辑器

这意味着VSC与文件资源管理器在项目上的视点相同.

This means VSC has the same Point-of-View to your Project as the File Explorer.

Visual Studio(不是代码)是一个solution oriented集成开发环境(简短的IDE)

Visual Studio (not Code) is a solution oriented integrated development environment (short IDE)

相反,Visual Studio中的每个项目都需要一个*.sln解决方案文件作为根组件.从这一点开始,Visual Studio将查看您的项目.例如,如果您将文件复制到项目文件夹中,则无法从Visual Studio中识别它们.您必须先将它们添加到sln文件中才能看到它们.它还允许开发人员将多个项目(*.csproj,..)组合到一个解决方案中进行构建.

Instead every Project in Visual Studio needs a *.sln Solution-File as Root Component. From this point Visual Studio looks at your Project. An example would, if you copy File in your Project Folder, they wouldn't be recognized from Visual Studio. You have to add them first to your sln File, to see them. It also allows the developer to combine multiple projects (*.csproj,..) into one single Solution to build.

这意味着这两个编辑器的思想完全不同.

This means the idea behind these two editors is completely different.

这将提供Node.js内置项目模板

This will provide Node.js built-in project templates

Visual Studio 2015带有TypeScript模板

Visual Studio 2015 comes with TypeScript templates

一种解决方法是使用空白解决方案在其中设置Visual Studio代码项目.

A workaround would be a Blank Solution in which you set up your Visual Studio Code Project.

另一个技巧是对该问题的答案.您可以将项目"文件夹作为网站项目打开.

Another trick would be the answer to this question. You can open your Project Folder as a Website Project.

文件->打开网站->文件系统,然后选择文件夹

File -> Open Website -> File System and choose the folder

更新

如前所述,由于Visual Studio试图构建解决方案,因此会出现错误.对于此回应的下几个读者,此问题的解决方法(如John Pankowicz在评论中所写)是:

Update

As you mentioned, there will be errors because Visual Studio tries to build the solutions. For the next few readers of this response, the work around for this (as John Pankowicz writes in the comment) is:

在解决方案资源管理器中右键单击网站->属性页->构建->取消选中将网站构建为解决方案的一部分"

Right-click Web Site in Solution Explorer -> Property Pages -> Build -> Uncheck "Build Web Site as part of solution"


更新2

(感谢JC1001的更新)


Update 2

(Thanks to JC1001 for this update)

Visual Studio的下一版本(Visual Studio"15")将支持打开文件夹.

The next version of Visual Studio (Visual Studio "15") will support opening a folder. This is mentioned in the Visual Studio Blog.

也像在Visual Studio Code中一样,将出现一个用于打开文件夹的提示命令.现在,您可以在预览版本中使用它:

Also like in Visual Studio Code, there will be a prompt command for opening Folders. Right now you can use this in the preview version:

devenv/命令"file.openfolder FOLDER_PATH"

devenv /command "file.openfolder FOLDER_PATH"

将来您将可以使用:

devenv FOLDER_PATH

devenv FOLDER_PATH


意见

我个人不建议没有服务器端开发的HTML/Website项目使用Visual Studio(非代码),因为我看不到任何功能.甚至智能感知有时也会提示我错误的HTML代码(这不是IDE的错).

Personally I wouldn't recommend Visual Studio (not code) for HTML/Website projects without server-side-development, because I don't see any features. Even the intellisense suggests to me sometimes bad HTML Code (it's not the IDE's fault).

所有Web项目仍然是文本文件.您可以使用Version Control轻松控制这样的组项目. Visual Studio Code甚至提供了集成的 Git支持.

After all web projects are still text files. You can easily control group projects like this with Version Control. Visual Studio Code even provides an integrated Git support.

这篇关于如何在Visual Studio IDE中打开Visual Studio代码文件夹(项目)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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