Geeks With Blogs
Colin Bowern ... more of the usual bool

We try to be good developers and this includes ensuring our warnings are taken care of.  A standard part of our debug builds includes treating warnings as errors.  When we were faced with migrating a project to a split .NET 1.1/2.0 build using MSBee we found it lacked the introduction of a preprocessor directive that would allow us to make the critical decisions in the code. 

One example where we needed this information had to do with the C# compiler (CSC) in .NET 1.1 lacking assembly signing options.  As a result we had to add back in the AssemblyKeyFile attribute.   When the Treat Warnings as Errors option is enabled this will cause an error in the .NET 2.0 C# Compiler.  To deal with this a little hack of the MSBuildExtras.Fx1_1.CSharp.targets file helped us out.  In the redefinition of the CSC task we modified:

DefineConstants="$(DefineConstants)"

to say:

DefineConstants="FX1_1;$(DefineConstants)"

Now we can define condition statements in our code:

#if FX1_1

// NOTE: Signed assemblies are not allowed in the ASP.NET application bin directory.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("C:\\Keys\\MyKey.snk")]

#endif

Hopefully this will make it to the final MSBee release. 

Posted on Sunday, March 12, 2006 6:49 PM Build and Deployment | Back to top


Comments on this post: Filtering .NET 1.1 functionality when using MSBuild and MSBee

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Colin Bowern | Powered by: GeeksWithBlogs.net