Problems going from .NET 4.0 to .NET 2.0

I ran into an issue late yesterday. It came to my attention that one of our builds was failing on a new project I submitted. Crap..

The build errors presented themselves as “Missing Assembly Or Reference” for my forms.resx file.

The only reason I can see this failing for is because I’ve set my .NET Framework to 2.0 instead of 4.0 Client Profile. To ensure that was the most likely cause, I switched back and tried to compile. SUCCESS. But that leaves me with the question, what’s going on with my .resx files?

Well after hitting up the internet for some solutions, some of which involved deleting my .resx files, then renaming my form files, then re-opening it, then adding the renamed version to get the .resx to rebuild *Ack*, it sounded like such a process… I decided to go rogue and figure it out myself.

Turns out it’s a really simple solution. Crack open the .resx file in xml mode, (This is easy to do if your builds are failing, just double click on the errors and you’ll be taken in) you’ll notice a lot of sections marked 4.0.0.0. If this is the case, all you need to do is re-write them as 2.0.0.0. This will fix the assembly reference and allow you to build your project properly.

Happy coding.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s