Search code examples
.net-coreblazor.net-standard.net-9.0

Found project reference without a matching metadata reference


Starting with .NET 9 I have a Solution containing a Blazor webapp, a couple of .NET 9 class libraries and ONE class library in .NET Standard 2.0 with only 2 entities.

When I run the Blazor project with dotnet watch, I get a warning coming from the .NET Standard library:

dotnet watch ⚠ msbuild: [Warning] Found project reference without a matching metadata reference: D:\DEV\Microgate\Microgate.Projects\src\Microgate.Projects.Contracts\Microgate.Projects.Contracts.csproj

The .csproj is very simple:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <Nullable>disable</Nullable>
    </PropertyGroup>
</Project>

And it has NO references at all:

enter image description here

Any advice on how to remove the annoying warning? Before upgrading to .NET 9, I didn't have this...

enter image description here


Solution

  • Try adding ProduceReferenceAssembly MSBuild property and set it to true:

    <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
    

    See original post here: https://github.com/dotnet/format/issues/56