Visual C# Developer Center > Visual C# Forums > Visual C# General > How to bulk update Target Framework of Project
Ask a questionAsk a question
 

AnswerHow to bulk update Target Framework of Project

  • Tuesday, November 03, 2009 5:35 PMEagle Tsui Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    My solution have 30 project's used .net 3.5, now I need to update all project's to .net 4.0. My question is how to bulk update Target Framework from 3.5 to 4.0 of all project's?
    Eagle

Answers

  • Wednesday, November 04, 2009 2:44 AMJi.ZhouMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello Eagle,


    All C# and VB.NET project files (.csproj, .vbproj) are text based and can be understood by msbuild.exe. If you open these .csproj files in notepad.exe, you can find there is a element in it which specifies the .NET Target Framework.
    --------------------------------------------------------------------------------------------------------------
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    --------------------------------------------------------------------------------------------------------------

    You can write some Console application to find that elements in your 30 project files and change them to target  .NET 4.0

    http://msdn.microsoft.com/en-us/library/bb383796.aspx 



    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

All Replies

  • Wednesday, November 04, 2009 2:44 AMJi.ZhouMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hello Eagle,


    All C# and VB.NET project files (.csproj, .vbproj) are text based and can be understood by msbuild.exe. If you open these .csproj files in notepad.exe, you can find there is a element in it which specifies the .NET Target Framework.
    --------------------------------------------------------------------------------------------------------------
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    --------------------------------------------------------------------------------------------------------------

    You can write some Console application to find that elements in your 30 project files and change them to target  .NET 4.0

    http://msdn.microsoft.com/en-us/library/bb383796.aspx 



    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Tuesday, November 10, 2009 2:13 AMJi.ZhouMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Does my last reply address your concern? If you need any future help, just let me know!



    Have a nice day!

     

     

    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Tuesday, November 10, 2009 2:25 AMEagle Tsui Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank your first.  I have write code to handle it.
    Eagle