Search code examples
c#asp.net-mvcmacosazuremonodevelop

Cannot deploy to Azure using git


I am using the Xamarin studio on mac to develop a ASP.NET MVC Razor application. Everything is working locally, but when I push to azure, it fails to deploy. Here is the output:

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

I cannot figure out the issue.


Solution

  • I had the same problem, here are steps I used to fix it: 1. Edit .csproj file and add following in tag, it should be the first tag in the file.

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

    You need to make sure that for (MSBuildExtensionsPath32) you are pointing to the correct path, in my case I needed to use v12.0 but if you have earlier version of VS then 2013 it might e.g.: be v11.

    And also in web.config I added this section:

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

    I also changed pipeline mode in azure to Classic.