locked
VS C# 2010 how to downgrade project from 4.0 to 3.5 framework?

    Question

  • Hi!

    When I used CS C# 2010 option to change the target framework (Project -> Properities -> App -> Target Framework) I got some errors which I can't handle.

    • Warning    1    The primary reference "Microsoft.CSharp", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Client". To resolve this problem, either remove the reference "Microsoft.CSharp" or retarget your application to a framework version which contains "Microsoft.CSharp".
    • Warning    2    The referenced component 'Microsoft.CSharp' could not be found.

    Project can't be started, there is nothing really I can do with it - hopefully I have a backup.
    I really have to downgrade my project to target framework 3.5 because client computers are not allowed to use .NET 4.0.

    Is there a way to do that? OR how can I fix this problem to run my project with 3.5 framework?
    Moreover, my empty projects can't be downgraded also - the same warrnings, and the project is not starting.

    Thank you in advance!

    Wednesday, January 26, 2011 4:27 PM

Answers

  • Hi Friend,
       Are you using any method or class from the "Microsoft.CSharp" Assembly? Actually, there will be some references added automatically when you have specific targetted version. when you downgrade the target framework version, the assembly referance will be removed and the namespace will be used in the "using" block of the code files created in the project. if you are not using those files, you can manually remove those referances by removing the using code block of that specific namespace. It would work fine.


    -- Thanks Ajith R
    Wednesday, January 26, 2011 4:59 PM

All replies

  • Hi Friend,
       Are you using any method or class from the "Microsoft.CSharp" Assembly? Actually, there will be some references added automatically when you have specific targetted version. when you downgrade the target framework version, the assembly referance will be removed and the namespace will be used in the "using" block of the code files created in the project. if you are not using those files, you can manually remove those referances by removing the using code block of that specific namespace. It would work fine.


    -- Thanks Ajith R
    Wednesday, January 26, 2011 4:59 PM
  • Microsoft.CSharp is a new assembly for v4.  You can remove this reference if you are targeting previous versions.

    Michael Taylor - 1/26/2011
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Shabi Bloch Sunday, March 06, 2011 1:51 AM
    Wednesday, January 26, 2011 5:51 PM