2016-12-14 157 views
0

在ASP.NET 1.0的核心是我使用:ASP.NET核心IISIntegration.Tools和.NET Framework

"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"

運行DOTNET發佈命令,但在ASP.NET 1.1的核心我開始得到以下錯誤:

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)

我怎樣才能仍然使用ASP.NET核心和常規.NET框架的「dotnet-publish-iis」?

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 
     } 
    } 
    } 
} 
+0

你能分享你的project.json嗎? – Sanket

回答

2

1)更新所有包1.1.0版本(和工具相應的預覽)

2)工具包應該安裝到的project.jsontools節,而不是dependencies

因此,請確保您已在工具部分添加IISIntegration.Toolsproject.json喜歡這 -

"tools": { 
    .... 
     "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final", 
    .... 

3)刪除舊project.lock.json並再次運行dotnet restore

4)現在你可以使用發佈 - dotnet publish

看看這會有所幫助。

+0

*包Microsoft.AspNetCore.Server.IISIntegration.Tools 1.1.0-preview4-final與net462不兼容(.NETFramework,Version = v4.6.2)。*我將添加我的project.json的副本... –

+0

@ J.Lennon從依賴關係中刪除'Microsoft.AspNetCore.Server.IISIntegration.Tools'。請參考我的第二點。 – Sanket