Project-system: Resx files are not generated in the design time build

Created on 10 Feb 2017  路  17Comments  路  Source: dotnet/project-system

  1. Create a new dotnet core Console Application
  2. Add a Resource file and create a string named String1
    image
  3. Go and use Resource1.String1 in a code file.
    image

Expected: resx file tools are run and String1 property is generated

Actual: Project needs to be rebuilt for resx files to generate

Bug

All 17 comments

This isn't design-time build, but rather the single file generator getting run.

I cannot repro this - do you have a consistent repro? If so, can you add the exactly steps (including what windows have focus)?

@davkean you see no errors at all? which build are you on?

Yesterdays

image

Thanks - that's a great way to show me, upgrading to today's and trying again.

Okay, I can repro this now. It appears we are not running the SingleFileGenerator when we switch docs, which I thought was supposed to happen. Interestingly enough, if I open the Designer file, the generation occurs. Building also doesn't cause it to generate.

Looks like we don't run these when changing the default namespace either: https://github.com/dotnet/project-system/issues/1933.

Going to give this one to you Jon, I've got too much on my plate for 15.3.

We should figure out when the legacy project system runs these and run them at the same time.

NOTE: be sure to test case mentioned in #1845 when verifying this fix

Looking at our code we seem to be hooking everything up correctly for single file generators, @lifengl is there a good way for a consumer of CPS to modify when single file generators are run?

@davkean You linked back to the same issue; I think you meant #2446.

@jamesqo Thanks, you would not believe how many times I do that.

Tracked in CPS with 453823

This isn't happening because the generator isn't running. This is happening because CPS is turning off change tracking for the generated file while it writes it to disk, causing Roslyn to not see/pick up the changes.

Was this page helpful?
0 / 5 - 0 ratings