5

I have a resx file from a .NET 3.5 project. I would like to use that same file on a .NET standard 1.4 project so that I can just reference the .NET standard dll to a UWP and a .NET 4.6 project.

So I added the Strings.resx and Strings.Designer.cs as link to the .NET standard project but when I right click on the resx file and "Run Custom Tool", it does not generate the Designer.cs file.

Here's the content of the project file:

  <ItemGroup>
    <Compile Include="..\WindowsFormsApp2\Strings.Designer.cs" Link="Strings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Strings.resx</DependentUpon>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="..\WindowsFormsApp2\Strings.resx" Link="Strings.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>Strings.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

I'm using Visual Studio 2017 Pro, by the way.

Lance
  • 2,774
  • 4
  • 37
  • 57
  • It is questionable whether `PublicResXFileCodeGenerator` supports .NET Core usage. .NET Core tooling is known to have quite limited resx support. – Lex Li Dec 29 '18 at 03:56
  • 1
    I think .NET Standard supports PublicResXFileCodeGenerator because when I added a new resx file instead of linking one from an existing project. It does generate the class file. It doesn't generate the class file when I linked a resx file from an existing project. – Lance Dec 31 '18 at 15:09

0 Answers0