views:

230

answers:

2

I have a project I recently upgraded to VS2010 - the project/solution files are updated, but I'm still targeting .NET 3.5.

Until now, my standard NAnt build script has not given me any trouble. However, it appears that after updating the project, and updating the NAnt config to be aware of the new tooling, I am now receiving an error when autogenerating assembly information, which fails the build. The relevant build task is below:

<asminfo output="${dir.src}\${file.commonAssemblyInfo}" language="${project.codeLanguage}">
    <imports>
        <import namespace="System.Reflection" />
    </imports>
    <attributes>
        <attribute type="AssemblyVersionAttribute" value="${project.fullversion}" />
        <attribute type="AssemblyFileVersionAttribute" value="${project.fullversion}" />
        <attribute type="AssemblyInformationalVersionAttribute" value="${project.fullversion}" />
        <attribute type="AssemblyCopyrightAttribute" value="${assembly.copyright}" />
        <attribute type="AssemblyCompanyAttribute" value="${assembly.company}" />
        <attribute type="AssemblyConfigurationAttribute" value="${project.config}" />
        <attribute type="AssemblyTrademarkAttribute" value="${assembly.trademark}" />
        <attribute type="AssemblyProductAttribute" value="${assembly.product}" />
    </attributes>
</asminfo>

The error is highlighted for the first line of the asminfo task. It reads:

AssemblyInfo file 'C:\Users\Grant\Projects\VisualStudio\Checklist\src\CommonAssemblyInfo.cs' could not be generated. This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

I've gathered so far that this is something new to .NET 4. Has anyone had to address this error before? Does anyone know what it is about asminfo that may be triggering the error?

+1  A: 

I believe I figured it out. It turns out that some security aspects of the framework were changed, which the new tooling takes into account, but which the older version of NAnt does not (was using 0.85).

I updated my NAnt using the latest nightly from the NAnt site (0.91 is in beta, has .NET 4 support), reran my build, and it worked. I had to fix a separate issue, but the build is now working.

Grant Palin
A: 

The NAnt team has just release NAnt 0.91 Alpha 1, with .NET 4.0 support (experimental). Please download to test and provide your valuable feedback to the team.

Thanks.

Charles
I saw that news recently...does the alpha supersede the previously nightly, from May 12?
Grant Palin
NAnt 0.91 Alpha 1 was released on May 30. So yes, it superseds the nightly from May 12.
Charles