我正在尝试将 Bitbucket 部署设置到 Azure 网站。我成功链接了 Bitbucket 和 Azure,但是当我推送到 Bitbucket 时,我在 Azure 站点上收到以下错误:
如果我单击“查看日志”,则会显示以下编译错误:
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Mvc, Version=4.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. [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "WebMatrix.WebData, Version=2.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. [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
CustomMembershipProvider.cs(5,7): error CS0246: The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
CustomMembershipProvider.cs(9,38): error CS0246: The type or namespace name 'ExtendedMembershipProvider' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
Models\AccountModels.cs(3,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
CustomMembershipProvider.cs(198,37): error CS0246: The type or namespace name 'OAuthAccountData' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
Models\AccountModels.cs(40,10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
Models\AccountModels.cs(40,10): error CS0246: The type or namespace name 'CompareAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
Models\AccountModels.cs(73,10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
Models\AccountModels.cs(73,10): error CS0246: The type or namespace name 'CompareAttribute' could not be found (are you missing a using directive or an assembly reference?) [C:\DWASFiles\Sites\<projname>\VirtualDirectory0\site\repository\<projname>.Common\<projname>.Common.csproj]
请注意,这些编译错误针对我项目中的另一个程序集(我放置业务逻辑的程序集)。
谷歌搜索时,我发现的唯一提及是必须将这些引用的“本地副本”标志设置为 true。我已经尝试过了,但仍然遇到相同的错误。
这一切都在本地编译得很好。有任何想法吗?
更新
为了添加更多信息,我在 Git 存储库中的项目结构如下:
+ProjName
ProjName.csproj
web.config
...etc...
+ProjName.Common
ProjName.Common.csproj
+ProjName.Tests
ProjName.Tests.csproj
+packages <-- these are Nuget packages
ProjName.sln
Azure 显示的编译错误表明失败的是 ProjName.vcproj - 但它们指的是 ProjName.Common 程序集参考。
请注意,此布局是 VisualStudio 创建的(即 webroot 的额外项目子目录)。
我不确定 Azure 在进行 Git 部署时会做什么。它是否认识到 ProjName 目录是 webroot,并且还解析 ProjName.sln 编译解决方案中的任何其他程序集(与 Visual Studio 相同)?
另外,我没有向 Git 添加任何“bin”文件夹。但是,我只是将其作为测试进行了尝试,它并没有改变 Azure 产生的编译错误。