How do I stop the winform designer putting the version of custom controls in a .resx file?
We are getting issues with both the merging of .resx files and the winform designer not being able to open form/controls due to the designer putting the version of custom controls in .resx files. I would like it to always put in Version=0.0.0.0.
This is what it is doing:
<data name=">>subPageSplitter.Type" xml:space="preserve">
<value>KSS.Common.Windows.Forms.Splitter, KSS.Common.Windows.Forms, Version=4.2.0.2445, Culture=neutral, PublicKeyToken=516e9f009179834d</value>
</data>
This is what I would like:
<data name=">>subPageSplitter.Type" xml:space="preserve">
<value>KSS.Common.Windows.Forms.Splitter, KSS.Common.Windows.Forms, Version=0.0.0.0, Culture=neutral, PublicKeyToken=516e9f009179834d</v开发者_开发知识库alue>
</data>
(The fact that our build servers sets the versions in GlobalAssemblyInfo.cs and check it in after every build does not help!)
The related problem of how to cope with the WinForm designer reordering items when merging resx files is covered in this CodeProduct article.
The best solution I can think of doesn't involve stopping the reference, and isn't very neat, but it should ease the symptoms:
You could create a custom tool ResXResourceReader
/ ResXResourceWriter
(or just XDocument
classes) to run on the .resx
files. You could add it to the Context Menu for files (Tools, Customise, Context Menu dropdown). Then right-click and 'fixup' on it (would involve a macro to call your tool, or you could do the processing in the macro itself).
You could also use a FileSystemWatcher
to look for .resx files being created/modified, and run it automatically. If it's being modified, then it should be checked out of source control, so there shouldn't be any read-only issues.
精彩评论