I have a resources file in my portable class library which is currently holding around 30 strings. They are accessible from my Windows Phone 8 app and the strings that are already in the file work fine.
However, now when I try to add a new string as I did before it causes a compilation error:
'System.Type' does not contain a definition for 'Assembly' and no extension method 'Assembly' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)
Looking in the .designer.cs file it's clear that this is the problem. When a new string is added two changes occur:
`global::System.Resources.ResourceManager("ViewModels.Resources.StringResources", typeof(StringResources).Assembly); appears in place of:
new global::System.Resources.ResourceManager("ViewModels.Resources.StringResources", typeof(StringResources).GetTypeInfo().Assembly);
The .GetTypeInfo() and disappearing using statement are the problem but I can't put them back because the file is generated by visual studio and changes back. Any ideas?
The only significant change I can think of is the new Visual Studio 2012 update 2?
Also worth noting: If I add another resx anywhere else in the project (the wp8 app or another pcl) then this exhibits the exact same behaviour when adding a string.
It seems that for the time being this is a bug in Visual Studio after Update 2. Please see here for more details:
https://connect.microsoft.com/VisualStudio/feedback/details/783211/resx-file-unable-to-be-edited-correctly-causes-compilation-error-in-generated-designer-file-after-vs2012-update-2#tabs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With