Reference .NETCoreApp NuGet from NET47 WPF App - wpf

Is it possible to reference a .NETCoreApp 2.0 built NuGet package within a WPF App on Framework 4.7
I have built my own NuGet but fails to add the package:
Could not install package 'My.Common 1.0.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
The package dependencies:
Do we have to wait until NETStandard 2.0? It's fine I can cross compile using;
<TargetFrameworks>netstandard1.6;netcoreapp2.0</TargetFrameworks>
Although I'd rather target less frameworks!

No, netcoreapp is always framework that is incompatible to net. .NET Core can (and does) implement APIs that aren't available on .NET Framework.
With "current" (.NET CLI < 2.0, VS 2017 < 15.3) tooling, the highest version of .NET Standard that .NET 4.7 can use is netstandard15 (which can be used on .NET Framework 4.6.2).
Even when .NET Standard 2.0 (tooling) is released, .NET Framework projects cannot reference .NET Core libraries. Only higher .NET Standard versions.

Related

How to bundle windows visual studio VSIX with other built application?

I found that the windows visual studio extension is targeted to .net framework and only .net framework (which seems not clearly described in the docs?), after switching our custom mono debugger extension to .net 7.0, with framework not compatible (between vsix project's .net framework 4.8 and debugger project's .net 7.0) error when building the vsix project.
If I switch the debugger project target back to .net framework 4.8 then I can build the extension along with the debugger and create a vsix bundle them togeter successfully.
I tried the previewing visual studio extensibility tools: the out-of-process solution, but the out-of-process way seems not have access to the dte object, thus no way to send the debug adapter launch command. If I use the in-process solution, then we head back to the .net framework target :(
The mono debugger extension is a "3rd party executable file" that launched by visual studio debug adapter. If I manually paste the .net 7.0 version mono debugger to the extension install location, the extension can still work with the debugger. I manage the debugger project and the vsix project within a solution is for easier project management only, in fact they are not referenced directly in code.
I switched our mono debugger project to .net 7.0 is for trying to upgrade our toolset to the newest unified framework (every other tool in our team are upgraded to .net 7.0).
TL;DR, how can we bundle a none .net framework targeted project along with a windows visual studio extension, which is targeted to .net framework only? Or how can we integrate/bundle/add built exe,dlls into the vsix container?
There are some solutions from other stackoverflow answers such as add dlls using vsixmanifest, but it can only add dll file, and the way it handle asset file seems not quite right, it just copy the dll to vsix project folder once, meaning it won't get updated when the dll's project rebuild.
Here I managed to bundle the files in a wonky way:
I create a publish folder under vsix project folder,
then copy the published debugger project file to it, add them as existing file to vsix project, and configure them as vsix content, copy to vsix,
then add a pre-build event for the vsix project, publishing our debugger project and output to this publish folder.
With process above, I can package the published file into vsix when trigger vsix project build.
For anyone have similar issue, you can have a try.

How to access UWP devices from C# Winforms App in .Net 5

I downloaded some great code from https://learn.microsoft.com/en-us/samples/microsoft/windows-universal-samples/barcodescanner/ which accesses my barcode scanner really well . I would like to use this functionality from within a Winforms app but I can't seem to load the right library. If I just add the nuget package I get the following error:
Error NU1202 Package System.Numerics.Vectors.WindowsRuntime 4.0.1 is not compatible with net5.0-windows7.0 (.NETCoreApp,Version=v5.0).
Package System.Numerics.Vectors.WindowsRuntime 4.0.1 supports: uap10.0 (UAP,Version=v10.0)
Any thoughts/help is appreciated.

Quickstart sample code - NuGet dependencies are broken

I am new to IndentityServer and am trying to following the document to setup the Quickstart VS.Net solution on my Windows 10 desktop. After following instructions downloading and installing source code and opening up the solution in VS.Net 2017, I noticed that both NuGet dependencies - IdentityServer4 (4.0.0) and Serilog.AspNetCore (3.2.0) - are broken. Compiling the solution returns with an error: "NETSDK1045 The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.". I also tried installing NuGet packages for those 2 components but it made no difference.
Could someone show me what I am missing here?
Thanks in advance!
IdentityServer4 v4.00 requires.NET Core 3.1, and because of that you need to use the latest Visual Studio 2019 and install the latest 3.1 SDKs.

Npgsql Entity Framework Core and version 1.1.2 of Entity Framework Core

Newbie at C# and Visual studio so please be kind :)
At this site
http://www.npgsql.org/efcore/migration/1.1.html
it says that Version 1.1.0 of the Npgsql Entity Framework Core works with version 1.1.0 of Entity Framework Core.
But when I pick Npgsql Entity Framework Core in Microsoft Visual studio (handle nuget packages) it says that a dependency is
Microsoft.EntityFrameworkCore (>= 1.1.0)
So should it work with 1.1.2 of Entity Framework Core? I do not get it to work at all and I just would like to know if anybody here use it together with 1.1.2 or if it's just not meant to be?
Are you getting an error message?
If you are receiving the following when you attempt to install the Nuget package, you need to ensure you are using Visual Studio 2017 15.3.0 or newer and .net Core.
Error: Could not install package Npgsql.EntityFrameworkCore You are
trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', but the package does not contain any
assembly references or content files that are compatible with that
framework. For more information, contact the package author.
I have found that to use Entity Framework Core, you have to use .Net Core, which requires that you use Visual Studio 2017 15.3.0 or newer.

Error installing MahApps.Metro "trying to install this package into a project that targets '.NETFramework,Version=v3.5'"

I'm trying to install MahApps.Metro http://mahapps.com/MahApps.Metro/ on my Visual Basic .NetFramework 3.5 project, but i have an error
Could not install package 'MahApps.Metro 0.10.0.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I don't understand i already huild on .NetFramework 3.5 .. how can i solve this?
It seems this library requires .NET 4+. Upgrade to a higher .NET version (4.0 or 4.5) and it should work.

Resources