Source-build: RHEL/CentOS 8 missing net46/Microsoft.NET.Sdk.Razor.Tasks.dll

Created on 28 Jan 2021  路  15Comments  路  Source: dotnet/source-build

Hi, I have an issue with a missing .dll file.

My C# extension no longer loads in VS Code due to this missing dll.

OmniSharp/omnisharp-vscode#4360

On the Ubuntu 20.04 LTS the dotnet-sdk-5.0 package has the following dll files:
/usr/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/Microsoft.NET.Sdk.Razor.Tasks.dll
/usr/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.Razor/tasks/net5.0/Microsoft.NET.Sdk.Razor.Tasks.dll

However, my CentOS 8 only has the following file installed after upgrading to 5.0.102:
/usr/lib64/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.Razor/tasks/net5.0/Microsoft.NET.Sdk.Razor.Tasks.dll

So it appears that in RHEL/CentOS 8 the following file(s) are missing:
/usr/lib64/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/Microsoft.NET.Sdk.Razor.Tasks.dll

ls -la tasks/net46/
-rw-r--r-- 1 root root 77192 Dec 14 20:17 Microsoft.NET.Sdk.Razor.Tasks.dll
-rw-r--r-- 1 root root 189832 Dec 14 20:17 System.Collections.Immutable.dll
-rw-r--r-- 1 root root 464776 Dec 14 20:17 System.Reflection.Metadata.dll

area-build area-product-experience blocking-downstream

Most helpful comment

Hey @dleeapho can we increase the priority of this issue and it's short-term and long-term fixes too? Due to this bug, the IDE experience (auto-completion/Intellisense) is completely broken for ASP.NET projects in 5.0.

All 15 comments

For context: CentOS builds .NET from source, based on the infrastructure in this repo dotnet/source-build. That's why it's different from the build produced by Microsoft.

We currently have a patch that removes the net46 build for this part of the SDK, so we'll have to look into removing the patch to build the net46 files. https://github.com/dotnet/source-build/blob/release/5.0/patches/aspnetcore/0010-Don-t-build-for-full-fx.patch. (It's not new to 5.0.102, it was in 5.0.100 as well: https://github.com/dotnet/source-build/blob/v5.0.100-SDK/patches/aspnetcore/0012-Don-t-build-for-full-fx.patch.)
@crummel do you happen to know why this patch was needed?

/cc @omajid (FWIW, the test script at https://github.com/dotnet/source-build/issues/1950 seems to work fine with CentOS 8's 5.0.102.)

@omajid (FWIW, the test script at #1950 seems to work fine with CentOS 8's 5.0.102.)

I took a quick look and it looks like that script only tries out a dotnet new console project, which works with omnisharp. Many other project types (for example, web, blazorserver) don't.

We got an error message from #2008 showing what the patch was avoiding:

Based on this error:

/src/artifacts/src/aspnetcore.2670c128d522473e146ff9f8159bfffdfe694cd9/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj : error NU1202: Package Microsoft.Build.Framework 16.8.3 is not compatible with net46 (.NETFramework,Version=v4.6). Package Microsoft.Build.Framework 16.8.3 supports: netstandard2.0 (.NETStandard,Version=v2.0) [/src/.dotnet/sdk/5.0.100/NuGet.targets]

I would guess we need to get rid of this DotNetBuildFromSource condition:

https://github.com/dotnet/msbuild/blob/39993bd9d02917993b6147a9973dc3aa6e9b00c7/src/Directory.Build.props#L29-L30

    <LibraryTargetFrameworks>$(FullFrameworkTFM);netstandard2.0</LibraryTargetFrameworks>
    <LibraryTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">netstandard2.0</LibraryTargetFrameworks>

On Centos 33 Omnisharp was crashing with exception and to solve that I had to install additional package:
dotnet add package Microsoft.NET.Sdk.Razor --version 3.1.12

Hey folks. Any progress on this? Is there anything I can do to help here?

Hey, @crummel @dseefeld @MichaelSimons. Any updates on this? This is affecting all users of source-build (Fedora, Arch, etc) and makes the IDE experience (eg, VSCode) really bad. Can we prioritize a fix for this? Do we need help from any other team?

We have a planning/triage meeting on Monday, I'll make sure to bring this up as something to prioritize. I'll noodle with the MSBuild issue a bit, I know we had to change that patch for the feature branch upgrade so maybe we can fix that now.

I just hit this one too.

[fail]: OmniSharp.MSBuild.ProjectLoader
        The "Microsoft.AspNetCore.Razor.Tasks.DiscoverDefaultScopedCssItems" task could not be loaded from the assembly /usr/lib64/dotnet/sdk/5.0.202/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 '/tmp/web/web.csproj'.

Is there a workaround for this issue? It makes the IDE (via omnisharp) unusable.

@zpxp

Is there a workaround for this issue? It makes the IDE (via omnisharp) unusable.

Adding the reference to Microsoft.NET.Sdk.Razor as was suggested: dotnet add package Microsoft.NET.Sdk.Razor --version 3.1.12. At least it fixed the issue for me on Arch Linux.

@zpxp

Is there a workaround for this issue? It makes the IDE (via omnisharp) unusable.

Adding the reference to Microsoft.NET.Sdk.Razor as was suggested: dotnet add package Microsoft.NET.Sdk.Razor --version 3.1.12. At least it fixed the issue for me on Arch Linux.

Thanks! Work for me.

I too try install bin packages dotnet-sdk-bin aspnet-runtime-bin aspnet-targeting-pack-bin from AUR and worked. To use it not is needed to add Razor package old.

Hey @dleeapho can we increase the priority of this issue and it's short-term and long-term fixes too? Due to this bug, the IDE experience (auto-completion/Intellisense) is completely broken for ASP.NET projects in 5.0.

I'm looking at this now, I'm hoping to get it done this week.

As another workaround, you can use the vscode dev containers and docker to develop inside the .NET 5 docker template image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leecow picture leecow  路  8Comments

dagood picture dagood  路  6Comments

omajid picture omajid  路  5Comments

tmds picture tmds  路  4Comments

crummel picture crummel  路  5Comments