Can't get c++ interop to work from an unmanaged c++ project and trying to access .net 4.5

  • Thread starter Thread starter Todd_bluecoat
  • Start date Start date
T

Todd_bluecoat

Guest
It seems a c++ unmanaged project cannot reference the 4.5 assemblies. For some reason its defaulted to 4.0 and cannot be changed. A c++ managed project defaults to the 4.5 assemblies. Is there a way to fix this?
Saturday, August 03, 2013 12:03 AM
Reply
|
Quote
|
Todd_bluecoat
0 Points
All replies

  • a6302c6ae83762beaa2177cdf3e62d0f.gif


    1

    Vote

    If youre using VS 2012, you can change the target framework of the project by hand editing the file. For details, see: http://stackoverflow.com/a/2921868/65358

    Once you target framework 4.5, you can reference 4.5 assemblies.

    Note that VS 2012+ is required to target .NET 4.5, though.


    Reed Copsey, Jr. - http://reedcopsey.com - If a post answers your question, please click Mark As Answer on that post. If you find a post helpful, please click Vote as Helpful.

    Saturday, August 03, 2013 12:35 AM
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report as abuse
    a6302c6ae83762beaa2177cdf3e62d0f.gif

    Reed Copsey, Jr
    C Tech Development Corpo...
    (MCC, MVP)
    112,910 Points
    Moderator
  • a6302c6ae83762beaa2177cdf3e62d0f.gif

    a6302c6ae83762beaa2177cdf3e62d0f.gif

    0
    Thanks. I installed vs 2012 update 3 and made the manual changes. That lets me see and select the 4.5 assemblies in "Framework and References", but when I build the project I see this message; Project file contains ToolsVersion="4.5". This toolset is unknown or missing. You may be able to resolve this by installing the appropriate .NET Framework for this toolset. Treating the project as if it had ToolsVersion="4.0". I have version 4.5.50709 installed, Im pretty sure it got installed with vs 2012. I do also have vs 2010 installed in this machine, not sure if that matters. Any ideas?
    Monday, August 05, 2013 5:14 AM
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Edit
    |
    Delete
    |
    Todd_bluecoat
    0 Points
  • a6302c6ae83762beaa2177cdf3e62d0f.gif


    0

    Vote

    Thanks for Reed’s help.

    Hi Todd,

    If we change the target Framework, we would change the platform toolset to a version that supports that Framework. To target the .NET Framework 4.5, we would use a compatible platform toolset “Visual Studio 2012 (v110)”.

    [Broken External Image]:https://paktya.dm1.livefilestore.co...BhG2SGL4lPZKQ2jinnFHJ9U/Capture444.PNG?psid=1

    Reference:

    http://msdn.microsoft.com/en-us/library/vstudio/ff770576(v=vs.110).aspx

    Best regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 05, 2013 9:29 AM
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report as abuse
    a6302c6ae83762beaa2177cdf3e62d0f.gif

    Jack Zhai - MSFT
    Pactera
    (MCC, MSFT CSG)
    24,265 Points
    Moderator
  • a6302c6ae83762beaa2177cdf3e62d0f.gif


    1

    Vote

    Youll also need to set the platform to VS 2012, as Jack mentioned - With C++, the platform + the framework need to match, and for 4.5, you need both to be 2012s setup.


    Reed Copsey, Jr. - http://reedcopsey.com - If a post answers your question, please click Mark As Answer on that post. If you find a post helpful, please click Vote as Helpful.

    Monday, August 05, 2013 5:12 PM
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Report as abuse
    a6302c6ae83762beaa2177cdf3e62d0f.gif

    Reed Copsey, Jr
    C Tech Development Corpo...
    (MCC, MVP)
    112,910 Points
    Moderator
  • a6302c6ae83762beaa2177cdf3e62d0f.gif

    a6302c6ae83762beaa2177cdf3e62d0f.gif

    0

    The "Platform Toolset" has always been "Visual Studio 2012 (v110). I still get the error;

    Project file contains ToolsVersion="4.5". This toolset is unknown or missing. You may be able to resolve this by installing the appropriate .NET Framework for this toolset. Treating the project as if it had ToolsVersion="4.0".

    Whenever I build it. Im not sure its really building with 4.5 because I get the following error when I try to validate a SAML2 assertion signature;

    SignatureDescription could not be created for the signature algorithm supplied.

    The assertion was create by ADFS and the signature algorithm is SHA-256 which is not supported by .net 4.0. Searching around seems to indicate that message is what you get when .net 4.0 tries to validate a signature created with that algorithm.

    17 hours 38 minutes ago
    Reply
    |
    Quote
    |
    Mark as answer
    |
    Edit
    |
    Delete
    |
    Todd_bluecoat
    0 Points
  • a6302c6ae83762beaa2177cdf3e62d0f.gif


    0

    Vote

    Hi Todd,

    Glad to receive your reply.

    If possible, you could re-install .NET Framework 4.5, check it again.

    You could download it from here:

    http://www.microsoft.com/en-in/download/details.aspx?id=30653

    If still no help, I’m afraid that we would check whether it supports it in this specific VC++ project. You could post this issue to the VC++ development forum here:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vcgeneral

    If theres any concern, please feel free to let me know.

    Best regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • So then I guess c++ interop does not work with .net 4.5?


Continue reading...
 
Back
Top