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

MSBuildSdksPath ingored

Open krosthw opened this issue 3 years ago • 6 comments

Environment data

VS Code version: 1.67.0 C# Extension version: v1.24.4

Steps to reproduce

  1. Create 'omnipath.json' in project's folder { "msbuild": { "MSBuildSdksPath": "C:\\Windows\\Microsoft.NET\\Framework\\v3.5" } }

Actual behavior

[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Professional 2022 17.1.32421.90 17.1.0 - "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin"

Additional context

the MSBuild path is not overwritten.

krosthw avatar May 10 '22 08:05 krosthw

This is a legacy configuration option that only works when

{
  "MSBuild": {
    "UseLegacySdkResolver": true	            
  }
}

is also set.

filipw avatar May 10 '22 09:05 filipw

Thank you for the answer. But I can't see any difference in the OmniSharp output log. Actually, I don't understand if omnipath.json has been considered or not

krosthw avatar May 10 '22 11:05 krosthw

if you set "omnisharp.loggingLevel":"debug"in VS Code (not in theomnisharp.jsonfile) it will show the full configuration state it observes, from that it will be visible whether the settings of youromnisharp.json` file were included.

Note that omnisharp.json must be located at the root path of your solution.

filipw avatar May 10 '22 14:05 filipw

ok... now this is my omnisharp.json:

{
    "msbuild": {
	    "UseLegacySdkResolver": true,
	    "MSBuildSDKsPath": "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319",
	    "MSBuildOverride": {
		    "MSBuildPath": "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319",
		    "Name": "MSBuildOverride"
	    }
    }
}

but now i have this error:

[dbug]: OmniSharp.CompositionHostBuilder
        .NET SDK requires MSBuild instances version 16.3 or higher
System.FormatException: input string was not in a correct format.
   in OmniSharp.SemanticVersion.VersionResult.SetFailure(ParseFailureKind failure, String argument) in D:\a\1\s\src\OmniSharp.Abstractions\SemanticVersion.cs:riga 557
   in OmniSharp.SemanticVersion.TryParseVersion(String version, VersionResult& result) in D:\a\1\s\src\OmniSharp.Abstractions\SemanticVersion.cs:riga 288
   in OmniSharp.SemanticVersion.Parse(String version) in D:\a\1\s\src\OmniSharp.Abstractions\SemanticVersion.cs:riga 183
   in OmniSharp.MSBuild.Discovery.MSBuildInstanceProvider.GetMSBuildVersion(String microsoftBuildPath) in D:\a\1\s\src\OmniSharp.Host\MSBuild\Discovery\MSBuildInstanceProvider.cs:riga 67

krosthw avatar Aug 31 '22 08:08 krosthw

@krosthw This is a very strange configuration. What are you trying to accomplish?

JoeRobich avatar Aug 31 '22 16:08 JoeRobich

I have an old project, at the moment I can use only visual studio 2008 as IDE. I'm trying to port it in VS Code, with omnisharp, in order to find if it is possible to have better editing support.

krosthw avatar Sep 01 '22 05:09 krosthw