Azure deployment failing cannot find solution file? - azure

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!

Related

How do I resolve Access Denied error when trying to deploy Echobot in Azure?

I had a operating bot that I tried to push an update to and got a failure response. I tried building and deploying in Kudu with no luck either. Just as a sanity check I also made a brand new echobot on Azure and tried to run the build and deploy commands in Kudu Console.
EDIT: Meant to mention I've seen a few other mentions of similar issues including:
Error - Access is denied - deployment to Azure App Services
https://github.com/projectkudu/kudu/issues/3177
https://medium.com/rare-crew/hot-issue-on-azure-and-deployment-of-apps-by-kudu-scripts-dotnet-sdk-v3-1-301-92d6e336756a
MSBUILD : error MSB1025:Unhandled exception. An internal failure occurred while running MSBuild.
System.ComponentModel.Win32Exception (5): Access is denied.
at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
System.ComponentModel.Win32Exception (5): Access is denied.
at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
Failed exitCode=-532462766, command=dotnet restore "EchoBot.sln"
An error has occurred during web site deployment.
We arrived at an answer in this thread: Microsoft Help Link
For the default Echobot project generated by Azure you need a global.json file in "D:\home\site\wwwroot" with the following code. You can get to this folder by using the Kudu debug console.
{
"sdk": {
"version": "3.1.202"
}
}
The issue is recently introduced by latest dotnet sdk (2.1.515 and 3.1.301) versions. This impacts the projects with custom deployment script still using dotnet restore and publish to build.Could you please try the below workaround in deploy.cmd to fix it.
SET MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild-16.4\MSBuild\Current\Bin\MSBuild.exe
call :ExecuteCmd "%MSBUILD_PATH%" -t:Restore "%DEPLOYMENT_SOURCE%\my-solution.sln"
call :ExecuteCmd "%MSBUILD_PATH%" -t:Publish "%DEPLOYMENT_SOURCE%\vstar-next\my-proj.csproj" -p:OutputPath="%DEPLOYMENT_TEMP%" -p:Configuration=Dev

source parameter not specified cake

using azure devops to build a pipeline. pipeline uses cake scripts to build and publish. facing issue with publish package. below is the diagnostic of publish of nu get step.
2019-09-16T10:00:32.8150943Z NuGet
2019-09-16T10:00:32.8151140Z ========================================
2019-09-16T10:00:32.8151688Z Executing task: NuGet
2019-09-16T10:00:32.8195231Z PushNuGet
2019-09-16T10:00:32.8283167Z Pushing NuGet file C:/__w/2/a/build/A.SDK.TestLibrary/nuget/A.TestLibrary.SDK.1.4.2-abranch-15524.nupkg
2019-09-16T10:00:32.8331210Z No Source property has been set. Depending on your configuration, this may cause problems.
2019-09-16T10:00:32.8620102Z Executing: "C:/__w/2/a/build/tools/NuGet.exe" push "C:/__w/2/a/build/A.SDK.TestLibrary/nuget/A.TestLibrary.SDK.1.4.2-abranch-15524.nupkg" -NonInteractive
2019-09-16T10:00:33.3578097Z Source parameter was not specified.
2019-09-16T10:00:33.3864258Z An error occurred when executing task 'NuGet'.
2019-09-16T10:00:33.3996249Z Error: System.AggregateException: One or more errors occurred. ---> Cake.Core.CakeException: NuGet: Process returned an error (exit code 1).
source parameter not specified cake
Just like the error message shows,
Source parameter was not specified
And your nuget command line is:
"C:/__w/2/a/build/tools/NuGet.exe" push "C:/__w/2/a/build/A.SDK.TestLibrary/nuget/A.TestLibrary.SDK.1.4.2-abranch-15524.nupkg"
Indeed, it does not specify the source of the push command.
To resolve this issue, you should specify the source in that command:
nuget.exe push "YourPackageHere" -source "xxxx"
Check the document push command (NuGet CLI) for some more details.
Hope this helps.

kudu custom deployment fails for asp.net core webapp

I use pretty much standard custom kudu deployment script for asp.net core web app for external git deployment.
I managed to run the script mostly successfully, through mingling with SCM_COMMAND_IDLE_TIMEOUT and .cmd files encoding. My deployment scripts look as follows:
.deployment
[config]
command = deploy.cmd
deploy.cmd
#echo off
IF "%WEBSITE_SITE_TYPE%" == "<project_name>" (
.\<project folder>\Properties\deploy.cmd
goto end
)
echo Unknown WEBSITE_SITE_TYPE: "%WEBSITE_SITE_TYPE%". Expected one of the "<project name>"
:end
exit /b
.\<project folder>\Properties\deploy.cmd - regular asp.net core deploy.cmd script, updated for proper folder structure.
The WEBSITE_SITE_TYPE is a custom environment variable I added to the web app.
All these scripts saved with utf-8 without BOM encoding.
But even though the scripts look like runs successfully, the final state of the deployment process is Failed.
When looking into the kudu deployment log last few lines of the log look as follows:
...
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\runtime.ec2944dd8b20ec099bf3.js',,0
2018-10-14T20:50:51.0660695Z,Copying file: 'wwwroot\styles.8ef9ef86d2a54ed3748c.css',,0
2018-10-14T20:50:51.0816988Z,Deleting app_offline.htm,,0
2018-10-14T20:50:51.0816988Z,Finished successfully.,,0
2018-10-14T20:50:51.1129431Z,\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11002.3584\bin\Scripts\starter.cmd deploy.cmd,,2
Apparently the last line returns error code 2 and it might cause the script status to fail. But what does it mean and how do I fix it?

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.

Azure Website Remote Debugging with git deploy not working

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.

Resources