Azure Website Remote Debugging with git deploy not working - azure

I've been trying out the new Remote Debugging feature for Azure Websites, but I think I may have come across an issue: I can only get it to work properly if I use Web Publish. If I deploy a site with local git deploy, the debugger attaches but the debug symbols aren't loaded (breakpoints show the warning).
I tried both setting the Release configuration to include PDB files (since Azure's git deploy uses the Release configuration by default) and by using a custom deploy script generated by the azure site deploymentscript command detailed here and setting the build command to use the Debug configuration. In both cases, I still get the same issue that the symbols aren't loaded.
I feel like the problem is probably one of the following:
Azure runs some sort of custom action after a Web Publish that must be run in order to allow remote debugging
The build options used by the git deployment scripts are missing some sort of flag that's causing PDB output to not be present for the web application (I don't think this one is likely)
Azure is not honoring the Configuration I use in the deployment script when the site is actually running and compiled on-demand
Ultimately I'm hoping to write some automated deployment scripts and I'd much rather use git deployment than Web Publish to accomplish this. What really baffles me is that this fails even with the Release configuration set to include the PDB files. It really makes me think there must be something extra being done on Azure for Web Publish that's not done for git deployment. Does anyone have any ideas of what may be causing the difference here?
Custom Git Deployment Script
I'm including the custom deployment script generated by azure site deploymentscript for reference and to show the build flags it uses. The relevant parts are after the :: Deployment section.
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 0.1.5
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=node "%appdata%\npm\node_modules\kuduSync\bin\kuduSync"
)
IF NOT DEFINED DEPLOYMENT_TEMP (
SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)
IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
mkdir "%DEPLOYMENT_TEMP%"
)
IF NOT DEFINED MSBUILD_PATH (
SET MSBUILD_PATH=%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling .NET Web Application deployment.
:: 1. Restore NuGet packages
IF /I "azure-test.sln" NEQ "" (
call "%NUGET_EXE%" restore "%DEPLOYMENT_SOURCE%\azure-test.sln"
IF !ERRORLEVEL! NEQ 0 goto error
)
:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\azure-test\azure-test.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Debug /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\azure-test\azure-test.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Debug /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Post deployment stub
call %POST_DEPLOYMENT_ACTION%
IF !ERRORLEVEL! NEQ 0 goto error
goto end
:error
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
echo Finished successfully.

Update 2/8/2014
Some fixes were made in WAWS, and it is now possible to make debugging work when using git, by having VS correctly load the server-side PDBs. For it to work, you need to do one of two things (i.e. you don't need to do both). It can work in both VS 2012 and 2013.
Turn off Just My Code debugging: just turn off that setting in the VS debugger settings and try debugging your Azure Web Site.
Build in Debug mode: to do that on the server build, you can go to the Azure Portal and add an ApSetting called SCM_BUILD_ARGS, with value -p:Configuration=Debug (more details here). Then go to the Deployments page and hit the Redeploy button (for the current deployment). Then attach from VS and it should all work!
Original answer
Indeed, this doesn't work today, and we're trying to see how we could make it work. At the root, the problem appears to be the Visual Studio debugger expects to find the PDBs on the client, while in the git case they only exist on the server.
This article discusses changes to how the debugger works between 2010 and the newer versions, and that probably affects things.
More investigation needed, but this is the state of things right now.

I was having this problem with a .Net Core Azure Function project, using the Cloud Explorer right-click functionality to attach. The following github issue speaks to it, but solution didn't solve my problem:
https://github.com/Azure/Azure-Functions/issues/872
I finally stumbled across the answer here:
http://dontcodetired.com/blog/post/Remote-Debugging-Azure-Functions-V2-The-breakpoint-will-not-currently-be-hit-No-symbols-have-been-loaded-for-this-document
It boils down to manually attaching to the process in Azure, rather than relying on the Cloud Explorer right-click functionality.

Related

Deploy to Azure Web App from Multiple Repositories

Looking for a way to deploy to an azure web app from 3 separate github repositories. One of the repositories is the main website, the other two are common libraries used by other projects. We want the deployment to pull down from all three repositories into an artifact directory, run msbuild and copy over the artifacts to wwwroot.
I am assuming i will need a custom .deployment file along with a kudu batch file. But I can't find any examples on how to pull down from multiple github repositories.
edit: spelling
According to your description, you could create your own .deployment and deploy.cmd file to firstly clone the second and third github repositories common libraries to the web app folder then use msbuild command to build it.
Notice: You couldn't clone the second and third github repositories to artifact directory. Because, you have 3 separate github repositories, each repository has its own .git file. We couldn't combine this three. So I suggest you could firstly clone the second and third repository to new folder and use msbuild to build it.
More details, you could refer to below steps:
Firstly, I suggest you could download the deployment script from the KUDU console.
Notice:After you have already deployed from the git, this file could be downloaded.We use this file as a example to add codes. If you doesn't have you could follow my deployment.cmd. Remember changing the project name.
As below:
Open Kudu.
Download the deploy script.
Then you could change find it contains the .deployment and deploy.cmd file.
Add below codes to the deploy.cmd file and add this two file into your git folder to push.
git clone https://github.com/{yourgithubname}/BrandoGitTestLibrary.git D:\home\site\{foldername}
echo second project
:: 1. Start restore second project
dotnet restore "D:\home\site\{foldername}\BrandoGitTestLibrary\BrandoGitTestLibrary.csproj"
:: 2. Build to DEPLOYMENT_TEMP wait copy
dotnet build "D:\home\site\{foldername}\BrandoGitTestLibrary\BrandoGitTestLibrary.csproj" --output "%DEPLOYMENT_TEMP%"
This code is used to build your common library to tempfolder wait for copying.
After the main website published, it will copy the tempfolder to the wwwrot.
The total deploy.cmd file.
Notice: This example just build two repositories. If you want to build and publish 3 repositories, you just need add the codes to clone again.
git clone https://github.com/BrandoTest/BrandoGitTestLibrary.git D:\home\site\sencondproject
echo second project
:: 3. Start restore second project
dotnet restore "D:\home\site\sencondproject\BrandoGitTestLibrary\BrandoGitTestLibrary.csproj"
:: 4. Build and publish
dotnet build "D:\home\site\sencondproject\BrandoGitTestLibrary\BrandoGitTestLibrary.csproj" --output "%DEPLOYMENT_TEMP%"
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
IF NOT DEFINED DEPLOYMENT_TEMP (
SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)
IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
mkdir "%DEPLOYMENT_TEMP%"
)
IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling ASP.NET Core Web Application deployment.
:: 1. Restore nuget packages
call :ExecuteCmd dotnet restore "%DEPLOYMENT_SOURCE%\TestForCore2.csproj"
IF !ERRORLEVEL! NEQ 0 goto error
:: 2. Build and publish
call :ExecuteCmd dotnet publish "%DEPLOYMENT_SOURCE%\TestForCore2.csproj" --output "%DEPLOYMENT_TEMP%" --configuration Release
IF !ERRORLEVEL! NEQ 0 goto error
:: 5. KuduSync
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end
:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%
:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
endlocal
echo Finished successfully.
Result:

Continuous deployment with github and azure function project in visual studio 2017 preview

I am trying to set ci/cd from github to azure functions
I created an Azure function project in git "https://github.com/AmitayStrijevski/AppFunctionTest".
I published it once through the visual studio and it worked perfect.
Then i connected it to the github ci/cd described here
"https://learn.microsoft.com/en-us/azure/azure-functions/functions-continuous-deployment#continuous-deployment-requirements".
When pushing to git i can see it takes my code and "deploy" it but when i look at the the functions my new code is not there and the logs show the following message
"Found solution 'D:\home\site\repository\HeyArnold\HeyArnold.sln' with no deployable projects. Deploying files instead."
I spent more than a day on this and i will really appreciate help in this issue
I was able to use the github deployment when using an empty web site and setting the same folder structure generated by the azure portal
This is still not solve my problem because i want to use Azure function project but i thought worth mentioning
Check out <functionappname>.scm.azurewebsites.net/dev to see what files are actually deployed to the wwwroot folder.
I took a look at your github project and I noticed a few things: if you're using .cs files, you should be creating a precompiled function, which you can deploy directly from VS.
However, if you're instead using .csx files and want to be able to edit code from the functions portal, the structure you have is correct - just remove the solution and csproj files, as I believe they are confusing the deployment infrastructure
After consulting with Microsoft support i recevied two files that needed to be put in the .sln folder and then git deployment will work
Be aware changing lines
:: 1. Restore nuget packages
:: 2. Build and publish
With your solution and project actual name
.deployment
[config]
command = deploy.cmd
deployment.cmd
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling function App deployment with Custom script.
:: 1. Restore nuget packages
call :ExecuteCmd nuget.exe restore "%DEPLOYMENT_SOURCE%\FunctionAppVS2017_3Preview.sln" -MSBuildPath "D:\Program Files (x86)\MSBuild-15.3-preview\MSBuild\15.0\Bin"
IF !ERRORLEVEL! NEQ 0 goto error
:: 2. Build and publish
call :ExecuteCmd "D:\Program Files (x86)\MSBuild-15.3-preview\MSBuild\15.0\Bin\MSBuild.exe" "%DEPLOYMENT_SOURCE%FunctionApp1\FunctionApp1.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end
:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set CMD=%*
call %CMD%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%CMD%
exit /b %ERRORLEVEL%
:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
endlocal
echo Finished successfully.
I'm using VSTS rather than GitHub but you might still find this link here of use.
Using the tooling extension for Azure Functions in VS2017 Preview, along with the build steps described in this issue I've been able to get this CI pipeline going with an Azure functions project. Josh Carlisle has detailed the steps to get this up and running on his blog.
You can add a .deployment-file to the root of your repository and point Azure, and Kudu, to the correct project-path:
[config]
project = src/PathToYourProject
Or you can add a Application settings in the Azure Portal with the key PROJECT and the value pointing to the correct project-path.

Kudu Deployment Script for ASP.NET Core 1.0

I'm developing a ASP.NET Core 1.0 application using Visual Studio Code and I can't/won't use the built-in publishing tools in Visual Studio IDE. I have this working for ASP.NET 5 RC1 (dnx-clr-win-x86.1.0.0-rc1-update1) but I don't know how to update this to ASP.NET Core 1.0 and the tools does not seem to be updated yet.
For ASP.NET 5 RC1 I used the azure-cli package to generate a deploy.cmd file with the following command:
azure site deploymentscript --aspNet5 .\server\project.json -p .\server --aspNet5Version "1.0.0-rc1-update1" --aspNet5Runtime clr --aspNet5Architecture x86
I got the following deploy.cmd file:
#if "%SCM_TRACE_LEVEL%" NEQ "4" #echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.6
:: ----------------------
:: Prerequisites
:: -------------
:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
goto error
)
:: Setup
:: -----
setlocal enabledelayedexpansion
SET ARTIFACTS=%~dp0%..\artifacts
IF NOT DEFINED DEPLOYMENT_SOURCE (
SET DEPLOYMENT_SOURCE=%~dp0%.
)
IF NOT DEFINED DEPLOYMENT_TARGET (
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)
IF NOT DEFINED NEXT_MANIFEST_PATH (
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest
IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
)
)
IF NOT DEFINED KUDU_SYNC_CMD (
:: Install kudu sync
echo Installing Kudu Sync
call npm install kudusync -g --silent
IF !ERRORLEVEL! NEQ 0 goto error
:: Locally just running "kuduSync" would also work
SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
IF NOT DEFINED DEPLOYMENT_TEMP (
SET DEPLOYMENT_TEMP=%temp%\___deployTemp%random%
SET CLEAN_LOCAL_DEPLOYMENT_TEMP=true
)
IF DEFINED CLEAN_LOCAL_DEPLOYMENT_TEMP (
IF EXIST "%DEPLOYMENT_TEMP%" rd /s /q "%DEPLOYMENT_TEMP%"
mkdir "%DEPLOYMENT_TEMP%"
)
IF DEFINED MSBUILD_PATH goto MsbuildPathDefined
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
:MsbuildPathDefined
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
echo Handling ASP.NET 5 Web Application deployment.
:: Remove wwwroot if deploying to default location
IF "%DEPLOYMENT_TARGET%" == "%WEBROOT_PATH%" (
FOR /F %%i IN ("%DEPLOYMENT_TARGET%") DO IF "%%~nxi"=="wwwroot" (
SET DEPLOYMENT_TARGET=%%~dpi
)
)
:: Remove trailing slash if present
IF "%DEPLOYMENT_TARGET:~-1%"=="\" (
SET DEPLOYMENT_TARGET=%DEPLOYMENT_TARGET:~0,-1%
)
:: 1. Set DNX Path
set DNVM_CMD_PATH_FILE="%USERPROFILE%\.dnx\temp-set-envvars.cmd"
set DNX_RUNTIME="%USERPROFILE%\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1"
:: 2. Install DNX
call :ExecuteCmd PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';$CmdPathFile='%DNVM_CMD_PATH_FILE%';& '%SCM_DNVM_PS_PATH%' " install 1.0.0-rc1-update1 -arch x86 -r clr %SCM_DNVM_INSTALL_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 3. Run DNU Restore
call %DNX_RUNTIME%\bin\dnu restore "%DEPLOYMENT_SOURCE%" %SCM_DNU_RESTORE_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 4. Run DNU Bundle
call %DNX_RUNTIME%\bin\dnu publish ".\server\project.json" --runtime %DNX_RUNTIME% --out "%DEPLOYMENT_TEMP%" %SCM_DNU_PUBLISH_OPTIONS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 5. KuduSync
call %KUDU_SYNC_CMD% -v 50 -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Post deployment stub
IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%"
IF !ERRORLEVEL! NEQ 0 goto error
goto end
:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%
:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul
:exitSetErrorLevel
exit /b 1
:exitFromFunction
()
:end
endlocal
echo Finished successfully.
This works for ASP.NET 5 RC1 (dnx-clr-win-x86.1.0.0-rc1-update1) but how do I update it for ASP.NET Core 1.0?
Can someone point me to a working example of a deploy.cmd for ASP.NET Core 1.0?
The Azure CLI will be updated soon, but you can use the latest now by directly using the kuduscript npm package. Install it using:
npm install -g kuduscript
You can then generate an ASP.NET Core script using something like this (replace names as appropriate):
kuduscript -y --aspNetCore src\AspNetCoreVS\project.json -s AspNetCoreVS.sln
Or if you don't have a solution file, you can skip that which generates a slightly different script.
Note that in common cases, Kudu should figure things out without any scripts. Custom scripts are only needed in more complex cases.

