Project-system: Incorrect warning icons when ReferenceOutputAssembly="false"

Created on 28 Oct 2017  路  14Comments  路  Source: dotnet/project-system

Whenever I use ReferenceOutputAssembly="false", no matter what the target framework is (even between csproj and wixproj), I get a warning symbol even though there are no build warnings:

image

In this instance:

ClassLibrary1.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" ReferenceOutputAssembly="false" />
  </ItemGroup>

</Project>

ClassLibrary2.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
  </PropertyGroup>

</Project>
Bug Feature-Dependency-Node Resolution-Fixed Triage-Approved

Most helpful comment

A fix for this issue has been merged and will be released as part of 16.8.

All 14 comments

DevNotes: with ReferenceOutputAssembly="false", NuGet does not generate a project reference in the assets file:

      "frameworks": {
        "netstandard2.0": {
          "projectReferences": {}
        }
      },

This likely means a ResolvedProjectReference item is not produced. However this does not seem to be a problem in Microsoft.NET.Build.Extensions.Tasks.csproj which resolves its project reference correctly. Investigating further...

Do we have any workaround for hiding icon or reference?

Any news?

I have tried Dev 16 Preview and behavior is still observed. Any plans to fix it at upcoming version?

@evgeny-burmakov thanks for your patience. It's definitely on the radar. This issue will be updated as soon as there is any progress.

I believe this is the reason why we see warning icons in VS in Orleans. We use a ProjectReference with SkipGetTargetFrameworkProperties set in order to ensure correct build order (codegen must be built before projects which rely on it).

image

If I add a condition '$(DesignTimeBuild) != '' to the ProjectReference then the warning icon (and dependency) disappears but build inside VS fails.

image

Haven't tried, but Visible on the reference should be respected. If not, that's probably a different bug.

Visible does hide the project, but the warning icon on the Dependencies node remains

@drewnoakes This will be a case of dependency node expecting a counterpart design-time builds result for the item it finds in evaluation.

Seems likely. I'll test my repro solution for this issue as part of the work I'm doing on #4550.

We track this issue. Same ultimate cause: project has a special build step which causes it to need a non-build dependency on another project. Useless visual studio warning icon with no actual warning.

The established norm for referencing source generators as a project reference is to use OutputItemType="Analyzer" ReferenceOutputAssembly="false" so hits for this could start to increase with .NET 5. I mention this mainly so that searching for "Source Generator" correctly finds this issue, and because I happen to be using source generators a bunch at the moment 馃榿

A fix for this issue has been merged and will be released as part of 16.8.

Was this page helpful?
0 / 5 - 0 ratings