1

I have a tool that generates resource files (.resx). In order to update the c#-Design file, I need to run the "run custom command" for the .resx-Files.

In order to automate this, I added the GenerateResource task to the build file. This generates the c# file before every compilation.

The code generated with GenerateResource includes following: typeof(Default).Assembly. When I run the custom tool command this part is: typeof(Default).GetTypeInfo().Assembly.

The resource file is part of a PCL project, in which the type Type does not contain a property Assembly.

The code says it was generated with "System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0" but should have been generated with "System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0" instead.

Is there a way to specify the version that should be used by the task? Or another way to automaticly generating these source files without relying on plugins?

lokimidgard
  • 1,039
  • 10
  • 26
  • for all that have the same problem. My current workaround is based on [this](http://stackoverflow.com/questions/7837644/how-to-replace-string-in-file-using-msbuild) question. I just replace the not working call with a working one after the code was generate. Ugly. – lokimidgard Sep 06 '16 at 15:26

1 Answers1

0

I run into the same situation, GenerateResource needs to be adjusted to use the desired version of the SDK tool resgen.exe. GenerateResource task has a property SdkToolsPath, by setting it to e.g. $(TargetFrameworkSDKToolsDirectory) might help you.

hollo
  • 41
  • 3