none
.Netcore vs .NETFramework

    Question

  • Is it possible to reference an assembly built with .NET 4.0 to a Metro project?  I tried it and received the following error message:

    A reference to '...' could not be added. The project targets '.NETCore' while the file reference targets '.NETFramework'. This is not a supported scenario.

    Saturday, March 03, 2012 10:30 PM

Answers

  • A Metro style app must use references to another .NETCore or Portable Library binary only...it can not reference a full .NET 4.0 library because the Metro profile is not that large (and would fail store certification).


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    • Marked as answer by Frank Calahan Sunday, March 04, 2012 4:35 AM
    Saturday, March 03, 2012 11:37 PM

All replies

  • A Metro style app must use references to another .NETCore or Portable Library binary only...it can not reference a full .NET 4.0 library because the Metro profile is not that large (and would fail store certification).


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    • Marked as answer by Frank Calahan Sunday, March 04, 2012 4:35 AM
    Saturday, March 03, 2012 11:37 PM
  • Can you give us more details on how to create a ".NETCore" or "Portable Library binary"?

    I have existing .NET Class Library dlls that are built using C++/CLI and target .NETFramework 4.0.  I need to use those in a Metro application.  What do I need to do in order to re-compile them so that they can be used?

    Wednesday, March 07, 2012 5:46 PM
  • @xcRacer - Portable Libraries are available in the Beta for VS Ultimate (not in the express version).  C++/CLI is not supported in Metro.


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Wednesday, March 07, 2012 7:53 PM
  • Where can I find an example project for creating a .NETCore dll that actually works in a Metro application?
    Wednesday, March 07, 2012 8:41 PM
  • @xcRacer - the ".NETCOre" library is the Class Library project under the Metro style apps category in Visual Studio

    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Wednesday, March 07, 2012 11:02 PM
  • I think I figured it out myself.

    If you create a new Visual C++, Windows Metro Style, WinRT Component DLL in Visual Studio 11 BETA, and then try to add a reference to the output .dll in a Visual C#, Windows Metro Style, Blank Application you will get an error:

    "A reference to '<path>\WinRTComponentDll\WinRTComponentDll.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

    However, if you add reference to the .winmd file which is in the same folder as the .dll, then it works.

    • Proposed as answer by BullyOwner Wednesday, March 07, 2012 11:35 PM
    Wednesday, March 07, 2012 11:35 PM
  • i don't understand the .winmd ? can you explain to me?
    Tuesday, July 31, 2012 8:22 AM
  • When you build a C++/WinRT component using VS 2012, it will generate a .DLL and a .WINMD file.

    In your consuming application, you must AddReference to the .WINMD file, not the .DLL file.

    Tuesday, July 31, 2012 8:44 AM
  • I'm getting the same issue with Json.Net

    I've tried the Portable version but still get errors.

    Has anyone successfully referenced Json.Net in to a Store App?

    Cheers,

    Roy

    Thursday, January 10, 2013 2:19 PM
  • Many people are successfully using JSON.NET in Store apps.

    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Thursday, January 10, 2013 4:21 PM
  • Do you know how this can be done in C#?
    Tuesday, February 05, 2013 12:15 PM
  • @Zyberb - how what can be done in C#?

    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Wednesday, February 06, 2013 2:55 AM
  • Over to stackoverflow then...

    Thursday, January 09, 2014 4:25 AM