-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. #3180
Comments
I am also experiencing the same issues. After I use this hotfix solution for the Sdk.props file, it fixes OmniSharp for my VSCode. I have the same environment setup as the OP. |
@Vulfox |
@AR-Tour , it is written in the OP's post under the "Actual Behavior" title. It mentions changing this file |
I am having the same issue but on NixOS, where I cannot edit |
I'm having the same problem with .net core projects on NixOS. I'm using shell.nix
|
I installed the latest mono (6.0.0) and told vscode to use the global mono and this was resolved |
Editing the Sdk.props file for 2.2 worked for me, but the problem returned when I switched to 3.0, and editing the Sdk.props file no longer resolves it. OS: Ubuntu Mate 19.04 (Disco Dingo) |
@jfcarr I just started up my Ubuntu Mate 19.04 VM, and installed .Net Core 3.0 SDK using the Package Manager instructions from here: https://dotnet.microsoft.com/download/dotnet-core/3.0 The workaround mentioned here is no longer needed. With 3.0, the app built and ran for me without having to modify any of the props files. The SDK installed to /usr/share/dotnet/sdk/3.0.100/. |
@guy-rouillier I installed it the same way, but the error occurs for me. Perhaps a carry-over of the 2.2 issue, since I had it installed previously. |
I also had 2.2 installed, and still do as a matter of fact. Have you changed the TargetFramework to netcoreapp3.0?
If so, the 2.2 props settings should not come into play. |
I got it working. In addition to editing Sdk.props, I also had to set this environment variable:
|
Things start working as soon as I move |
I have the same issue (macOS). If anyone needs a repro, it happens on https://github.com/felixfbecker/PowerGit. I don't have mono installed at all, only .NET Core (several versions including v3). |
I get a very similar issue with the following error when trying to load a .net core project within a Unity C# solution on OSX: I resolved it by installing the lastest version of Mono |
Installing Mono on MacOS helped me as well. |
My fix for error in adrianwilczynski.add-reference: Re: [GitHub Developer Support] - Microsoft.Common.Props not found -FIX ....vscode\extensions\ms-dotnettools.csharp-1.21.15.omnisharp\1.34.14.msbuild\Current\Microsoft.Common.Props copy to ...\ProgramFiles\MSBuild\Current JR |
Issue Description
This problem occurs if I install dotnet from the Ubuntu 19.04 repositories. If I instead install from the Microsoft site, the problem does not occur. I don't know if this is an OmniSharp issue, or an Ubuntu packaging issue. So I'll start here, and if the issue belongs to Ubuntu, please let me know and Ill take it there.
Steps to Reproduce
Install dotnet-sdk-2.2 from the 19.04 repo. Then install Visual Studio Code from package code_1.36.1-1562627527_amd64.
IMPORTANT: After installing Visual Studio Code, start it up, and change the setting Omnisharp: Use Global Mono to "Never".
Set up GtkSharp with "dotnet new -i "GtkSharp.Template.CSharp"
Then create a GtkSharp app with "dotnet new gtkapp", and try to run it without debugging (or just build it from the terminal.)
Expected Behavior
App should build and run.
Actual Behavior
Failed to load project file '/data/projects/dotnet/GtkApp/GtkApp.csproj'.
/data/projects/dotnet/GtkApp/GtkApp.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. /usr/share/dotnet/sdk/2.2.301/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
Now, in Sdk.props, I see the following line for loading Microsoft.Common.props:
<Import
Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)\Microsoft.Common.props" />`If I change this instead to:
<Import Project="/usr/share/dotnet/sdk/2.2.301/Current/Microsoft.Common.props" />
then everything builds and runs fine. So, something is not setting the MSBuild environment variables correctly. I'm not familiar wtih MSBuild, so I can't figure out where those are constructed. Notice it is picking up the correct instance of Sdk.props from /usr/share/dotnet, but then attempting to load Microsoft.Common.props from /usr/lib/mono. But it shouldn't be doing that, since I told Code to never use Global Mono.
Logs
OmniSharp log
Failed to load project file '/data/projects/dotnet/GtkApp/GtkApp.csproj'.
/data/projects/dotnet/GtkApp/GtkApp.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. /usr/share/dotnet/sdk/2.2.301/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
C# log
Environment information
VSCode version: 1.36.1
C# Extension: 1.20.0
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 2.2.301 Commit: 70d6be0814Runtime Environment:
OS Name: ubuntu
OS Version: 19.04
OS Platform: Linux
RID: ubuntu.19.04-x64
Base Path: /usr/share/dotnet/sdk/2.2.301/
Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51
.NET Core SDKs installed:
2.2.301 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: