Azure 部署:错误 MSB4041:项目的默认 XML 命名空间必须是 MSBuild XML 命名空间
Azure deployment: error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace
我像往常一样不断部署我的 Azure Web 应用程序(使用 Visual Studio Community 2019),但现在我收到以下错误。
(此外,我已经看到这个问题:,但我只是在我的 Azure Web 应用程序的部署中心的日志中收到此错误,并且该问题与 Visual Studio 2017.)
"WebApp"为解名:
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.0\Bin\MSBuild.exe" "D:\home\site\repository\WebApp.WebUI\WebApp.WebUI.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Tempd75ccda63e5816";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.10924.4104\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
这是我的 WebApp.WebUI.csproj 文件的开头:
<?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')" />
更新:我已经降级到 Entity Framework 6.2.0。它现在正在工作,但这不是一个好的解决方案。问题在于 Entity Framework 6.3.0 包 and/or 它如何与我当前的配置交互。
能否请您尝试像下面这样修改您的项目节点,它对我有用:
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
附加参考:
http://blog.codenova.pl/post/new-azure-functions-sdk-and-vsts-how-to-build-your-functions
如果仍然不适合您,请告诉我。
我认为这个问题与msbuild版本有关。我用谷歌搜索了一些 similar issues,发现 EF6.3
至少需要 VS2017
或更高。如果我们使用 msbuild 14.0(VS2015) 构建一个使用 EF6.3 的 Web 项目,我们将得到如下相同的错误:
您的问题原因:
并且根据您的日志(line7):Failed exitCode=1, command="D:\Program Files (x86)\MSBuild.0\Bin\MSBuild.exe"
,在该过程中,它使用的是 msbuild 14.0(VS2015 的 msbuild)。我认为这就是为什么你有那个奇怪的错误。
1.To解决该问题,在本地机器,我们需要使用VS2017(msbuild15.0)或VS2019(msbuild16.0)来构建该项目。
The path of msbuild 15.0: C:\Program Files (x86)\Microsoft Visual Studio17\xxx\MSBuild.0\Bin
The path of msbuild 16.0: C:\Program Files (x86)\Microsoft Visual Studio19\xxx\MSBuild\Current\Bin
2.As 用于 Azure 的 msbuild 支持:请检查 this issue。现在 Azure 支持 VS2017 构建工具 (msbuild 15.0),请尝试那里的有用信息来配置您的部署以使用 msbuild 15.0。
希望对您有所帮助:)
如果有任何方法可以找到您的 Visual Studio Azure 部署版本。
不是本地 VS 版本,而是服务器版本,它用于在 Azure 上部署时构建项目。
我觉得比2017年低。
更新:
由于VS版本是2015,所以你也必须升级VS版本才能升级
EF 6.3 使用新的 csproj 格式,需要 VS 2017 及更高版本。如果您降级到 EF 6.2 并且它构建良好。因此,对于您的情况,请尝试使用 VS2017 或更高版本构建用于 Azure 部署的项目。
Entity Framework 6.4.0 有效。 (6.3.0 不会。)
我像往常一样不断部署我的 Azure Web 应用程序(使用 Visual Studio Community 2019),但现在我收到以下错误。
(此外,我已经看到这个问题:
"WebApp"为解名:
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.0\Bin\MSBuild.exe" "D:\home\site\repository\WebApp.WebUI\WebApp.WebUI.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Tempd75ccda63e5816";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.10924.4104\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
这是我的 WebApp.WebUI.csproj 文件的开头:
<?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')" />
更新:我已经降级到 Entity Framework 6.2.0。它现在正在工作,但这不是一个好的解决方案。问题在于 Entity Framework 6.3.0 包 and/or 它如何与我当前的配置交互。
能否请您尝试像下面这样修改您的项目节点,它对我有用:
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
附加参考:
http://blog.codenova.pl/post/new-azure-functions-sdk-and-vsts-how-to-build-your-functions
如果仍然不适合您,请告诉我。
我认为这个问题与msbuild版本有关。我用谷歌搜索了一些 similar issues,发现 EF6.3
至少需要 VS2017
或更高。如果我们使用 msbuild 14.0(VS2015) 构建一个使用 EF6.3 的 Web 项目,我们将得到如下相同的错误:
您的问题原因:
并且根据您的日志(line7):Failed exitCode=1, command="D:\Program Files (x86)\MSBuild.0\Bin\MSBuild.exe"
,在该过程中,它使用的是 msbuild 14.0(VS2015 的 msbuild)。我认为这就是为什么你有那个奇怪的错误。
1.To解决该问题,在本地机器,我们需要使用VS2017(msbuild15.0)或VS2019(msbuild16.0)来构建该项目。
The path of msbuild 15.0: C:\Program Files (x86)\Microsoft Visual Studio17\xxx\MSBuild.0\Bin
The path of msbuild 16.0: C:\Program Files (x86)\Microsoft Visual Studio19\xxx\MSBuild\Current\Bin
2.As 用于 Azure 的 msbuild 支持:请检查 this issue。现在 Azure 支持 VS2017 构建工具 (msbuild 15.0),请尝试那里的有用信息来配置您的部署以使用 msbuild 15.0。
希望对您有所帮助:)
如果有任何方法可以找到您的 Visual Studio Azure 部署版本。 不是本地 VS 版本,而是服务器版本,它用于在 Azure 上部署时构建项目。 我觉得比2017年低。
更新: 由于VS版本是2015,所以你也必须升级VS版本才能升级
EF 6.3 使用新的 csproj 格式,需要 VS 2017 及更高版本。如果您降级到 EF 6.2 并且它构建良好。因此,对于您的情况,请尝试使用 VS2017 或更高版本构建用于 Azure 部署的项目。
Entity Framework 6.4.0 有效。 (6.3.0 不会。)