Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Core, Standard ... what a mess

Core, Standard ... what a mess

Scheduled Pinned Locked Moved The Lounge
csharpquestionasp-netdotnetwinforms
25 Posts 16 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B BillWoodruff

    :thumbsup: thanks, Lloyd, you make more sense than Scott did ! Given I am trying to use a compiled Core project (dll) in a WinForms project, do you think it possible that some modification could be made to the Core project so that it somehow included the necessary run-time ? cheers, Bill

    «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

    M Offline
    M Offline
    Mike Marynowski
    wrote on last edited by
    #21

    Your WinForms project needs to be .NET Core to reference a .NET Core library. Referencing a .NET Core library from a .NET Framework project is not a supported scenario. It can go the other way though - a .NET Core project supports adding references to .NET Framework libraries, but keep in mind there may be a few APIs that aren't available in .NET Core. It's fairly rare that you'll run into this though. Just remember - .NET Core new and backwards compat, .NET Framework old. You can't add a reference to a new .NET Core project from an old .NET Framework project.

    Blog: [Code Index] By Mike Marynowski | Business: Singulink

    1 Reply Last reply
    0
    • B BillWoodruff

      :thumbsup: thanks, Lloyd, you make more sense than Scott did ! Given I am trying to use a compiled Core project (dll) in a WinForms project, do you think it possible that some modification could be made to the Core project so that it somehow included the necessary run-time ? cheers, Bill

      «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

      M Offline
      M Offline
      Mike Marynowski
      wrote on last edited by
      #22

      Your WinForms project needs to be .NET Core to reference a .NET Core library. Referencing a .NET Core library from a .NET Framework project is not a supported scenario. It can go the other way though - a .NET Core project supports adding references to .NET Framework libraries, but keep in mind there may be a few APIs that aren't available in .NET Core. It's fairly rare that you'll run into this though. Just remember - .NET Core new and backwards compat, .NET Framework old. You can't add a reference to a new .NET Core library from an old .NET Framework project. That would be like trying to add a reference to a .NET 4.7 library from a .NET 2.0 project...wouldn't work.

      Blog: [Code Index] By Mike Marynowski | Business: Singulink

      1 Reply Last reply
      0
      • B BillWoodruff

        Recently a demon made me create a Core project, and then attempt to use it in a WinForms app. And, yes, I altered the project files of both to enable C# 8. The Core project does nothing but define a stupid little Class with one method that writes to the Console.. So, okay, I add a reference to the Core project dll to the WinForm app. I attempt to use it ... well, I m not surprised it didn't work, but was surprised to get a file-not-found error:

        Quote:

        System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Source=TestUsingCore StackTrace: at TestUsingCore.Form1.Form1_Load(Object sender, EventArgs e) in ...

        So, I set out to do some research, came across this article by Scott Hanselmann: [^]. I have great respect for Scott, and have learned a lot from his writing over the years; however, this article, titled "How to reference a .NET Core library in WinForms - Or, .NET Standard Explained," ignores the question in the title and ends up recommending ".NET Standard" as if that explains anything. Was Scott avoiding the simple answer that you cannot use a Core project/class in a WinForm app for some reason ? Well, okay, Scott wrote that in June, 2017: that's decades ago in .NET's evolutionary time-scale. To turn my headache into a full-on migraine, I then re-read this article: "How to port desktop applications to .NET Core 3.0" [^]. Whaddya think ?

        «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

        J Offline
        J Offline
        josued8a
        wrote on last edited by
        #23

        Nice to know! I am developing a new class library on .Net Core that will be called from a .NET Standard. I should stop doing this and use a regular .NET Standard Class library.

        just do what you need to do.. worry about the consequences later...

        1 Reply Last reply
        0
        • B BillWoodruff

          :thumbsup: thanks, Lloyd, you make more sense than Scott did ! Given I am trying to use a compiled Core project (dll) in a WinForms project, do you think it possible that some modification could be made to the Core project so that it somehow included the necessary run-time ? cheers, Bill

          «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #24

          As for WinForm control library... Damn... you could do that with PCL, compile for multiple targets! But you can't. Anyway as the other poster suggested, it seems like you can make a .NET Framework control library and use it in your .NET Core app! :)

          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

          1 Reply Last reply
          0
          • R Reelix

            > Instead, you should use .NET Standard, the common denominator between the two. Since when do Linux and Mac natively support .NET Standard, and since when do all Servers inherently have it installed? It's almost as if people have specific use-case scenarios for requiring .NET Core...

            -= Reelix =-

            Sander RosselS Offline
            Sander RosselS Offline
            Sander Rossel
            wrote on last edited by
            #25

            .NET Standard isn't a runtime, so it's not installed on any machine. .NET Core applications can be deployed as stand-alone applications that come bundled with the runtime though. And I guess the .NET Core runtime can be installed on Mac or Linux directly as well, as you can on Windows. I've never targeted Mac or Linux, but that's what I understand. And in any case, you should use .NET Standard if you want to use a library in .NET Framework (and run it on Windows) or in .NET Core (and want to use it cross-platform) or Mono or Xamarin.

            Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups