Azure App Service Deployment Centre fails to deploy from GitHub repo - asp.net

I had an issue where I am developing a web service in Visual Studio 2017, ASP.NET with .NET version 4.7. When publishing to Azure from Visual Studio, it published fine and ran fine, it also runs in debug with no problems.
However, when I linked up the GitHub repo to the Azure App Service and pushed the updates to GitHub, then syncing Azure and waiting for it to pick up the updates and then deploy the app using Kudu, it would sync but then give multiple syntax errors along the lines of ';' expected, '(' expected, etc when attempting to deploy, and would therefore fail.

Apparently this is due to Azure using MSBuild 14, when it should be using MSBuild 15 for my VS2017 project. I don't understand the intricacies, and can't find many references to this issue online, but the issue was resolved by adding the Microsoft.Net.Compiler NuGet package to the project and then pushing this to GitHub and syncing the repo within Azure Deployment Centre.

Related

Building MSI in azure devops

We have for a while been building various web projects with AzureDevops and self hosted build agents.
Today I had to add a new build, consisting of a windows service written in .net core 3.1. This service has to be installed by our customers, so we have to provide it in a friendly installable way. As some of our developers were already used to handle MSI/*.vdproj projects, they added a vdproj into the *.sln to manage that. On a developper machine, this is not a problem even with VS2019: you just have to use the relevant VS studio extension...
But when it comes to building that in a CI/CD context, this becomes a real challenge. I quickly understood that we can't use MSBuild at all for that and found some alternative using directly Visual Studio (devenv)... Inspired by this thread (still opened), I came up with the following command line:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv" [...]\MySolution.sln /build "Release" /Project MyInstallationProject
This worked fine both on my developer machine and even on the build agent machine. But when I add it into a build pipeline as a command line task, it seems to hang, and after a while I get the following result for the job:
##[error]The job running on agent <MyAgent> ran longer than the maximum time of 60 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
What can I do to make it work?
What are the best practices for generating a self installable in a CI/CD context? (Is MSI still relevant? )
As a workaround, you can try to install the extension Build VS Installer and use the task DutchWorkz - Build VS Installer(s) to build Visual Studio Installer Project in Azure Pipelines.
Here are some tickets(ticket1, ticket2) with similar issue you can refer to.

UWP project needs to be deployed before it can be started

I am using visual studio 2017, created a new xamarin forms project and tried to run the UWP project. It shows the following error:
the project needs to be deployed before it can be started. verify the project is selected to be deployed the solution configuration manager, or deploy it explicitly by clinking one of the deploy commands in the build menu.
I have looked at all online solutions and only found that you need to set the cpu to x86 and to check the deploy checkbox under the configuration manager under the solution. Both these options don't work. I still get the same error. I have also tried every cpu option including ARM.
Have you tried to uninstall the existing UWP app from the Windows Start menu > All apps? Then deploy again from VS. It did the trick for me.
Sometimes when I create an app packet for win store; Visual studio seem to get hung up building to the packet (project needs to be deployed before it can be started -error).
I solve it by creating a new app packet.

Azure .Net WebApp Deployment Failed but it works locally on VS

I am new to .Net and Unable to understand some weird behaviour with Azure.
I am trying to publish a .Net Project to Azure Web App. And It is throwing very silly errors. I assume thats becoz of new C# version.
Here is the log file.
Use Case 1: When trying to build from Visual Studio Team Services and then deploy using Continuous delivery Works.
Use Case 2: When trying to publish directly using Visual Studio using App Service profile and it works.
Use Case 3: When trying to deploy through repository that is hosted at Visual Studio Team Services. And it fails and thats the error.
Any lead will be helpful.
Do let me know, if the information provided is not enough.
To compile C# 7.0 code, we need msbuild 15 installed. Currently, msbuild15 is not enabled on Azure Web App.
For Use Case 1 and 2, the C#(7.0) code is build on your development side on which
Visual Studio 2017(msbuild 15) is installed.
For Use Case 3, the code will be complied on Azure Web App, so it will throw errors.
Microsoft engineers are in the process of building these tools for Azure, they should be out soon. you could stay updated on github

Trying to deploy an ASP.NET web application to azure from BitBucket and getting error

I am trying to deploy an asp.net web app from BitBucket to an Azure web app and getting the below error:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment with MSBuild.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin'.
Restoring packages for D:\home\site\repository\src\Sertech\project.json...
Committing restore...
Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\src\Sertech\project.lock.json
D:\home\site\repository\src\Sertech\Sertech.xproj
Restore completed in 1753ms.
NuGet Config files used:
C:\DWASFiles\Sites\#1SertechWebApp\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Cannot find DNX runtime dnx-clr-win-x86.1.0.0-rc1-update1 in the folder: .dnx\runtimes
D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(248,5): error MSB4044: The "GetBuildOptions" task was not given a value for the required parameter "RuntimeToolingDirectory". [D:\home\site\repository\src\Sertech\Sertech.xproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\Sertech.sln" /nologo /verbosity:m /p:deployOnBuild=True;AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false;publishUrl="D:\local\Temp\8d3d203fca67f23"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\57.50831.2397\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
The Publish Web option in Visual Studio works just fine, the issue only happens from a BitBucket deployment.
What I've tried so far in no particular order:
Use custom deployment script I found while searching the issue.
Use custom deployment script downloaded from the Kudu page of my
Azure web app.
Change the SDK version in VS.
Install the dnx-clr-win-x86 nuget package locally.
Install the dnx-clr-win-x86 nuget package on the web app resource
using the Azure console (this failed to find a package).
If anybody can point me in the right direction for troubleshooting further or has a solution I would be very thankful.
DNX? RC1? A release candidate isn't quite RELEASED software. Just as The Donald isn't the president just because he's a candidate (well at least not as of this writing).
ASP.NET 5.0 betas, Core 1.0 RC1 and Core 1.0 RC2 are no longer supported in Azure App Service.
Admittedly this was announced in a blog post so visibility may suffer - https://blogs.msdn.microsoft.com/waws/2016/06/14/supporting-asp-net-5-core-rc1-on-azure-app-service/
Is ASP.NET 5, Core RC1, RC2 supported on Azure App Service?
No, ASP.NET 5, Core RC1 or RC2 is no longer supported on Azure App Service. The only supported ASP.NET Core stack is RTM on Azure App Service. Check the newly announced RTM version at https://blogs.msdn.microsoft.com/appserviceteam/2016/06/27/azure-app-service-and-asp-net-core/
No wonder you see things breaking. Upgrade your project to ASP.NET Core 1.0 RTM and redeploy.
Official migration guide here:
https://docs.asp.net/en/latest/migration/rc1-to-rtm.html

Configuring existing ASP.NET project for DNVM, DNX environment on a Mac

I have an ASP.NET Web API project created on Windows using Visual Studio. How can I set this up for use with DNX/DNVM (on a Mac)?
Switching to Git solved the source control compatibility with TFS. But I wasn't able to find references to getting a project working across both these development environments.
I'm assuming as a first step the project will have to be migrated to ASP.NET 5/vNext but wondering other problems lurk around the corner with different project members using different environments.
I get an error when I run - git:(master):dnx . kestrel
As you mentioned yes you will have to migrate any namespace changes. I have a project that is developed across both. Also changing csproj files to xproj. Support is coming for some kind of interop between the different project types but its not here yet.
For build, publish, deploy from git without relying on VS publish capabilities or MSBuild you can follow my blog post here.
Basically you use DNU to publish and then kudu to deploy.

Resources