.Net Core 2.1 Console Application Referencing .Net Framework 4.6.1 DLL - Possible? - dll

Is it even possible for a .Net Core 2.1 console application to reference a .Net Framework 4.6.1 DLL?
I have such a DLL that consumes a WCF service successfully. I now wish to use this DLL from a .Net Core 2.1 console application. But I am getting an exception stating that it cannot load assembly System.ServiceModel. The web.config file in the 4.6.1 DLL has relevant settings for System.ServiceModel.
Many thanks.

Related

.net core website reference a .net 4.6 library wasn't found in the list of registered .NET Data Providers.'

I keep getting a error in my .net core app. My .net core app does not reference Entity Framework but a 4.6 dll that it references does.
The specified invariant name 'System.Data.SqlClient' wasn't found in
the list of registered .NET Data Providers.'
How do I add this data provider to the list in a .net core app ?

ASP.NET Core self-contained exe

I want my ASP.NET Core Web API to run as a self-contained exe within the .NET framework and not .NET Core Framework. Is that possible? Thanks!
EDIT:
If I add "net451": {} to my frameworks section in project.json,
I get the following exception:
Failed to make the following project runnable: myProject (.NETCoreApp,Version=v1.0) reason: Expected coreclr library not found in package graph. Please try running dotnet restore again.
You can't create a self-contained app which targets .NET Framework >=4.5, because the full .NET Framework isn't modular and its not possible to have more than one version of it installed. Newer versions basically always replace the previous one.
Self-contained apps were one main motivation for .NET Core (together with portability)
You ALWAYS have to install .NET >=4.5 before your app can run. self-contained apps only work with .NET Core because .NET core libraries can be pulled through nuget package.
For .NET 4.6 you can only create portable apps, which is the default mode.

.NET Core is not listed

I wanted to create a new ASP.NET Core app targeting the new .NET Core 1.0.
First, in Visual Studio 2015 Update 3, I don't see .NET Core listed
And this is what I'm seeing in project.json file. Looks like I'm targeing dotnet5.6
Is it safe to assume this is all correct?
And if this is correct, could it possibly be more confusing?
The pulldown has no meaning for .NET Core projects as it doesn't use it. Only what's in project.json matters for .NET Core / .xproj projects.
netcoreapp1.0 target framework moniker (short TFM) is .NET Core project for executables (ASP.NET Web Application or .NET Core Console Application). netstandard1.x (see this matrix for api surface of netstandard TFM) is for class libraries.
The import section just tells nuget to also restore packages which target dotnet5.6 (old TFM for .NET Core Library, which is now replaced with netstandard1.x) and portable-net45-win8, which are also compatible with .NET Core. These allow you to install packages which are compatible but are not yet repackaged for netstandard1.x.

Accessing the .Net 4.0 Com from .Net 1.1 Project [duplicate]

I have external .net library compiled with .net framework 4 (it's provider moved recently to .net 4)
My code currently runs on .net framework 3.5
How to use that external library in my application ?
Moving whole application to .net 4 needs time and testing, so maybe in a future i will do that, but now, what are the possibilities ?
There are no possibilities, the CLR version that comes with .NET 3.5 cannot load 4.0 assemblies. The metadata format was changed. You have to force your app to use the .NET 4.0 CLR version. Do so by recompiling it with VS2010, targeting 4.0, or by using a .config file that contains the <requestedRuntime> element to ask for "v4.0".
Compatibility for .NET 4.0 is excellent btw.
While you cannot load the .Net DLL directly, you can wrap it in a COM interface, and load that COM interface in your .Net 3.5 process.
See Using a .NET 4 Based DLL From a .NET 2 Based Application
For more background information, Microsoft originally added In-Process Side-by-Side in .Net 4 to better support the scenario where an application loads add-ins via COM, and the add-ins were written with various versions of .Net. The ability to load .Net 4 DLLs in a .Net 3.5 process is just a nice side effect of that.

ASP.NET MVC 4.0 RC and Newsoft.Json

I just installed the ASP.NET MVC 4.0 RC build on top of a Visual Studio 2010 SP1. My project that used to compile and work with the beta version of ASP.NET MVC 4.0, raises an error when I access the site saying that the Newtonsoft.Json assembly version 4.5 can not be found.
As I did not use this third party library in my current project, I configured Fusion Log to try to isolate the assembly that was relying on Newtonsoft.Json assembly.
And the guilty assembly is System.Net.Http.Formatting.dll which references Newtonsoft.Json version 4.5.
The beta build referenced System.Json.dll and not the Newtonsoft assembly.
I can hardly believe that Microsoft is starting to rely on external assemblies even if they publish more and more code in open source.
Does anyone have an explanation of what happened?
They are actually relying in third-party software (just like they ship MVC with JQuery and knockout.js). Scott Guthrie announced that MVC 4 will be shipped with JSON.NET (Newtonsoft). See below:
Json.NET: We plan to use the community developed Json.NET
serialization stack in our default JSON formatter in ASP.NET Web API.
Json.NET provides the flexibility and performance required for a
modern web framework.
http://aspnet.codeplex.com/wikipage?title=ASP.NET%20MVC%204%20RoadMap
You can keep the System.Json.dll btw, I've got them both. If you have any problems with JSON.NET, just reinstall it :)