【问题标题】:.net core azure deployment failing: Project file does not exist.net core azure 部署失败:项目文件不存在
【发布时间】:2017-03-31 17:54:41
【问题描述】:

我在 Azure 中设置了一个应用服务应用,该应用设置为在提交到团队服务 git 存储库时进行部署。到目前为止,这一直运行良好,但部署失败:

MSBUILD : error MSB1009: Project file does not exist.

但是,如果我打开 azure 控制台和 CD 到我的项目目录,我可以看到项目文件(一个 asp.net 核心 .xproj)确实存在。我从部署日志的输出中知道它位于正确的目录中,表明正在恢复包:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\IDPTest\src\IDPTest\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\home\site\repository\IDPTest\src\IDPTest\project.json...
Committing restore...
Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\IDPTest\src\IDPTest\project.lock.json
D:\home\site\repository\IDPTest\src\IDPTest\project.json
Restore completed in 10549ms.
Restoring packages for D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'BundlerMinifier.Core' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Committing restore...
Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.lock.json
D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json
Restore completed in 7119ms.

NuGet Config files used:
    C:\DWASFiles\Sites\#1IDPTest\AppData\NuGet\NuGet.Config

Feeds used:
    https://api.nuget.org/v3/index.json
Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist.
Switch: D:\home\site\repository\IDPTest\src\IDPTest.MVCClient
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\IDPTest\src\IDPTest.MVCClient" --output "D:\local\Temp\8d40eb8007743fd" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51109.2534\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd

"

有趣的是,我有两个应用服务应用指向同一个解决方案中的不同项目。突然之间,即使他们正在部署不同的项目,他们也都失败并显示相同的错误消息......

非常感谢任何帮助。

谢谢

编辑

我的解决方案根目录中已经有一个 global.json(与我的 .sln 文件处于同一级别),但它指向的是旧版本的 SDK,所以我更新了它,它没有任何区别。然后我尝试摆脱 json 文件中的“测试”项目,这也没有任何区别。仍然失败并出现同样的错误

【问题讨论】:

  • 您是否在公共场所提交了罚单?我也刚刚经历过。
  • @ThomasArdal 不,不确定他们需要在哪里归档。好在某种程度上不只是我。几分钟前尝试重新部署。同样的问题
  • 添加 global.json 文件对我有用。
  • @LDJ 你需要把解决方案中的那个去掉,放到仓库的根目录下,让SDK的版本和你项目中使用的版本兼容。 Azure 已将其版本更新为 preview3,我认为您使用的是 preview2——就像我们其他人一样。

标签: azure asp.net-core .net-core azure-web-app-service


【解决方案1】:

显然您需要在 global.json 中明确指定 SDK 版本,否则 Kudu 使用的是最新版本,现在是 preview3 版本,不兼容。

{
"projects": [ "src", "test" ],
"sdk": {
    "version": "1.0.0-preview2-1-003177"
    }
}

请注意,您的 global.json 文件应该位于存储库的根目录中。

详情:https://social.msdn.microsoft.com/Forums/en-US/2a301f82-6a7a-4c03-ad4a-bd8714d72ba6/continious-deployment-of-aspnet-core-app-suddenly-starts-to-fail-today?forum=windowsazurewebsitespreview&prof=required

【讨论】:

  • 这对我没有帮助。我的存储库根目录中已经有一个 global.json 文件,因此我将其更新为最新的 SDK 版本,但我仍然遇到相同的部署错误
  • @LDJ 如果您有一个无法使用 global.json 的 repro,请查看github.com/projectkudu/kudu/issues/2230,并根据需要添加。
  • @LDJ 我今天遇到了同样的问题,这似乎只是 Azure 上的一个错误,在这里报告:github.com/dotnet/cli/issues/4804 尝试在没有路径的情况下进行 dotnet 构建,但在运行之前位于正确的目录中命令。
  • 对于所有像我一样来这里进行修复的人,如果您不知道哪个版本,请从命令提示符运行dotnet --version,然后将 SDK 版本替换为控制台输出
  • 谢谢!上面 global.json 的文字复制/粘贴对我有帮助!
猜你喜欢
  • 2022-07-04
  • 2019-06-27
  • 2015-12-11
  • 2016-09-28
  • 2014-06-17
  • 1970-01-01
  • 2016-05-27
  • 2019-03-10
  • 1970-01-01
相关资源
最近更新 更多