dotnet / project-system

The .NET Project System for Visual Studio
MIT License
959 stars 386 forks source link

Unexplained warnings while trying to add System.Web reference #9399

Closed bbbturan closed 3 months ago

bbbturan commented 4 months ago

Visual Studio Version

2022 - Version 17.8.6

Summary

Hello team,

I'm experiencing unexplained warning signs in my .NET 8 application, created with Visual Studio 2022, after adding the System.Web library as a COM reference. Additionally, when checking the tree, I observe an ID being displayed instead of the expected package name.

image

Steps to Reproduce

  1. Create a .NET 8 application using Visual Studio 2022.
  2. Add System.Web library as a COM reference.
  3. Observe unexplained warning signs.
  4. Inspect the tree to find an ID instead of the package name.
drewnoakes commented 4 months ago

Are you able to build the project without any errors?

Looking on my machine, I don't see a System.Web COM reference:

image

But the following steps do seem to reproduce the issue you're seeing for me:

  1. Create a new .NET Console App
  2. Right-click the Dependencies node and choose Add COM Reference
  3. Search for "System" and select "System.Drawing" (any version)
  4. Observe the solution explorer and project file: image

The XML added to the project doesn't include a name.

Building the project produces an error though:

MSB3290: Failed to create the wrapper assembly for type library "{d37e2a3e-8545-3a39-9f4f-31827c9124ab}". Type library 'System_Drawing' was exported from a CLR assembly and cannot be re-imported as a CLR assembly.

So it seems that this particular COM reference is not supported.

Adding other COM references produces a human-readable name in the Include attribute, and no yellow triangle.

adamint commented 3 months ago

@bbbturan

drewnoakes commented 3 months ago

Closing this site to inactivity. We can reopen if @bbbturan replies.