A set of technologies in the .NET Framework for building web applications and XML web services.
I tried both suggestions, but App Service Build Service still failed to build .NET 9 project. I think the problem is because a generated CI script is relying on MSBuild but there is no MSBuild 17.12 installed in the app service.
echo Handling ASP.NET Core Web Application deployment with MSBuild16.
:: 1. Restore, Build and publish
call :ExecuteCmd "%MSBUILD_16_DIR%\MSBuild.exe" /restore "%DEPLOYMENT_SOURCE%\Zortout.API.Core\Zortout.API.Core.Server\Zortout.API.Core.Server.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="%DEPLOYMENT_TEMP%" %SCM_BUILD_ARGS%
IF !ERRORLEVEL! NEQ 0 goto error
:: 2. KuduSync
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
Full log:
Command: "C:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment with MSBuild16.
MSBuild version 17.11.2+c078802d4 for .NET Framework
Build started 12/2/2024 3:05:37 PM.
Project "C:\home\site\repository\MySolution\MyProj\MyProj.csproj" on node 1 (Restore target(s)).
_GetAllRestoreProjectPathItems:
Determining projects to restore...
Restore:
X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
Assets file has not changed. Skipping assets file writing. Path: C:\home\site\repository\MySolution\MyProj\obj\project.assets.json
Restored C:\home\site\repository\MySolution\MyProj\MyProj.csproj (in 518 ms).
Assets file has not changed. Skipping assets file writing. Path: C:\home\site\repository\MySolution\MySolution.Data\obj\project.assets.json
Restored C:\home\site\repository\MySolution\MySolution.Data\MySolution.Data.csproj (in 8 ms).
NuGet Config files used:
C:\home\site\repository\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
All projects are up-to-date for restore.
Done Building Project "C:\home\site\repository\MySolution\MyProj\MyProj.csproj" (Restore target(s)).
Project "C:\home\site\repository\MySolution\MyProj\MyProj.csproj" on node 1 (default targets).
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\MySolution\MyProj\MyProj.csproj]
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'C:\home\site\repository\MySolution\MyProj\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [C:\home\site\repository\MySolution\MyProj\MyProj.csproj]
Done Building Project "C:\home\site\repository\MySolution\MyProj\MyProj.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\home\site\repository\MySolution\MyProj\MyProj.csproj" (default target) (1:7) ->
(_WarnWhenUsingNET9AndVSPriorTo1712 target) ->
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\MySolution\MyProj\MyProj.csproj]
"C:\home\site\repository\MySolution\MyProj\MyProj.csproj" (default target) (1:7) ->
(ResolvePackageAssets target) ->
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'C:\home\site\repository\MySolution\MyProj\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [C:\home\site\repository\MySolution\MyProj\MyProj.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:03.56
Failed exitCode=1, command="C:\Program Files (x86)\MSBuilds\17.11.2\MSBuild\Current\Bin\MSBuild.exe" /restore "C:\home\site\repository\MySolution\MyProj\MyProj.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="C:\local\Temp\8dd12a81a7f70c3"
An error has occurred during web site deployment.
\r\nC:\Program Files (x86)\SiteExtensions\Kudu\103.100930.002\bin\Scripts\starter.cmd "C:\home\site\deployments\tools\deploy.cmd"