0

I'm continuously deploying my Azure Web App as usual (using Visual Studio Community 2019) but now I'm getting the following error.

(Also, I've already seen this question: The default XML namespace of the project must be the MSBuild XML namespace, but I'm only getting this error in the logs in the Deployment Centre of my Azure Web App, and that question relates to Visual Studio 2017.)

"WebApp" is the name of the solution:

D:\home\site\repository\packages\EntityFramework.6.3.0\build\EntityFramework.props(1,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\WebApp.WebUI\WebApp.WebUI.csproj] Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\WebApp.WebUI\WebApp.WebUI.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d75ccda63e5816";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository\.\\" An error has occurred during web site deployment. \r\nD:\Program Files (x86)\SiteExtensions\Kudu\84.10924.4104\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

Here's the start of my WebApp.WebUI.csproj file:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="..\packages\EntityFramework.6.3.0\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.3.0\build\EntityFramework.props')" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

UPDATE: I've downgraded to Entity Framework 6.2.0. It's now working, but this isn't a good solution. The problem is with the Entity Framework 6.3.0 package and/or how it interacts with my current configuration.

nmit026
  • 3,024
  • 2
  • 27
  • 53

4 Answers4

1

Could you please try modifying your project node like below, it worked for me:

<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Additional reference:

http://blog.codenova.pl/post/new-azure-functions-sdk-and-vsts-how-to-build-your-functions

Let me know if still doesn't work for you.

Mohit Verma
  • 5,140
  • 2
  • 12
  • 27
  • Is that only for Azure Functions? Also should I remove the `ToolsVersion="12.0"` and `DefaultTargets="Build"` attributes? – nmit026 Oct 30 '19 at 20:06
  • Also, I'm not actually using .NET Core, is this solution only for .NET Core? – nmit026 Oct 30 '19 at 20:52
1

I think this issue has something to do with the msbuild version. I googled some similar issues and found that the EF6.3 requires at least VS2017 and higher. And if we use msbuild 14.0(VS2015) to build a web-project consuming EF6.3, we'll get same error like this:

enter image description here

Cause of your issue:

And according to your log(line7):Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" ,during that process, it's using msbuild 14.0(msbuild of VS2015). I think that's why you have that strange error.

1.To resolve that issue, in local machine, we need to use VS2017(msbuild15.0) or VS2019(msbuild16.0) to build that project.

The path of msbuild 15.0: C:\Program Files (x86)\Microsoft Visual Studio\2017\xxx\MSBuild\15.0\Bin

The path of msbuild 16.0: C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\MSBuild\Current\Bin

2.As for msbuild support for Azure: please check this issue. Now Azure has support for VS2017 build tools(msbuild 15.0), please try the useful info there to configure your deployment to use msbuild 15.0.

Hope it makes some help :)

Community
  • 1
  • 1
LoLance
  • 25,666
  • 1
  • 39
  • 73
  • I'm using Visual Studio Community 2019 on my development machine, no problems. I only get this error on Azure. If something compiles in Visual Studio 2019, surely it should just automatically compile in Azure? Otherwise what's the point of using VS 2019? So I have to manually configure msbuild in Azure? What's the easiest way to do that? – nmit026 Oct 31 '19 at 22:05
  • I mean, I can see that issue, but if support for VS2017 has been added, shouldn't it just work? If not, may I please have detailed instructions for exactly what to do? (There's alot going on in that thread.) – nmit026 Oct 31 '19 at 22:22
  • 1
    @nmit026, After you deploy the web app into azure app service, its runtime environment need depend on your azure app service configuration. In fact, you are already approaching the solution. In Lance's link, there has steps described in that. Please see this 2 link: [#1](https://github.com/projectkudu/kudu/issues/2376) and [#2](https://github.com/projectkudu/kudu/issues/2350). As default, if you did not do any configuration on Azure app service. MSbuild14.0 will be used by default. Please follow that 2 links to configure, then feel free to let me and Lance know whether it is works for you. – Mengdi Liang Nov 01 '19 at 03:41
  • @MerlinLiang-MSFT I'm still kind of confused about how to do this (it says it needs a custom deployment script?), I'd rather just use 6.2.0 than waste time and mess things up. Is there not somewhere in the interface where we can select which version of the build program gets used? It's kind of weird that Azure is using the equivalent of VS2015 by default with no easy way to modify it. Upgrading packages shouldn't break a website. – nmit026 Nov 20 '19 at 22:43
1

Entity Framework 6.4.0 works. (6.3.0 will not.)

nmit026
  • 3,024
  • 2
  • 27
  • 53
0

If there is any way to find out your Visual Studio version for Azure deployment. Not the local VS version but the server one, which is being used to build your project while deploying on Azure. I feel that's lower than 2017.

Update: Since the VS version is 2015, you would not be able to upgrade until you upgrade the VS version as well.

EF 6.3 uses the new csproj format and requires VS 2017 and above. If you degraded to EF 6.2 and it built fine. So for your case, please try with VS2017 or above to build the project for Azure deployment.

Rohin Tak
  • 489
  • 4
  • 8