Database project is referencing wrong .Net Framework version

問題 Database project is referencing wrong .Net Framework version

  • Thursday, December 13, 2012 5:09 PM
     
     

    In Visual Studio 2010 I've created a Database project and specified Target .Net Framework 3.5 (for SQL CLR code). Within the code there is a reference to TimeZoneInfo class.

    Now I am getting an error message

    The type 'System.TimeZoneInfo' exists in both 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' 

    Now the question is - why the project is trying to look at Framework\v4.0.30319\mscorlib.dll at all? It does not belong to the target framework specified.

    This error is preventing project from building. Is there any workaround?

All Replies

  • Thursday, December 13, 2012 10:44 PM
    Moderator
     
     

    Maybe you included an explicit assembly references which conflicts with the selected CLR target version? The CLR target version of the project is listed in the SQLCLR tab.


    -GertD @ www.sqlproj.com

  • Friday, December 14, 2012 4:48 AM
     
     

    Maybe you included an explicit assembly references which conflicts ...

    No I did not include any references to .Net Framework 4 assemblies. The Framework\v4.0.30319\mscorlib.dll was put by Database projects itself and it is beyond of my control.

    Actually the problem I am describing is very easy to reproduce. Just try to use TimeZoneInfo class in  targeted to .Net Framework 3.5 Database project.