Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make VisualStudio C# have files/folders outside of the project directory

I'm trying to come up with a setup where I can generate a visual studio solution + projectfile, that references files and folders "outside" of the folder where the .sln and .csproj's are stored.

and (the catch :) ), I need new files that get created with you rightclick a folder and say "new code file" to be generated in the folder that was rightclicked, which lives outside of the .sln folder.

Can it really not be done?

PS Sidenote: the reason for wanting to do this is that the .cs files are actually used by a different program, together with a lot of other files, and I don't want the .sln, .csproj, .ReSharper, .suo etc files to clutter my directory.

like image 236
Lucas Avatar asked Apr 04 '09 19:04

Lucas


People also ask

Can Visual Studio do C?

Yes, you very well can learn C using Visual Studio. Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the . c file extension to save your source code.

How do I change from C++ to C in Visual Studio?

In Visual Studio You can set compiler options for each project in its Visual Studio Property Pages dialog box. In the left pane, select Configuration Properties, C/C++ and then choose the compiler option category.

Is Visual Studio Code good for C?

Although a full-blown version of Visual Studio, such as Visual Studio Community Edition, can be great tool for doing C and C++ coding, there are many times when it can be overkill. With the addition of the C/C++ extension to Visual Studio Code, you might have what is needed in a small, cross-platform editor.


2 Answers

Add As Link

http://msdn.microsoft.com/en-us/library/9f4t9t92(VS.80).aspx

like image 190
Greg Dean Avatar answered Sep 21 '22 16:09

Greg Dean


For anybody who is interested, it is possible to have a "linked" folder in the solution explorer instead of just the linked files appearing all on the root of the solution. Include the following in the csproj/vbproj files.

  <ItemGroup>
    <None Include="..\MyFolder\*.*">
      <Link>MyFolder\A\</Link>
    </None>
  </ItemGroup>

This will include all files from the 'MyFolder' directory one level up from the project. The 'A' can be called anything but must be there in order for the folder to appear in the solution explorer. Unfortunately using this technique you cannot add new files from the IDE as they will be added to a folder of the same name in project directory instead of to the linked directory.

like image 45
Adam Avatar answered Sep 20 '22 16:09

Adam