Windows forms resx troubles.
After spending all of about two days trying to complete a build system for where I work, I came across a rather strange problem.
If you create a C# windows application project in Visual Studio .NET 2002, check the .resx file for the Form1.cs, you will find a couple of lines that refer to what version of the System.Windows.Forms assembly to use for the resx reader and writer. These will look like the following:
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
Now as you can probably see the version stated is 1.0.3102.0, this doesn't seem to cause VS.NET any problems, but as soon as you use NAnt the resgen application will throw errors regarding an invalid resx input.
To solve the problem, just draw a button on the form and delete it, this will then recreate the resx file, and it will now point to the correct version.
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
You may well ask that this problem will never arise since if you create a form you are going to add buttons and other controls on the form anyway so the resx will regenerate, the problem shows itself if you delete the resx for an existing form and then get the IDE to recreate it. It will recreate it against the old version so you will need to add a button and then delete it to assign it the correct version.
Not sure if VS.NET 2003 has this same issue, if someone finds out then let me know.