Azure deployment failing cannot find solution file?

When I deploy my repository from bitbucket, I get the following error,
Handling .NET Web Application deployment.
The system cannot find the file specified.
Failed exitCode=1, command=nuget restore "D:\home\site\repository\MySolution.sln"
An error has occurred during web site deployment.
I have a .deployment file on the root of the repo with the following contents
[config]
command = deploy.cmd
I also have a deploy.cmd file on the root and will fail at the following line for some reason
echo Handling .NET Web Application deployment.
:: 1. Restore NuGet packages
IF /I "MySolution.sln" NEQ "" (
call :ExecuteCmd nuget restore "%DEPLOYMENT_SOURCE%\MySolution.sln"
IF !ERRORLEVEL! NEQ 0 goto error
)
Why can Azure not find my solution file? Even using FTP I can see the solution file at the root of the repository...
Turns out it was because I was using encrypted password in my NuGet.config for my private nuget server, I switched to Plaintext and it worked!

git deploy to an Azure website fails with "unknown error"

I've been successfully using Git deploy (via Kudu) to a couple of Azure websites (e.g., beta/prod) for several months, and it's worked quite well. Starting today, I noticed that when I push to the appropriate respective git branch to my beta website - but not to my production website - the deploy fails, with an "Unknown Error" in the console, and no errors of any sort in the deployment logs. Again, exactly the same deployment works to my production server, and I haven't changed anything on my beta server in-between when the deploys stopped working.
So far as I can tell from the logs, it's failing at this point in my deploy.cmd:
:: 1. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)
IF !ERRORLEVEL! NEQ 0 goto error
This is the sort of thing that I'd normally contact Azure support for, but my subscription doesn't include tech support :-(. The Azure site recommends asking here on SO, and hence my post.
I've stopped and restarted the website, and poked around with the truly handy KuduConsole, but other than that, I'm kind of out of ideas.
Any suggestions for further troubleshooting this?

Resources