无法使用 git 部署到 Azure

本文关键字:部署 Azure git | 更新日期: 2023-09-27 18:33:52

我正在使用Mac上的Xamarin工作室来开发一个 ASP.NET 的MVC Razor应用程序。一切都在本地工作,但是当我推送到 azure 时,它无法部署。这是输出:

remote: Running deployment command...
remote: Handling .NET Web Application deployment.
remote: ..........
remote: Installing 'Microsoft.AspNet.WebPages 3.2.0'.
remote: Successfully installed 'Microsoft.AspNet.WebPages 3.2.0'.
remote: Installing 'Microsoft.Data.OData 5.6.2'.
remote: Installing 'Microsoft.AspNet.Mvc 5.2.0'.
remote: Successfully installed 'Microsoft.AspNet.Mvc 5.2.0'.
remote: Installing 'Microsoft.Web.Infrastructure 1.0.0.0'.
remote: Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
remote: Installing 'Microsoft.Data.Edm 5.6.2'.
remote: Installing 'System.Spatial 5.6.2'.
remote: Successfully installed 'Microsoft.Data.OData 5.6.2'.
remote: Successfully installed 'System.Spatial 5.6.2'.
remote: Successfully installed 'Microsoft.Data.Edm 5.6.2'.
remote: Installing 'Microsoft.Data.Services.Client 5.6.2'.
remote: Successfully installed 'Microsoft.Data.Services.Client 5.6.2'.
remote: ......................
remote: Installing 'Newtonsoft.Json 5.0.8'.
remote: Successfully installed 'Newtonsoft.Json 5.0.8'.
remote: Installing 'WindowsAzure.Storage 4.3.0'.
remote: Successfully installed 'WindowsAzure.Storage 4.3.0'.
remote: Installing 'Microsoft.AspNet.Razor 3.2.0'.
remote: Installing 'Microsoft.WindowsAzure.ConfigurationManager 1.8.0.0'.
remote: Successfully installed 'Microsoft.AspNet.Razor 3.2.0'.
remote: Successfully installed 'Microsoft.WindowsAzure.ConfigurationManager 1.8.0.0'.
remote: ..
remote:   WeddingSite -> D:'home'site'repository'WeddingSite'bin'WeddingSite.dll
remote: D:'home'site'repository'WeddingSite'WeddingSite.csproj : error MSB4057: The target "pipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.
remote: Failed exitCode=1, command="D:'Windows'Microsoft.NET'Framework'v4.0.30319'MSBuild.exe" "D:'home'site'repository'WeddingSite'WeddingSite.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:'DWASFiles'Sites'#1raouf-wedding'Temp'5314389e-4e5d-40f3-a7ce-0493eae3f70c";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:'home'site'repository'.''"
remote: An error has occurred during web site deployment.
remote: 
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://MirzaSikander@raouf-wedding.scm.azurewebsites.net:443/raouf-wedding.git
 * [new branch]      master -> master

我无法弄清楚问题所在。

无法使用 git 部署到 Azure

我遇到了同样的问题,以下是我用来修复它的步骤:1.编辑.csproj文件并在标签中添加以下内容,它应该是文件中的第一个标签。

<Import Project="$(VSToolsPath)'WebApplications'Microsoft.WebApplication.targets"     Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)'Microsoft'VisualStudio'v12.0'WebApplications'Microsoft.WebApplication.targets" Condition="true" />

您需要确保对于(MSBuildExtensionsPath32)您指向正确的路径,就我而言,我需要使用v12.0,但是如果您有较早版本的VS,那么2013年则可能是例如:v11。

同样在web.config中,我添加了这一部分:

<configuration>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>
</configuration>

我还将 azure 中的管道模式更改为经典模式。