In the ASP.NET Core 1.0 I was using:
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
To run dotnet publish commands, but in the ASP.NET Core 1.1 I'm starting to get the following error:
Package Microsoft.AspNetCore.Server.IISIntegration.Tools 1.1.0-preview4-final is not compatible with net462 (.NETFramework,Version=v4.6.2). Package Microsoft.AspNetCore.Server.IISIntegration.Tools 1.1.0-preview4-final supports: netcoreapp1.0 (.NETCoreApp,Version=v1.0)
How can I still use "dotnet-publish-iis" with ASP.NET Core and regular .NET frameworks?
project.json:
{
"dependencies": {
"Dapper": "1.50.2",
"log4net": "2.0.5",
"Microsoft.AspNetCore.Authorization": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Caching.Abstractions": "1.1.0",
"Microsoft.Extensions.Caching.Memory": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
},
"frameworks": {
"net462": {}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"appsettings.json",
"log4net.xml",
]
},
"scripts": {
"prepublish": [ ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"configurations": {
"Debug": {
"buildOptions": {
"define": [
"DEBUG",
"TRACE"
]
}
},
"Integration": {
"buildOptions": {
"define": [
"DEBUG",
"TRACE"
]
}
},
"Production": {
"buildOptions": {
"define": [ "RELEASE", "TRACE" ],
"optimize": true
}
}
}
}
1) Update all packages to version 1.1.0 (and the corresponding previews for tools)
2) Tools packages should be installed into the
toolssection ofproject.json, notdependencies.Hence, make sure you have added
IISIntegration.Toolsunder tools section ofproject.jsonlike this-3) Remove old
project.lock.jsonand rundotnet restoreagain.4) Now you can publish using -
dotnet publishSee if this helps.