Nant and Embedded Resources

There was a bug in Nant such that the CSC task couldn’t embed strongly-typed resources. This was identified on the Nant mailing list and you can read about it here.
I had written about a work-around where you could add execution of the resgen executable to generate the binary resource (.resource) file and then embed it with the CSC task. There was one oddity with this method: until you had built that assembly within the Visual Studio IDE, at least one time, you could not embed the resource. Others have sited similar oddities.
This behavior is definitely strange and, obviously, not something you want to have to do. You shouldn’t have to have Visual Studio on your build or deployment machine(s) just to build your application one time to get this functionality to work, but this was the reality.
So, the resolution to this problem was, finally, to concede and call MSBuild within our Nant script. The change-over was quick as we were able to just re-use the csproj targets for our projects and build away.
Comparing apples (Nant) to apples (MSBuild), my choice to use Nant was based on familiarity. It did everything I needed it to do; until now. Now I feel compelled to switch to using/recommending MSBuild until it (MSBuild) doesn’t do something that I need it to do.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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