vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Show both .sln and .csproj files in project selector

Open wjk opened this issue 10 years ago • 9 comments

Environment data

.NET Command Line Tools (1.0.0-preview4-004071)

Product Information:
 Version:            1.0.0-preview4-004071
 Commit SHA-1 hash:  9855dc0088

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64

VS Code version: 1.7.1 C# Extension version: v1.5-beta7

Steps to reproduce

In my private repo, I have a number of MSBuild-based .NET Core projects I intend on using VSCode with. However, my build process also involves creating (using CMake) and building a completely unrelated Visual C++-based solution. omnisharp-vscode then locks on to the *.sln file generated by CMake, which contains no C# projects, and prevents me from accessing the loose *.csproj files that constitute the bulk of my project.

Expected behavior

omnisharp-vscode should give an option to access loose csproj files, even when a solution file is detected.

Actual behavior

I can't do this.

wjk avatar Nov 10 '16 05:11 wjk

Great bug -- thanks!

DustinCampbell avatar Nov 10 '16 13:11 DustinCampbell

Is there any progress on this or work around (like telling OmniSharp which SLN to look at?) or the like? Arguably one of the strongest points of fast C# development and iteration revolves around Intellisense working.. Since OmniSharp is loading our test environment sln instead of or dev sln, it does not function at all.

crysyn avatar Nov 10 '17 20:11 crysyn

You can tell OmniSharp what to launch on by clicking the little OmniSharp icon at the bottom right of the VS Code status bar. (This is visible when a C# file is in the active editor.) You can use this to pick different solutions.

DustinCampbell avatar Nov 10 '17 20:11 DustinCampbell

Ah, that is a bit less painful. Thanks.

crysyn avatar Nov 10 '17 21:11 crysyn

I have the same issue -- I have a .csproj file I want to use, but it's being ignored in favour of other .sln files in the workspace tree. I've noticed that the file picker @DustinCampbell mentioned is a bit peculiar. If any .sln files exist in the workspace tree, only .sln files appear in the file picker and I can't use my csproj. If I start a new instance of vscode and just open the relevant sub-folder (which has only the .csproj in it), then vscode/omnisharp is happy to use my .csproj file.

(Yes, I could create another dummy .sln file that refers only to the .csproj I want to use, but it's not clear why I should need to.)

0xabu avatar Mar 06 '18 22:03 0xabu

Update: after looking at resourcesToLaunchTargets, I realised that I'm not in fact opening the csproj file I wanted, but just its containing folder (which has the same name, and is also functional).

So please ignore my comment above -- this bug is really just about the following TODO:

// TODO:
//   * It should be possible to choose a .csproj as a launch target

0xabu avatar Mar 06 '18 23:03 0xabu

I think I am having the same problem, so want to re-enforce working on this. I have a project tree which contains a (Windows) VisualStudio solution file plus projects. I am now trying to compile it on Linux with .NET Core and VS Code. OmniSharp insists on loading the .sln file, which fails, and it does not offer any pickers.

If I rename the .sln and .csproj associated with VisualStudio, then OmniSharp correctly loads the Core csproj file and appears to work properly.

prensing avatar Sep 08 '18 16:09 prensing

Why is there no progress on this? I avoid .sln files wherever possible in favour of loose .csproj folders. If I need a .sln file because of a heavy VStudio debugging need, I lose the ability to open the root folder of a collection of related projects that have a single set of documentation. Very frustrating. tried excluding **/*.sln in omnisharp.json file located in %USERPROFILE%/.omnisharp/ the sln file still loaded littering .slnXX files all over the place seems like the only workaround

bruce31 avatar Feb 18 '21 20:02 bruce31

Closing as a lot has changed with the project selector since this issue was opened. For OmniSharp we now show project .sln, .slnf, and .csproj files in the selector. image

JoeRobich avatar Sep 13 '24 04:09 JoeRobich