|
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.
|
|
|
|
|
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!
|
|
|
|
|
Was it this demon per chance?!
On a side note, Googling for "Thailand computer demon" brought me to this...
So pretty! I need some holidays now, haha
|
|
|
|
|
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.
|
|
|
|
|
It was a lot hairier than that
«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
|
|
|
|
|
OK, ok … where is the computer ? On the boat maybe …
|
|
|
|
|
I assume the WinForms project is .NET Framework (it could be .NET Core since last month).
.NET Framework and .NET Core are not fully compatible and while I believe it's possible to reference .NET Core projects in .NET Framework and vice versa it's not recommended.
Instead, you should use .NET Standard, the common denominator between the two.
You can simply add a new project in Visual Studio and pick the "Class Library (.NET Standard)" template.
This project will be usable in .NET Framework and .NET Core projects (but it can't run on its own since it has no runtime).
Be sure to write your .NET Standard project in the correct version: .NET Standard | Microsoft Docs[^]
|
|
|
|
|
> 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 =-
|
|
|
|
|
|
|
.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.
|
|
|
|
|
You can use a netstandard library, remembering:
Netstandard is just an API specification. The underlying framework to use could be full framework, core or mono. Which version of each depends on the netstandard version you're targeting, for instance, netstandard2.0 ~ net framework 4.6.2 / netcore 2.2 (iirc)
So a netstandard library won't provide the framework (just like other libraries won't) and relies on a shimming layer to get between the runtime you're providing (typically core or framework) and it's logic, and back again.
Just install the Nuget packed System.Runtime.
On the other hand, I've had some assembly binding woes with netstandard stuff, but that's b cause msbuild is being dumb and trying to upgrade dependencies (even ones that I've installed from nuget) to point at shined versions from machine-local netstandard, a problem which may not become evident until you have a significantly complex dependency chain, and simplified greatly if you can just update everything to latest (I can't, just yet)
YMMV
|
|
|
|
|
|
BillWoodruff wrote: Whaddya think ?
Why would you want to reference a Core project in a WinForm app?
Why would you want to port a desktop application to .NET Core?
If I wrote a blog about those two questions, they would be very short: "I wouldn't."
And while I have written .NET and .NET Core that work together, they work together over a communication protocol, like HTTPS!
|
|
|
|
|
Marc Clifton wrote: And while I have written .NET and .NET Core that work together, they work together over a communication protocol, like HTTPS! Same can be used for C# and C++ without having to marshal the hell out of parameters
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: Same can be used for C# and C++ without having to marshal the hell out of parameters
Exactly!
|
|
|
|
|
The latest version of Core supports WinForms. I don't understand why there's an issue. Of course, I don't understand why anyone would write Core apps to begin with, so there is that. (No, I don't concern myself with "cross platform" crap.)
IMHO, Core and Docker are solutions looking for a problem. Of course, I'm old and resist change in any disguise.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Just do it all with ASP.NET for the internet or WinForms for everything else. Those pretentious people who use Mac or Linux need to learn to use Windows (and get a haircut)!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
I think there's another article by Rick Strahl that might interest you: Multi-Targeting and Porting a .NET Library to .NET Core 2.0 - Rick Strahl's Web Log[^]
One of my (young and reckless) colleague's wrote a mixed application this way, including statements like:
#if NETCOREAPP2_1
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
#endif
#if NET47
using System.Configuration.Install;
using Castle.Core.Internal;
using System.Collections.Generic;
using Microsoft.AspNet.SignalR;
#endif
He didn't turn on "Show warnings as errors"
|
|
|
|
|
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...
|
|
|
|
|
@OriginalGriff
Hi Griff,
I'm writing this because I understand you are into 3-D printing.
I am just starting out with my first 3-D printer, and I've run into a snag.
What are you supposed to do when the filament breaks inside the print head?
On my printer everything is put together in a way that makes it look like you're not supposed to try to take it apart.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Bring the head up to temperature and try to load the filament as usual. Try pushing with the new piece of filament if the extruder can't push the rest of the old filament through. You should be ok once the extruder gets hold of the new piece of filament and starts to pull it in.
Richard Andrew x64 wrote: On my printer everything is put together in a way that makes it look like you're not supposed to try to take it apart. Forget that. Try to get hold of any maintainance instructions that you can get your hands on. Sooner or later you will have to clean the nozzle or tighten a belt. I just wasted another weekend to take my printer's head apart completely to clean out the mess some bad filament has left behind.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Thanks Mr. Wraith.
The filament that came with the printer worked fine at 210 degrees C. Then it broke and I'm now trying to use ABS.
I've had the head up to 280 degrees and the extruder wheels just don't have the force necessary to push it through the tiny hole.
This is frustrating.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
210 degrees? That sounds like PLA. And then you tried to load ABS? You may have baked the remaining PLA with the higher temperature you need for that. If that's the case, you may also have to clean out or replace the nozzle, possibly even take the head apart to clean it out. The problem is that rven the strongest extruder will not get anything through that tiny hole once the nozzle is clogged up. Believe me, any solvent that could remove PLA is nothing you would want to have in your house.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Baked? You mean the higher temp for ABS can cause PLA to harden even more than it normally is?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|