OmniSharp unable to load project with Razor?
See original GitHub issueEnvironment data
dotnet --info
output:
.NET SDK (reflecting any global.json):
Version: 5.0.104
Commit: ca6b6acadb
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/5.0.104/
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
3.1.112 [/usr/share/dotnet/sdk]
5.0.104 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
VS Code version: 1.54.3 C# Extension version: 1.23.9
OmniSharp log
https://gist.github.com/ThomasAunvik/e4bb57c12445136458908ce370445096
Steps to reproduce
I am not sure, but my it seems like my project is using Razor library from netstandard2.0 which fails to load the project that is running on core 3.1.
Expected behavior
To omnisharp to load the project correctly.
Actual behavior
Intellisense and other stuff like autocomplete stops working at all, and failes to load the main project.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/thaun/Documents/Projects/orkel-pi/ProductionInsight/Api/Api.csproj'.
/home/thaun/Documents/Projects/orkel-pi/ProductionInsight/Api/Api.csproj
/usr/share/dotnet/sdk/5.0.104/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.ScopedCss.targets(118,3): Error: The "Microsoft.AspNetCore.Razor.Tasks.DiscoverDefaultScopedCssItems" task could not be loaded from the assembly /usr/share/dotnet/sdk/5.0.104/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/../../tasks/net46/Microsoft.NET.Sdk.Razor.Tasks.dll. Invalid Image Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /home/thaun/Documents/Projects/orkel-pi/ProductionInsight/Api/Api.csproj```
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (4 by maintainers)
Top Results From Across the Web
omnisharp-vscode - Discover .NET
Official C# support for Visual Studio Code (powered by OmniSharp)
Read more >Tutorial: Get started with Razor Pages in ASP.NET Core
In this article. Prerequisites; Create a Razor Pages web app; Run the app; Examine the project files; Troubleshooting with the completed sample ...
Read more >Warning CS8032 An instance of analyzer Microsoft.NET.Sdk ...
CodeAnalysis not to load file or assembly, and omnisharp in vscode broken on 6.0.200 with this exception. To fix this error,either.
Read more >Razor editor crashing (intellisense stops working, false ...
Blazor.S35/obj/Debug/net6.0/project.razor.json' Error: Microsoft.AspNetCore.Razor.LanguageServer.JsonRpc.RazorOmniSharpRequestInvoker: Failed to handle ...
Read more >Omnisharp with VS Code: Error, "Project Loading Failed"
YouTube user : Axiom He explains how to fix Omnisharp loading. After I followed his video, It fixed my loading problem. On your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ThomasAunvik Thanks for all the great resources that you’ve provided.
This issue is a packaging issue with Arch’s dotnet-sdk package where the net46 Razor build tasks are missing from the Razor SDK. This file
/usr/share/dotnet/sdk/5.0.104/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/Microsoft.NET.Sdk.Razor.Tasks.dll
is missing from the package file listing https://archlinux.pkgs.org/rolling/archlinux-community-x86_64/dotnet-sdk-5.0.5.sdk202-1-x86_64.pkg.tar.zst.html.Your project builds fine using
dotnet build
because it looks for the net5 build tasks which are available. Because the C# extension relies on Mono to support .NET Full Framework projects, we look for the Full Framework net46 build tasks which are missing.This comment provides a work around https://github.com/OmniSharp/omnisharp-vscode/issues/4360#issuecomment-801181468 or you can try installing the dotnet-sdk-bin package which appears to have the necessary file https://archlinux.pkgs.org/rolling/chaotic-aur-x86_64/dotnet-sdk-bin-5.0.3.sdk200-1-x86_64.pkg.tar.zst.html.
@NTaylorMullen just a fyi
It would seem downloading the -bin version fixed the problem 👍 Closing this issue since #4360 already exists.