dotnet / project-system

The .NET Project System for Visual Studio
MIT License
969 stars 387 forks source link

Determine the project context when opening the RESX designer #5757

Open tmeschter opened 4 years ago

tmeschter commented 4 years ago

Currently, when you open a .resx file in the designer on a cloud-connected client there is no way to tell what project the file is associated with. This creates the following known limitations in the designer experience:

It probably causes other limitations as well (not yet verified):

Some other component (AnyCode?) will need to provide an API to determine the project on the client side. This task tracks using that information in the designer to find the project and file (that is, the IVsHierarchy for the project, and the ItemID for the file in the hierarchy) on the server, and any other updates that need to be made.

ocallesp commented 4 years ago

The context is missing because on nexus client Editors receive IVsHierarchy from Miscellaneous Files Project which means that the itemID doesn't belong to any project. This is by design, so a lot of refactor is needed in ProjectSystem to handle nexus and non-nexus.

ProjectModelQueryableSpace from CPS can help us to fetch some information from the server.

In Nexus client, this is the list of APIs that are broken in Editor Resource Designer:

ocallesp commented 4 years ago

This work item AzDO will fix part of the context on the client https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1178677

verelpode commented 3 years ago

Using RESX without WinForms

Related to this .resx issue, it would be great if the .resx Designer/GUI could be updated/modernized to stop producing WinForms references when a .resx file is used in a non-WinForms .csproj targeting NETFW 5 (SDK-style .csproj). Note resx does not require WinForms, but currently the Designer/GUI for it is creating resx files that do contain references to "System.Windows.Forms.dll", although resx could also be used outside of WinForms.

Currently the resx Designer/GUI in VS 16.8.3 produces resx files that do contain references to WinForms like this example:

<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="DgmlGraph" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Resources\DgmlGraph.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>

Ideally the resx Designer/GUI should only produce WinForms references when it is for a project targeting WinForms, not when it is used in a Console project with SDK/NETFW/5.

resx is useful, especially for the purpose of performing culture/language localizations. It would be great to see an updated version of the resx Designer that is suited for non-WinForms .csproj's that use NETFW 5 (SDK-style .csproj), including Console projects and ASP.NET 5 projects etc.

See also my detailed resources notes in the later message in https://github.com/dotnet/project-system/issues/4534#issuecomment-751579541

ocallesp commented 1 year ago

This work is not needed, since this is for the client-server architecture.