Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight incompatibility with the old MSBuild way of doing resources #146

Open
lcsondes opened this issue Jan 15, 2019 · 3 comments
Open

Slight incompatibility with the old MSBuild way of doing resources #146

lcsondes opened this issue Jan 15, 2019 · 3 comments

Comments

@lcsondes
Copy link

If you have an old WinForms project and add a space to your class name, it gets turned into an underscore so you would have for instance Test Class.cs containing Test_Class.

With this SDK (which saved our hides btw, it's amazing!) this behavior is mostly retained, however in the automatically-generated code's ResourceManager property getter there's a line that looks somewhat like this:

global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MyNamespace.Test ClassResources", typeof(Test_ClassResources).Assembly);

And the space/underscore mismatch eventually leads to a runtime exception.

I did the trivial fix, which is to simply rename the class, but thought I'd report this as a small piece of incompatibility compared to old WinForms csprojs.

@clairernovotny
Copy link
Collaborator

Interesting… two questions

  • What version of the .NET SDK Core were you using? (3.0 preview or 2.x)?
  • Were you using the Extras (As WinForms is supported directly by 3.x)

What are the exact repro steps?

This seems like a bug somewhere in VS though @davkean, do you know where this bug should go?

@lcsondes
Copy link
Author

Hi, I'm using 2.1, most of my csprojs are using the Microsoft SDK, but the WinForms ones are using Extras.

Repro steps: make an old .NET framework Winforms project, add a new form that has a space in its name, manually edit the csproj to be an SDK-style csproj, build, run, observe exception. Here's a snippet of how my csproj looks.

<Project Sdk="MSBuild.Sdk.Extras">
  <ItemGroup>
    <Reference Include="System.Management" />
    <Reference Include="System.Windows.Forms" />
  </ItemGroup>
  <ItemGroup>
    <Compile Update="Test Class.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Test Class.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Update="Test Class.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Test Class.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
</Project>

@clairernovotny
Copy link
Collaborator

I'm going to close this as WinForms/WPF issues should be in the main SDK at this point for 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants