Reputation: 4124
I'm wonderinf if it possible to deploy my asp.net core application if I also use some library from .NET 4.5.2.
To describe my problem, in my app I use SyndicationFeed which comes from full .NET and in my project.json in "framework" section I have:
"frameworks": {
"net452": {
"frameworkAssemblies": {
"System.ServiceModel": ""
},
"dependencies": {
}
},
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
}
In the other sections I use ASP.CORE packages like:
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Hangfire.AspNetCore": "1.6.8",
and more.
So the question is is it possible to deploy to the IIS. Should I deploy to server with run with ASP.CORE or full .NET.
Upvotes: 1
Views: 105
Reputation: 16795
In short: yes, it's possible. But full .NET Framework required (on server).
Long story:
Having two frameworks
in projects.json
effectively creates two different apps (one for net462
, other for netcoreapp1.1
) during compilation/publishing. This is two different applications, compiled for different frameworks from same source code.
To run first (for net462) you need machine with .NET Framework installed. For other (for netcoreapp) you need .NET Core installed. You can't "swap" (run net462
-build app on .NET Core
and vice versa).
But looking at your project.json
I can't believe your app compiles successfully. You need System.ServiceModel
for your app to work. But it's available only for net462. This means that during compilation first app (for net462) compiles successfully, while second (net netcoreapp) should fail (class not found, namespace not found, etc).
Run dotnet build
or dotnet publish
from command line in project/solution folder. See any errors?
So, you can't create/build/run under .NET Core
while you need packages/classes not available for .NET Core.
Possible solutions:
netcoreapp1.1
;#if
) where you use this package, so you will use if only in net462
-version of your app. Otherwise (#else
) add NotImplementedException, null result or something other (it depends) - effectively you will have two different apps after compilation: full-functional for net462
and restricted-functional for netcoreapp
.Upvotes: 1