Skip to content
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

Omnisharp cannot load Microsoft.NET.Sdk.Web projects at all. #4638

Closed
Kemsekov opened this issue Jul 3, 2021 · 1 comment
Closed

Omnisharp cannot load Microsoft.NET.Sdk.Web projects at all. #4638

Kemsekov opened this issue Jul 3, 2021 · 1 comment

Comments

@Kemsekov
Copy link

Kemsekov commented Jul 3, 2021

My vs code omnisharp cannot load asp.net project with Microsoft.NET.Sdk.Web. I have no intellisense at all.

But when I set
<Project Sdk="Microsoft.NET.Sdk.Web">

In my csproj file to
<Project Sdk="Microsoft.NET.Sdk">

It suddenly load project successfully and all works fine (except executable, because it is wrong sdk for asp.net)

I am incredibly annoyed to switch between Sdk for developing and building executable.

Omnisharp Logs

[fail]: OmniSharp.MSBuild.ProjectLoader
        The "Microsoft.AspNetCore.Razor.Tasks.DiscoverDefaultScopedCssItems" task could not be loaded from the assembly /usr/share/dotnet/sdk/5.0.204/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.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/vlad/Programs/Programs/Git/microservices/Ordering/Ordering.csproj'.
/home/vlad/Programs/Programs/Git/microservices/Ordering/Ordering.csproj
/usr/share/dotnet/sdk/5.0.204/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.204/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/vlad/Programs/Programs/Git/microservices/Ordering/Ordering.csproj

Environment data

dotnet --info shows

 Version:   5.0.204
 Commit:    84d1fe1bb7

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.204/

Host (useful for support):
  Version: 5.0.7
  Commit:  a002cbfb6b

.NET SDKs installed:
  5.0.204 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

code --version shows

1.57.1
507ce72a4466fbb27b715c3722558bb15afa9f48
x64

csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

Expected behavior

Loads project with <Project Sdk="Microsoft.NET.Sdk.Web"> in csproj as fine as project with
<Project Sdk="Microsoft.NET.Sdk">.

Actual behavior

Every project with Microsoft.NET.Sdk.Web sdk in csproj cannot be loaded by omnisharp

Steps to repoduce

Create any dotnet web or webapi application and try to open it with vs code with installed omnisharp extension

@Kemsekov
Copy link
Author

Kemsekov commented Jul 3, 2021

Worked this for me.
#4360 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant