Web API project failing to deploy on Azure App Service using Kudu deployments - azure

I am using Visual Studio 2019, my Web API project builds and runs fine locally. But, when trying to deploy on Azure App Service it fails with the following error
D:\home\site\repository\src\packages\Microsoft.Net.Compilers.Toolset.3.6.0\build\Microsoft.Net.Compilers.Toolset.props(2,1): error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. [D:\home\site\repository\src\Verify.WebApi\Verify.WebApi.csproj]
I checked my .csporj file it already has MSBuild 2003 format.
I also installed the latest nuget packages Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Microsoft.Net.Compilers and Microsoft.Net.Compilers.Toolset.
Azure App Service is using MSBuild 14.0 to build my project.
Can someone help in resolving this issue?

Related

How can I fix deployment problem? upgraded entity framework core from 3.1.4 to 3.1.5. Result mvc core web app runs in VS, but fails in Azure

How can I fix deployment problem? upgraded entity framework core from 3.1.4 to 3.1.5. Result mvc core web app runs in VS, but fails in Azure.
Dot Net core 3.1 with EF 3.1.4 in Azure ran OK.
I updated the Nuget EF packages to current stable 3.1.5, and the result runs locally, but fails when deployed to Azure with message:
"could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=3.1.5.0"
I used the Azure AppService Console and can see the EF versions have the same date as my local files "5/1/2020".
The FileExplorer details screen shows the version as 3.1.5, while the error message says it can not load 3.1.5.0. I searched, but did not find any other people with this problem.
I think is missing the reference there. If you can, check in the folder "packages" if there is a EF 3.1.5 there. Also, check if there is some places which is showing just 3.1.5.0 and try to change to 3.1.5 as is showing in the nuget library.
Finally solved the problem. It involved information from this Microsoft article:
https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.1#clear-package-caches
Needed to uninstall some nuget packages, use command line nuget commands to clear nuget cache, and then re-install latest nuget packages. Redeployed to Azure and the site works again.

Build multiple independent projects in the same solution in TeamCity

I have an MVC app in VS2013, and it has several related web/service projects, and one console app that is used for running SQL scripts against the database (it uses DbUP, to integrate with Octopus Deploy).
How can I generate NuGet Packages for both the web app and the console app?
I have created a separate Visual Studio (sln) step to build this project, but I get a missing reference error for the DbUp NuGet package. If I add a project reference to the web app, then the build is successful, but no artifact is generated. I would like to generate the NuGet package without adding the reference.
Well, this is embarrassing. Adding OctoPack NuGet package to my console app solved my problems.

Azure continuous deployment error Could not load file or assembly Microsoft.WindowsAzure.Packaging

Out of nowhere I started getting this error when I try to deploy my project to cloud service (using continuous deployment and hosted build controller.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.5\Microsoft.WindowsAzure.targets (2917): Could not load file or assembly 'Microsoft.WindowsAzure.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
I found this SO question, but it didn't help me.
Also I noticed I didn't even have folder:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\
I only have v10.0, v11.0, v12.0, so I manually created v14.0 and copied folder Windows Azure Tools form v12.0 but it didn't help.
EDIT
I've updated Azure tools to 2.6 but the problem and error message remains the same.
How can I fix this ?
I had the same error occurring today on Visual Studio Online's Host Build Controller. I assume you are using the same thing by your talk of Azure & Continuous Integration.
I noticed that they just released Azure SDK 2.6 support on the build controller in the last day or so. I feel that this may have somehow caused the problem.
I updated my cloud project to use 2.6, checked in, and everything was fine again. Some ccproj details:
<PropertyGroup>
<VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.6\</CloudExtensionsDir>
</PropertyGroup>
do you updated your Azure SDK for .NET to 2.5.1?
I have experienced this issue before when I updated the Azure SDK for .NET to 2.5.1
Microsoft has just recently release Azure SDK for .NET version 2.6 and I suggest you should try this. I believe this should solve your problem.
"try adding /p:GenerateBuildInfoConfigFile=false to your msbuild arguments in addition to /p:VisualStudioVersion=12.0, that has helped others workaround that same issue."
from here: https://social.msdn.microsoft.com/Forums/en-US/fc434580-cf81-44eb-9382-cd1b9fc9583a/microsoft-azure-sdk-v26-issue-with-cloud-builds?forum=TFService
Update Azure SDK to version 2.6 and after, update your Azure project's Application.
You can do this within the project's properties, by clicking the button to update Microsoft Azure Tools version from 2.5.1 to 2.6.

How do I make sure TFS is using most recent Azure SDK?

I have a Visual Studio 2013/Azure SDK 2.3 solution with a WebRole ccproj project where I am trying to automate the build and packaging to a .cspkg file.
If I build the solution on my dev machine and then right-click project and do "Package" (with Cloud/Release) everything works fine.
However, on the TFS Build Controller machine, I get the following error:
C:\Builds\439\MyPortal\Dev-MyPortal\bin\Debug\ServiceDefinition.csdef: Cannot find the physical directory 'C:\Builds\439\MyPortal\MyGateway' for virtual path MyGateway/.
This seems to indicate that the TFS build server is using the old Azure SDK 1.7 (and before) behavior for site physicalDirectory declarations:
<Site name="SolovisPortal" physicalDirectory="..\..\..\SolovisPortal">
I have the above definition in my ServiceDefinition.csdef. Another problem is that it looks like the ServiceDefinition.csdef is being overwritten into the same place for all 4 of my ccproj projects in the Solution.
Note: The build works fine if I eliminate "/t:Publish /p:TargetProfile=Cloud" from the MSBuild arguments.
Really, all I want to do is create the cspkg file for 2 of the 4 ccproj in the solution (just want to "Package" as opposed to "Publish").
Update (4/9/2014)
I am able to build the Azure package from a command-line on my local machine using cspack:
cspack MyPortalAzure\bin\Release\ServiceDefinition.csdef /out:test.cspkg /useCtpPackageFormat
However, my cspkg is 18MB, but it I manually "Package" the cspkg through Visual Studio it is only 15MB. Is VS doing something special to compress the file?

Type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure'

I'm working with a pre-existing codebase from a software developer that has left my company. I've downloaded the source code from the repository. When I attempt to build the project, I get an error that says:
The type or namespace name 'Diagnostics' does not exist in the namespace 'Microsoft.WindowsAzure' (are you missing an assembly reference?)
I can't figure out how to get this project up-and-running. When I look at the NuGet packages associated with the project, I can see that the Windows Azure Configuration Manager and Windows Azure Storage packages are already installed. I'm not sure what I'm missing though.
Can someone tell me what I need to install on my machine to get past this error? Thanks!
I recently had this error. The problem was that the project was referencing Framework 3.5 and I have the 2.4 SDK installed which targets 4.0. Upgrade your project to target 4.0 and you should be fine.
I was getting this error on Visual Studio 2015 Update 3. This project's Azure Tools verion is 2.9.
I resolved this error by right clicking References under the project that has the error, then clicking Add Reference, then click Extensions under Assemblies. Find Microsoft.WindowsAzure.Diagnostics, check the box, and click OK. Now try rebuilding your project and hope for a different error.
The assembly should exist on your computer here: C:\Program Files\Microsoft SDKs\Azure.NET SDK\v2.9\bin\plugins\Diagnostics\Microsoft.WindowsAzure.Diagnostics.dll
If you do not see this assembly, it's most likely because you do not have the required Azure SDK. If you are using Azure SDK v2.9 like I am, you can download the SDKs here: Microsoft Azure SDK for .NET - 2.9
Then click download and select:
MicrosoftAzureLibsForNet-x64.msi (Microsoft Azure Client Libraries for .NET)
MicrosoftAzureTools.VS.140 (Microsoft Azure Tools for Microsoft Visual Studio 2015)
If you are using Azure SDK v2.7 then you will want to use this link: Microsoft Azure SDK for .NET - 2.7

Resources