project-system
project-system copied to clipboard
RESX code generation does not respect <LogicalName>
The RESX code generation does not respect the <LogicalName> metadata item on a <EmbeddedResource/> item.
For example, the following:
<EmbeddedResource Include="Resources\Designer.resx">
<LogicalName>Microsoft.VisualStudio.Editors.Designer.resources</LogicalName>
<SubType>Designer</SubType>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Designer.Designer.vb</LastGenOutput>
</EmbeddedResource>
Should result in code gen with:
Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Microsoft.VisualStudio.Editors.Designer", GetType(Designer).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
but actually results in:
Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Designer", GetType(Designer).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
We hit this fixing: https://github.com/dotnet/roslyn-project-system/issues/1056
I believe this occurs because we don't return the correct value for __VSHPROPID.VSHPROPID_DefaultNamespace for the .resx file item.
http://index/?rightProject=Microsoft.VisualStudio.Design&file=Serialization%5CResXFileCodeGenerator.cs&line=201
Looked at this with Dave and concluded that ResXFileCodeGenerator needs extra logic to consume the logical name for the item, and decided to do this via the browse object.
https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/257392?_a=files
This is the PR: https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/262111.
Is there a syntax for saying that the resource is a webresource (aka add the WebResourceAttribute to the metadata for the resulting assembly)