Locked Setting the targeted framework

  • Tuesday, July 14, 2009 7:44 PM
     
     
    In my C++/CLI projects, the "Targeted Framework" is always 4.0, and always grayed out.   The only way I found to change it was to notepad the .vcxproj file.

    Is this a beta limitation/bug, another removed feature, or am I missing something obvious?

All Replies

  • Monday, August 03, 2009 6:41 AM
    Moderator
     
     

    Hi Frank,

    Even if Managed Multi-targeting for C++/CLI is supported by the build system for any of the targetable .NET Framework versions installed on your machine, the C++ Project System will not support Retargeting (retargeting is the operation of changing the .NET framework while the project is loaded in the IDE). While we’re always shooting for a great design-time experience for both native and managed platforms, our emphasis is on native development. Cutting retargeting is not a decision we took lightly but something that came out of our prioritization efforts to deliver a solid release.

    As you mention as well, currently the only way to retarget your project is to manually edit the project file either by using an external editor or inside VS (1) right click on project, unload the project, (2) right click, edit the project file in the editor (3) add the <TargetFrameworkVersion>vCLR</TargetFrameworkVersion> (where vCLR = v2.0, v3.0, v3.5 or v4.0), (4) reload the project. Also, new in VS2010, C++ allows targeting of .NET Framework profiles: for example you can add <TargetFrameworkProfile>Client</TargetFrameworkProfile> to your project in order to target only the Client profile for .NET 4.0.

    Note that in order to target CLR 2 (.NET v2.0 up to v3.5) you will also need to install VS 2008 side-by-side to your VS 2010 installation in order for the C++ build system to pick up the right toolset (compilers and libraries).

    Hope this helps,
    Thank you for beta testing VS2010!
    Marian

  • Wednesday, April 28, 2010 11:58 AM
     
     

    Hi Frank,

    Even if Managed Multi-targeting for C++/CLI is supported by the build system for any of the targetable .NET Framework versions installed on your machine, the C++ Project System will not support Retargeting (retargeting is the operation of changing the .NET framework while the project is loaded in the IDE). While we’re always shooting for a great design-time experience for both native and managed platforms, our emphasis is on native development. Cutting retargeting is not a decision we took lightly but something that came out of our prioritization efforts to deliver a solid release.

    As you mention as well, currently the only way to retarget your project is to manually edit the project file either by using an external editor or inside VS (1) right click on project, unload the project, (2) right click, edit the project file in the editor (3) add the <TargetFrameworkVersion>vCLR</TargetFrameworkVersion> (where vCLR = v2.0, v3.0, v3.5 or v4.0), (4) reload the project. Also, new in VS2010, C++ allows targeting of .NET Framework profiles: for example you can add <TargetFrameworkProfile>Client</TargetFrameworkProfile> to your project in order to target only the Client profile for .NET 4.0.

    Note that in order to target CLR 2 (.NET v2.0 up to v3.5) you will also need to install VS 2008 side-by-side to your VS 2010 installation in order for the C++ build system to pick up the right toolset (compilers and libraries).

    Hope this helps,
    Thank you for beta testing VS2010!
    Marian


    Since having loaded the RTM this flaw is still present.  Also I've been reading horror stories with side-by-side installs with both 2010 and 2008 IDE's.  Please confirm.

    More important.  What if someone has bought VS2010 and never had VS2008 but has to upgrade someones source that was built using VS2008?  There's never been a case that I am aware of where a project couldn't be upgraded without the need of having a previous version residing on a development machine.

     

  • Wednesday, April 28, 2010 4:44 PM
     
     

    Hi You can upgrade to VS2010 on the machine. For C++ application, the default target framework for VS2010 is 4.0. The only limitation is that if you want to target framework v2.0, 3.0 and 3.5, you will need to have VS2008 installed on the machine. You can take a look of this blog about some of the underlying details of this requirement: http://blogs.msdn.com/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

    The reason behind this design is that the VS2010 compiler cannot target Framework 2.0, 3.0 or 3.5. The VS2008 compiler must be used to target 2.0, 3.0 or 3.5.

    Li Shao, MSFT

     

     

     


    Li Shao
  • Wednesday, April 28, 2010 5:30 PM
     
     

    Hi You can upgrade to VS2010 on the machine. For C++ application, the default target framework for VS2010 is 4.0. The only limitation is that if you want to target framework v2.0, 3.0 and 3.5, you will need to have VS2008 installed on the machine. You can take a look of this blog about some of the underlying details of this requirement: http://blogs.msdn.com/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

    The reason behind this design is that the VS2010 compiler cannot target Framework 2.0, 3.0 or 3.5. The VS2008 compiler must be used to target 2.0, 3.0 or 3.5.

    Li Shao, MSFT

     

     

     


    Li Shao

    Can you address if VS2008 and VS2010 can exist side-by-side?
  • Wednesday, April 28, 2010 8:33 PM
     
     

    Yes, VS2008 and VS2010 can exist side-by-side.

    Li Shao, MSFT


    Li Shao
  • Thursday, April 29, 2010 8:34 PM
     
     

    Hi You can upgrade to VS2010 on the machine. For C++ application, the default target framework for VS2010 is 4.0. The only limitation is that if you want to target framework v2.0, 3.0 and 3.5, you will need to have VS2008 installed on the machine. You can take a look of this blog about some of the underlying details of this requirement: http://blogs.msdn.com/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

    The reason behind this design is that the VS2010 compiler cannot target Framework 2.0, 3.0 or 3.5. The VS2008 compiler must be used to target 2.0, 3.0 or 3.5.

    Li Shao, MSFT

     

     

     


    Li Shao

    It was proposed in another thread that as a minimum the express SKU of VS2008 be installed.  This does not work!
  • Thursday, April 29, 2010 10:18 PM
     
     

    What is the error message?

    Li Shao, MSFT


    Li Shao
  • Friday, April 30, 2010 12:11 PM
     
     

    What is the error message?

    Li Shao, MSFT


    Li Shao

    Missing header files were reported.  It seems that a WinSDK has to be installed as well.  The missing header files are afxres.h, winres.h.  My project does NOT target MFC, only standard Windows libraries.  I had a resource assigned to the project which had version information fields.  That created a resource.h which then included the header files that are being reported as missing when installing VS2010 on a clean machine and then installing VC express afterward.
  • Friday, April 30, 2010 4:53 PM
     
     

    You are right, VCExpress SKU does not ship with ATL/MFC. You also need to install WinSDK for windows headers. For VS2008 express SKU, you can install (Windows SDK for Windows 7 and .NET Framework 3.5Sp1: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en ).

    Li Shao, MSFT


    Li Shao
  • Friday, April 30, 2010 5:23 PM
     
     

    You are right, VCExpress SKU does not ship with ATL/MFC. You also need to install WinSDK for windows headers. For VS2008 express SKU, you can install (Windows SDK for Windows 7 and .NET Framework 3.5Sp1: http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en ).

    Li Shao, MSFT


    Li Shao


    OK.

    To summarize then.  In my situation, where I started out with a clean install of VS2010 on a clean XPSP3, I need either VS2008 installed afterward or - as a minimum -  VS2008 express SKU with Windows SDK for Windows 7 and .NET Framwork 3.5 SP1.

     

    This configuration will allow us to load projects using VS2010 that were built on VS2008 which targeted .NET Framework 2.0.  We will then be able to support those projects using the VS2010 IDE and continue to target .NET 2.0

     

    Please indicate if that is all correct.

     

    Thanks

  • Saturday, May 01, 2010 5:31 AM
     
     

    Yes, that is correct. For VC Express SKU + WinSDK, however, there will be no ATL/MFC support.

    Li Shao, MSFT


    Li Shao
  • Tuesday, May 04, 2010 11:55 AM
     
     

    Yes, that is correct. For VC Express SKU + WinSDK, however, there will be no ATL/MFC support.

    Li Shao, MSFT


    Li Shao
    My projects do NOT target ATL/MFC.  There are those headers that are referenced however when version info is added to a resource that is added to the project.  How do I overcome that problem requirement?
  • Tuesday, May 04, 2010 4:04 PM
     
     

    I don't know of a better workaround other than having full VS2008 SKU. Is there anything preventing you from upgrade and targeting 4.0, in which case, you will not need VS2008.

    Li Shao, MSFT


    Li Shao
  • Tuesday, May 04, 2010 5:42 PM
     
     

    I don't know of a better workaround other than having full VS2008 SKU. Is there anything preventing you from upgrade and targeting 4.0, in which case, you will not need VS2008.

    Li Shao, MSFT


    Li Shao

    No, there's nothing preventing a full install of the full VS2008 SKU.  I was just trying to minimize tools from having an IDE that may not be in use anymore.  The express SKU I though would have been a way to accomplish that.

    I will have to load the full SKU if I don't want anymore issues.

     

    Can the VS2008 be loaded after the VS2010?  Are there any problems doing it that way?

  • Wednesday, May 05, 2010 2:50 AM
     
     Proposed

    As far as I know, VS2008 and VS2010 can function sidebyside without any problem. VS2008 can be loaded if  installed before or after VS2010.

    Li Shao, MSFT


    Li Shao
    • Proposed As Answer by alleyes Thursday, May 06, 2010 2:07 PM
    •  
  • Tuesday, June 01, 2010 8:20 PM
     
     
    I personally find this unaceptable...  It seems now I must have VS 2005/8/10 installed to work on any projects.  This is getting annoying to say the very least.
    John J. Hughes
    www.functioninternational.com/
  • Tuesday, June 01, 2010 11:30 PM
     
     

    Hi John, if you need to stay with framework 3.5, yes, you need to have VS2008 installed. If you can migrate to framework 4.0, you don't need to have VS2008 installed. Just want to make sure this is clear to you.

    Li Shao,MSFT


    Li Shao
  • Wednesday, June 02, 2010 12:34 PM
     
     

    Li Shao,

    Yes I am clear on that.... ;(

    Until application testing is complete the application can't be converted to 4.0 of course so I need to continue to support the 3.5.  And of course I will have some system that need patching that use the 3.5 so I will need to be able to update them.  Hopefully next year I will have most everything on the 4.0 version but like when I moved from vs2005 to vs2008 I had hoped to remove vs2005 from the system but of couse SQL reports among other things does not allow it so I now have three very large application on my system with their add-ins.  Just like .NET sounded like a good idea from the one install prospect but now I have 1.1, 2.0, 3.x, & 4.0 installed. 

    Mostly I just don't understand why C# and friends can compile as 3.5 but C++ can't (yes I undertand the compiler does not support but don't consider that a valid reason).

    Anyways, just my two cents...


    John J. Hughes
    www.functioninternational.com/
  • Tuesday, June 29, 2010 8:59 PM
     
     

    Yes, that is correct. For VC Express SKU + WinSDK, however, there will be no ATL/MFC support.

    Li Shao, MSFT


    Li Shao
    My projects do NOT target ATL/MFC.  There are those headers that are referenced however when version info is added to a resource that is added to the project.  How do I overcome that problem requirement?

    if its just the headers, try to include windows.h instead of afxres.h and winres.h.
  • Friday, August 20, 2010 1:05 AM
     
     

    Hi You can upgrade to VS2010 on the machine. For C++ application, the default target framework for VS2010 is 4.0. The only limitation is that if you want to target framework v2.0, 3.0 and 3.5, you will need to have VS2008 installed on the machine. You can take a look of this blog about some of the underlying details of this requirement: http://blogs.msdn.com/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

    The reason behind this design is that the VS2010 compiler cannot target Framework 2.0, 3.0 or 3.5. The VS2008 compiler must be used to target 2.0, 3.0 or 3.5.

    Li Shao, MSFT

     

     

     


    Li Shao

    I have the issue which is similar to what you have faced, Did I miss something? Why it does not work here?