Asp.net-Mvc
發布 .NET Core 應用程序時出現錯誤“找不到路徑的一部分”
我有一個使用 Visual Studio 2015 Update 3 創建的非常簡單的 .NET Core Web 應用程序 (.NET Framework),它可以毫無錯誤地建構。
我可以使用 x64 配置文件在文件系統上發布。但是,當嘗試使用目標執行時“win7-x86”發佈時,會出現以下錯誤:
找不到路徑的一部分 ‘c:\Users\Developer\Documents\Visual Studio 2015\Projects\SelfHostTest\src\SelfHostTest\bin\Release\net452\win7-x86\SelfHostTest.exe’
我使用的是 Windows 8.1 x64 機器。我轉到“配置管理器”並將“平台”從“任何 CPU”更改為“x86”,但沒有工作。
我注意到有一個文件夾“src\SelfHost2\bin\Debug\net452\win7-x64”,但我沒有為 x86 創建結構。
此發布有效:
此發布不起作用:
這是我的 project.json 以幫助某人幫助我。
{ "dependencies": { "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" }, "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.Server.WebListener": "0.1.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" }, "tools": { "BundlerMinifier.Core": "2.0.238", "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "frameworks": { "net452": { "dependencies": { } } }, "buildOptions": { "emitEntryPoint": true, "preserveCompilationContext": true }, "runtimes": { "win7-x64": {}, "win7-x86": {} }, "publishOptions": { "include": [ "wwwroot", "Views", "Areas/**/Views", "appsettings.json", "web.config" ] }, "scripts": { "prepublish": [ "bower install", "dotnet bundle" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] }, "commands": { "http": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000" } }
這是工具中的一個錯誤。它將始終為預設 RID 建構(並且 AFAIK 無法更改它)但隨後在發布對話框中您會看到 project.json 中的所有 RID,如果您選擇非預設的一個發布將失敗,因為該項目不是為此 RID 建構的。嘗試使用您要發布的 RID 從命令行建構。這樣,當您發布 VS 將能夠找到二進製文件並發布應該可以工作。

