NAnt errors when generating assembly info after project is upgraded to VS2010

Posted by Grant Palin on Stack Overflow See other posts from Stack Overflow or by Grant Palin
Published on 2010-05-14T18:26:19Z Indexed on 2010/05/15 6:34 UTC
Read the original article Hit count: 343

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about nant

Related posts about asminfo