C
C#2y ago
Rhythmic

Add external folders to solution

I have a program which can run .cs files that aren't a part of the source code. These are essentially customizable algorithms in which certain methods from the source code are run. Since the directory containing these external .cs files aren't part of the source code, they're not in the project solution, so IntelliSense doesn't work when editing these files, which is impractical. Is there a way to enable IntelliSense for these directories, such that I can Ctrl+Click on methods to go to their definitions in the source code? My solution so far is to copy all the files to a folder inside the solution, which is impractical because it isn't synchronized with the external folder and now stores all the files twice. I'm using Visual Studio Community 2022.
10 Replies
Rhythmic
RhythmicOP2y ago
Ideally, the external folders should be visible in the solution explorer, and shouldn't be included in the git repository.
Anu6is
Anu6is2y ago
You could try using add existing item in solution explorer
Rhythmic
RhythmicOP2y ago
I tried this, but it seems to only be individual files, not directories
Anu6is
Anu6is2y ago
And add the files/folder to git ignore Ah, usually I use it for adding projects which only requires you to add the csproj so can't speak to adding a directory itself, sry
Rhythmic
RhythmicOP2y ago
Maybe I can create a new csproj in the directory of the .cs files?
Anu6is
Anu6is2y ago
Does the directory just have a bunch of standalone cs files?
Rhythmic
RhythmicOP2y ago
pretty much yeah in subfolders
Anu6is
Anu6is2y ago
Hmmmm Could probably make a class library project out of them and reference that
Rhythmic
RhythmicOP2y ago
ok I'll look up how to do this
Mayor McCheese
You have to tell the solution about these files. There's not a way not to include that change in the repo. You can point to files outside of the repo, but still it's a solution file edit.

Did you find this page helpful?