How to open a Visual Studio Code Folder (Project) in Visual Studio IDE
Asked Answered
B

4

24

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

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.

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.

  • Should I be trying to open it as a web site?
  • Or should I create a new project and then copy the files + folders into it?
  • Is there any advantage to having it as a project?
  • If I do create a project, it makes it difficult to work together with someone who is just using VS Code?
  • And if I use a project, which project type should I select?
Burthen answered 15/3, 2016 at 1:30 Comment(0)
Q
18

Currently there is no way to open a folder directly with Visual Studio.

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 is a folder oriented editor

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

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

    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.


Visual Studio (not code) Project-types for Web


Workaround 1

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


Workaround 2

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

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"


Update 2

(Thanks to JC1001 for this update)

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

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 /command “file.openfolder FOLDER_PATH”

In the future you will be able to use:

devenv FOLDER_PATH


Opinion

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).

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.

Quebec answered 16/3, 2016 at 15:48 Comment(4)
Thanks. I'll concentrate of the Open Website approach. I'll try to figure out why this was giving me errors initially and report back.Burthen
I guess Open as WebSite is the way to go. I fixed the problem I was having with this. I had errors about a path exceeding maximum path length in node_modules folder. This was happening when it tried to "build" the project. But there is nothing for VS to build. I have Typescript and Less files, but I will be using gulp to build these. Therefore I turned off build: Right-click Web Site in Solution Explorer -> Property Pages -> Build -> Uncheck "Build Web Site as part of solution"Burthen
Just as a matter of interest (and something to look forward to) - the next version of Visual Studio (Visual Studio "15") will support opening a folder. See Open Any Folder with Visual Studio “15” Preview for the Visual Studio blog article.Cowled
I think the opinion is rather short sighted. VSCode is gimped in a number of ways, I assume because it is an electron app. Just one example, multi monitor support. I can take a VS tab and move it across multiple monitors... can't do that in VSCode. Obviously it is what it is - but VS is an amazing IDE for windows... VSCode is a pretty good IDE for all platforms.Beulabeulah
E
18

Finally folder view has arrived in VS 2017 :)

enter image description here

You can find more details in here.

Embolus answered 8/3, 2017 at 8:45 Comment(0)
V
0

Visual Studio Code does not create "project files" that you can open in Visual Studio 2015. Basically, when you open up a Node website in Visual Studio, you need to re-create the folder structure in VS2015 and create a "project file".

I haven't seen any better ways of doing this, but will be happy when we can open a folder just as easilly as we can with VSCode

Veronique answered 15/3, 2016 at 6:16 Comment(1)
I meant to say "VS code folder" above - not project.Burthen
Y
0

I'm sure it's not the best way but..

Open an existing .sln with notepad, change the names, save as [name of your project].sln.

Open with Visual Studio.

Yahrzeit answered 5/3, 2021 at 12:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.