由于缺少程序集引用,Azure部署失败

时间:2017-05-05 07:05:49

标签: c# azure azureservicebus azure-deployment

所以我有一个简单的C#Web API项目,我试图将其部署到Azure中。该项目在本地构建和运行良好(不是它们总是?!?)但在Azure中由于缺少使用的Microsoft.ServiceBus程序集而失败。

项目结构非常简单:

\
--\Common
----MyProj.common.dll << This uses Microsoft.ServiceBus and has its own packages.config with WindowsAzure.ServiceBus referenced
--\Web
----MyProj.Api << This has an assembly reference to MyProj.common.dll. It doesn't have a reference to WindowsAzure.ServiceBus itself (although I added one to see if it helped, but it didn't)

Azure部署脚本的输出如下:

 Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restoring packages for D:\home\site\repository\MyProj\Web\MyProj.Api\MyProj.Api.csproj...
  Installing WindowsAzure.ServiceBus 4.0.0.
  Writing lock file to disk. Path: D:\home\site\repository\MyProj\Web\MyProj.Api\obj\project.assets.json
  Restore completed in 12.73 sec for D:\home\site\repository\MyProj\Web\MyProj.Api\MyProj.Api.csproj.

  NuGet Config files used:
      D:\local\AppData\NuGet\NuGet.Config

  Feeds used:
      https://api.nuget.org/v3/index.json

  Installed:
      1 package(s) to D:\home\site\repository\MyProj\Web\MyProj.Api\MyProj.Api.csproj
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

D:\Program Files (x86)\dotnet\sdk\1.0.1\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.ServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\home\site\repository\MyProj\MyProj.Shared\MyProj.Common.csproj]
Azure\AQM.cs(7,17): error CS0234: The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\MyProj\MyProj.Shared\MyProj.Common.csproj]

Azure\AQM.cs(8,17): error CS0234: The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\MyProj\MyProj.Shared\MyProj.Common.csproj]
Azure\AQM.cs(14,17): error CS0246: The type or namespace name 'NamespaceManager' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\MyProj\MyProj.Shared\MyProj.Common.csproj]
D:\Program Files (x86)\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'D:\home\site\repository\MyProj\MyProj.Shared\MyProj.Common.csproj'. This can indicate a missing project reference. [D:\home\site\repository\MyProj\Web\MyProj.Api\MyProj.Api.csproj]
Failed exitCode=1, command=dotnet publish "MyProj\Web\MyProj.Api\MyProj.Api.csproj" --output "D:\local\Temp\8d493823074840c" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\62.60430.2807\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

我注意到它没有尝试恢复Common程序集的包 - 我如何告诉&#39; Azure这样做?这甚至是问题吗?

修改1

使用Kudu查看部署脚本,它似乎正在进行解决方案范围的恢复,因此不确定如何/为什么缺少程序集引用:

:: 1. Restore nuget packages
call :ExecuteCmd dotnet restore "MyProj\MyProj.sln"
IF !ERRORLEVEL! NEQ 0 goto error

由于

0 个答案:

没有答案
相关问题