views:

122

answers:

0

I'm trying to learn my way around the Microsoft Code Contracts libraries, and I have the following simple function:

internal static Engine CreateBuildEngine(Microsoft.Build.Framework.ILogger logger)
{
    Contract.Requires( logger != null );

    var engine = new Engine { DefaultToolsVersion = "3.5" };
    engine.RegisterLogger(logger);
    return engine;
}

When attempting to compile this, the contracts static compiler throws up the following warning message:

warning : contracts: Assembly load resulted in metadata import 'Could not resolve member reference: Microsoft.Build.BuildEngine.Engine::set_DefaultToolsVersion.'

and then promptly gives up (and doesn't attempt to do any further contract processing). If I remove the code which sets DefaultToolsVersion then the contract verifier works correctly, however this is rather pointless as it will cause the code to be incorrect.

I can't find any mention of this on google... Is there some way that I can fix this, or is it just a bug in the contracts library? (admittedly it's in pre-release status)

Thanks