OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 94 forks source link

Microsoft.WebApplication.targets was not found #398

Open DamienCassou opened 6 years ago

DamienCassou commented 6 years ago

Omnisharp complains about missing WebApplication.targets. I have no clue what that means.

{"Event":"Error","Body":{"Text":"Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project \"/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.24.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets\" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  /home/cassou/Documents/projects/ftgp/monitor/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj\n 

In fact, there is no xbuild/ directory under v1.24.0. I can reproduce the problem with latest omnisharp-emacs and v1.26.0.

DamienCassou commented 6 years ago

This looks similar to https://github.com/OmniSharp/omnisharp-vscode/issues/1368.

DustinCampbell commented 6 years ago

It's not the same as https://github.com/OmniSharp/omnisharp-vscode/issues/1368. However, it would be good to get your full OmniSharp Log. In addition, what version of Mono do you have installed?

razzmatazz commented 6 years ago

@DamienCassou are you using the bundled server installable via omnisharp-install-server or did you build one for yourself?

@DustinCampbell on MacOS and Linux in omnisharp-emacs we are using the "specialized" server code from omnisharp-roslyn/releases page per platform, that have mono bundled.

DamienCassou commented 6 years ago

it would be good to get your full OmniSharp Log

[09:17:58] Starting OmniSharpServer using project folder/solution file: /project/Monitor.sln
[09:17:58] using server binary on /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/run
[09:17:58] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
[09:17:58] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[09:17:58] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild
            CscToolPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[09:18:00] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/project'.
[09:18:02] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[09:18:02] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /project
[09:18:02] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
[09:18:02] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
[09:18:02] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
[09:18:02] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Detecting projects in '/project/Monitor.sln'.
[09:18:02] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[09:18:02] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj'.
[09:18:02] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Test/Monitor.Test.csproj
[09:18:03] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[09:18:03] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[09:18:03] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[09:18:04] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[09:18:04] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.DataAccess.CouchRepositories/Monitor.DataAccess.CouchRepositories.csproj
[09:18:04] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Economic/Monitor.Import.Economic.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Resources/Monitor.Resources.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor/Monitor.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/DevDefined.OAuth/src/DevDefined.OAuth/DevDefined.OAuth.csproj
[09:18:05] WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Could not find rule set file "AllRules.ruleset".
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api/Foretagsplatsen.Api.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api.SimpleConsoleClient/Foretagsplatsen.Api.SimpleConsoleClient.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie/Monitor.Import.Sie.csproj
[09:18:05] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie.Test/Monitor.Import.Sie.Test.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie.Resources/Monitor.Import.Sie.Resources.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Reports/Monitor.Reports.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Divan/src/Divan.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Divan/Tests/Divan.Test.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api2/Foretagsplatsen.Api2.csproj
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[09:18:06] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj'.
[09:18:06] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Shared/Monitor.Web.Shared.csproj
[09:18:07] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/fortnox-csharp-api-sdk/FortnoxAPILibrary/FortnoxAPILibrary.csproj
[09:18:07] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Fortnox/Monitor.Import.Fortnox.csproj
[09:18:07] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Xero/Monitor.Import.Xero.csproj
[09:18:07] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Xero-Net/Xero.Api/Xero.Api.csproj
[09:18:07] WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, No assemblies were read in from the redist lists. A TargetFramework profile exclusion list could not be generated. 
[09:18:07] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Xero-Net/Xero.Api.Example.Applications/Xero.Api.Example.Applications.csproj
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Test
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Found referenced project outside root directory: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[09:18:08] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj'.
[09:18:08] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Unable to resolve project reference '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj' for 'Monitor.Test'.
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Found referenced project outside root directory: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[09:18:08] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj'.
[09:18:08] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Unable to resolve project reference '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj' for 'Monitor.Test'.
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.DataAccess.CouchRepositories
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Economic
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Resources
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: DevDefined.OAuth
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api.SimpleConsoleClient
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie.Test
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie.Resources
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Reports
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Divan
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Divan.Test
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api2
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Web.Shared
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: FortnoxAPILibrary
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Fortnox
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Xero
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Xero.Api
[09:18:08] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Xero.Api.Example.Applications
[09:18:08] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/project'.
[09:18:09] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[09:18:09] INFORMATION: OmniSharp.Stdio.Program, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[09:18:09] INFORMATION: OmniSharp.Stdio.Program, Configuration finished.
[09:18:09] INFORMATION: OmniSharp.Stdio.Program, Omnisharp server running using Stdio at location '/project' on host -1.
[09:18:12] <-- 1 /codecheck: ((QuickFixes . [((LogLevel . "Error") (FileName . "/project/monitor/Monitor/Domain/Accounts/ChartOfAccounts.cs") (Line . 39) (Column . 25) (EndLine . 39) (EndColumn . 40) (Text . "The type or namespace name 'ICanJson' could not be found (are you missing a using directive or an assembly reference?)") (Projects . ["Monitor"])) ((LogLevel . "Error") (FileName . "/project/monitor/Monitor/Domain/Accounts/ChartOfAccounts.cs") (Line . 316) (Column . 13) (EndLine . 316) (EndColumn . 40) (Text . "The type or namespace name 'ICanJson' could not be found (are you missing a using directive or an assembly reference?)") (Projects . ["Monitor"])) ((LogLevel . "Error") (FileName . "/project/monitor/Monitor/Domain/Accounts/ChartOfAccounts.cs") (Line . 375) (Column . 17) (EndLine . 375) (EndColumn . 43) (Text . "The type or namespace name 'ICanJson' could not be found (are you missing a using directive or an assembly reference?)") (Projects . ["Monitor"])) ((LogLevel . "Error") (FileName . "/project/monitor/Monitor/Domain/Accounts/ChartOfAccounts.cs") (Line . 467) (Column . 20) (EndLine . 467) (EndColumn . 32) (Text . "The type or namespace name 'ICanJson' could not be found (are you missing a using directive or an assembly reference?)") (Projects . ["Monitor"]))]))

In addition, what version of Mono do you have installed?

$ mono --version
Mono JIT compiler version 4.8.0 (Stable 4.8.0.520/8f6d0f6 Wed Mar 15 15:23:40 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen
~

are you using the bundled server installable via omnisharp-install-server or did you build one for yourself?

the bundled version. I let omnisharp-emacs do everything.

DustinCampbell commented 6 years ago

@razzmatazz yes, but OmniSharp does not include all of the MSBuild targets necessary to process every possible project. It just contains a minimal set. In particular, a .NET Framework Web Application targets are not included with OmniSharp, so it would try to locate them within a Mono installation on Mac/Linux.

@DamienCassou: From the log above, it looks like it the MSBuildExtensionsPath variable did not get set to /usr/lib/mono/xbuild. Could you try updating to the latest version of Mono? I'm not sure what distro you're using, but you can update to the latest (5.4.0) here: http://www.mono-project.com/download/#download-lin.

DamienCassou commented 6 years ago

@DustinCampbell: I'm on Fedora 26. I tried to follow the instructions on the link you gave me, but this results in conflicts with the package system:

Error: Transaction check error:
  file /usr/lib/mono/4.0-api from install of mono-devel-5.4.0.201-0.xamarin.1.epel7.x86_64 conflicts with file from package mono-core-4.8.0-7.fc26.x86_64
  file /usr/lib/mono/4.5-api from install of mono-devel-5.4.0.201-0.xamarin.1.epel7.x86_64 conflicts with file from package mono-core-4.8.0-7.fc26.x86_64
  file /usr/lib/mono/4.0-api/Accessibility.dll conflicts between attempted installs of mono-devel-5.4.0.201-0.xamarin.1.epel7.x86_64 and mono-winforms-5.4.0.201-0.xamarin.1.epel7.x86_64
[...]
DustinCampbell commented 6 years ago

Did you use the CentOS instructions? Those have worked for me on Fedora 26.

Regardless, if you can't update, you might be able to fix the issue by dropping an omnisharp.json file at the root of your repo with the following content:

{
    "MsBuild": {
        "MSBuildExtensionsPath": "/usr/lib/mono/xbuild"
    }
}
DamienCassou commented 6 years ago

Dustin Campbell notifications@github.com writes:

Did you use the CentOS instructions? Those have worked for me on Fedora 26.

yes. This resulted in the addition of a download.mono-project.com_repocentos7.repo file in /etc/yum.repos.d. Still, this does not work.

Regardless, if you can't update, you might be able to fix the issue by dropping an omnisharp.json file at the root of your repo with the following content:


{
    "MsBuild": {
        "MSBuildExtensionsPath": "/usr/lib/mono/xbuild"
    }
}

There is no xbuild in /usr/lib/mono:

4.0-api -> 4.5
4.5
4.5-api -> 4.5
dbus-sharp-2.0
dbus-sharp-glib-2.0
gac
gtk-sharp-2.0
mono-configuration-crypto
monodoc
notify-sharp
nunit
webkit-sharp

-- Damien Cassou http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill

DustinCampbell commented 6 years ago

Ok. That explains why OmniSharp didn't work correctly. It does sound like you'll need a newer Mono to get the WebApplication.targets on your machine that are needed to open this project. I don't know why the CentOS packages aren't working for you. Unfortunately, they've always worked for me so I've never had to troubleshoot them. I'll try setting up a new Fedora 26 VM today and see if those packages still install for me.

DustinCampbell commented 6 years ago

FWIW, I just tried on a clean Fedora 26 VM and was able to yum install mono-devel after following the CentOS 7 steps at http://www.mono-project.com/download/#download-lin-centos:

[dcampbell@fedora-26 ~]$ mono --version
Mono JIT compiler version 5.4.0.201 (tarball Wed Oct  4 17:15:30 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)
DamienCassou commented 6 years ago

@DustinCampbell I gave it another shot and I managed to install 5.4 (I had to delete some packages for that).

I still have the same message though. Here is an extract of the log:

Starting OmniSharpServer using project folder/solution file: /project/Monitor.sln
using server binary on /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/run
INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild
            CscToolPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/project'.
INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /project
INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Detecting projects in '/project/Monitor.sln'.
INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj'.
INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Test/Monitor.Test.csproj
ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Could not write lines to file "/Debug/Monitor.Test.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Monitor.Test.csproj.CoreCompileInputs.cache".
WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Test/Monitor.Test.csproj'.
INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.DataAccess.CouchRepositories/Monitor.DataAccess.CouchRepositories.csproj
WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Could not write lines to file "/Debug/Monitor.DataAccess.CouchRepositories.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Monitor.DataAccess.CouchRepositories.csproj.CoreCompileInputs.cache".
WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.DataAccess.CouchRepositories/Monitor.DataAccess.CouchRepositories.csproj'.
WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/thirdparty/libs/Xero-Net/Xero.Api.Example.Applications/Xero.Api.Example.Applications.csproj'.
INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/project'.
INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
INFORMATION: OmniSharp.Stdio.Program, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
INFORMATION: OmniSharp.Stdio.Program, Configuration finished.
INFORMATION: OmniSharp.Stdio.Program, Omnisharp server running using Stdio at location '/project' on host -1.
<-- 1 /codecheck: ((QuickFixes . []))

2 things to note from this log:

Now, the /usr/lib/mono directory contains more entries, including xbuild/:

2.0-api
3.5-api
4.0
4.0-api
4.5
4.5.1-api
4.5.2-api
4.5-api
4.6.1-api
4.6.2-api
4.6-api
4.7-api
gac
gtk-sharp-3.0
mono-configuration-crypto
monodoc
msbuild
nunit
xbuild
xbuild-frameworks

Even though there is no 5.4 entry there (should there be one?), I confirm I'm using 5.4:

$ mono --version
Mono JIT compiler version 5.4.0.201 (tarball Wed Oct  4 17:15:30 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen (concurrent by default)
DamienCassou commented 6 years ago

I still suffer from the same problem. Can anyone help me?

DustinCampbell commented 6 years ago

Try installing the Mono msbuild package: sudo dnf install msbuild

DamienCassou commented 6 years ago

Thank you @DustinCampbell. This makes omnisharp-emacs basically working again. However, the error message still appears in the log

[16:16:40] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

and I still get compilation errors that should not be there

"The type or namespace name 'ICanJson' could not be found"

Here is my log now:

[16:16:36] Starting OmniSharpServer using project folder/solution file: /project/Monitor.sln
[16:16:36] using server binary on /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/run
[16:16:37] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
[16:16:37] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[16:16:37] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /usr/lib/mono/xbuild
            CscToolPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[16:16:38] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/project'.
[16:16:39] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[16:16:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Initializing in /project
[16:16:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Auto package restore: False
[16:16:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Update workspace context
[16:16:39] INFORMATION: OmniSharp.DotNet.DotNetProjectSystem, Resolving projects references
[16:16:39] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Detecting projects in '/project/Monitor.sln'.
[16:16:39] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[16:16:39] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj'.
[16:16:39] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Test/Monitor.Test.csproj
[16:16:40] ERROR: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, The imported project "/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.0/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
[16:16:41] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.DataAccess.CouchRepositories/Monitor.DataAccess.CouchRepositories.csproj
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Economic/Monitor.Import.Economic.csproj
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Resources/Monitor.Resources.csproj
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor/Monitor.csproj
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/DevDefined.OAuth/src/DevDefined.OAuth/DevDefined.OAuth.csproj
[16:16:42] WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, Could not find rule set file "AllRules.ruleset".
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api/Foretagsplatsen.Api.csproj
[16:16:42] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api.SimpleConsoleClient/Foretagsplatsen.Api.SimpleConsoleClient.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie/Monitor.Import.Sie.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie.Test/Monitor.Import.Sie.Test.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Sie.Resources/Monitor.Import.Sie.Resources.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Reports/Monitor.Reports.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Divan/src/Divan.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Divan/Tests/Divan.Test.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/clients/DotNet/Foretagsplatsen.Api2/Foretagsplatsen.Api2.csproj
[16:16:43] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[16:16:44] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj'.
[16:16:44] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Shared/Monitor.Web.Shared.csproj
[16:16:44] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/fortnox-csharp-api-sdk/FortnoxAPILibrary/FortnoxAPILibrary.csproj
[16:16:44] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Fortnox/Monitor.Import.Fortnox.csproj
[16:16:45] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Import.Xero/Monitor.Import.Xero.csproj
[16:16:45] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Xero-Net/Xero.Api/Xero.Api.csproj
[16:16:45] WARNING: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo, No assemblies were read in from the redist lists. A TargetFramework profile exclusion list could not be generated. 
[16:16:45] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/thirdparty/libs/Xero-Net/Xero.Api.Example.Applications/Xero.Api.Example.Applications.csproj
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Test
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Found referenced project outside root directory: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj
[16:16:46] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj'.
[16:16:46] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Unable to resolve project reference '/project/monitor/Monitor.Web.Api/Monitor.Web.Api.csproj' for 'Monitor.Test'.
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Found referenced project outside root directory: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Loading project: /project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj
[16:16:46] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Failed to load project file '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj'.
[16:16:46] WARNING: OmniSharp.MSBuild.MSBuildProjectSystem, Unable to resolve project reference '/project/monitor/Monitor.Web.Ui/Monitor.Web.Ui.csproj' for 'Monitor.Test'.
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.DataAccess.CouchRepositories
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Economic
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Resources
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: DevDefined.OAuth
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api.SimpleConsoleClient
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie.Test
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Sie.Resources
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Reports
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Divan
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Divan.Test
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Foretagsplatsen.Api2
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Web.Shared
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: FortnoxAPILibrary
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Fortnox
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Monitor.Import.Xero
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Xero.Api
[16:16:46] INFORMATION: OmniSharp.MSBuild.MSBuildProjectSystem, Update project: Xero.Api.Example.Applications
[16:16:46] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/project'.
[16:16:46] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[16:16:46] INFORMATION: OmniSharp.Stdio.Program, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[16:16:46] INFORMATION: OmniSharp.Stdio.Program, Configuration finished.
[16:16:46] INFORMATION: OmniSharp.Stdio.Program, Omnisharp server running using Stdio at location '/project' on host -1.
razzmatazz commented 6 years ago

@DamienCassou have you tried commenting out the lines with Microsoft.WebApplication.targets and AllRules.ruleset from your .csproj xmls?

you might not need those targets for building/loading in omnisharp because, I think:

DamienCassou commented 6 years ago

@DamienCassou have you tried commenting out the lines with Microsoft.WebApplication.targets

this removes the error I had.

and AllRules.ruleset from your .csproj xmls?

I have no such thing in any file of my project.

if it helps you load the solution

the solution loads even when keeping the Microsoft.WebApplication.targets lines.

razzmatazz commented 6 years ago

Sorry, most probably I did not understand you before. Are those errors you listed in your previous comment blocking your workflow with omnisharp-emacs or just something that is shown on the log (but everything works ok otherwise)?

DamienCassou commented 6 years ago

Saulius Menkevičius notifications@github.com writes:

Sorry, most probably I did not understand you before. Are those errors you listed in your previous comment blocking your workflow with omnisharp-emacs or just something that is shown on the log (but everything works ok otherwise)?

Everything works ok now as far as I can tell. But I'm still surprised by the amount of warnings in the log.

-- Damien Cassou http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill

DamienCassou commented 6 years ago

Regarding WebApplication.targets, our project has:

  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />

Do you see anything suspicious there? When using omnisharp, I have the impression that the first line triggers this error:

Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project \"/home/cassou/.emacs.d/var/omnisharp/cache/server/v1.26.3/xbuild/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets\" was not found

Using locate gives me this result:

Is there something we could fix on the project to make it work for everyone?