Skip to content

CI template tests are not running with the same framework version #62851

@ilonatommy

Description

@ilonatommy

This problem manifests when updating public API that is used in templates code (e.g. renaming after API review).
Such a rename is not possible in one PR. It will cause tests that run in

- script: $(BuildDirectory)\build.cmd -ci -prepareMachine -nativeToolsOnMachine -Configuration $(BuildConfiguration) $(BuildScriptArgs)
pass:.

eng/\build.cmd -ci -prepareMachine -nativeToolsOnMachine -Configuration Release -all -pack -test -binaryLog /p:SkipHelixReadyTests=true /p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false /p:RunBlazorPlaywrightTemplateTests=true  /p:DotNetSignType=

Using 10.0.100-preview.7.25322.101:

GET https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1
  Attempting to install 'sdk v10.0.100-preview.7.25322.101' from public location.
dotnet-install: Remote file https://ci.dot.net/public/Sdk/10.0.100-preview.7.25322.101/dotnet-sdk-10.0.100-preview.7.25322.101-win-x64.zip size is 308362401 bytes.
dotnet-install: Downloaded file https://ci.dot.net/public/Sdk/10.0.100-preview.7.25322.101/dotnet-sdk-10.0.100-preview.7.25322.101-win-x64.zip size is 308362401 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet-install: Extracting the archive.
dotnet-install: Adding to current process PATH: "D:\a\_work\1\s\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
dotnet-install: Note that the script does not ensure your Windows version is supported during the installation.
dotnet-install: To check the list of supported versions, go to https://learn.microsoft.com/dotnet/core/install/windows#supported-versions
dotnet-install: Installed version is 10.0.100-preview.7.25322.101
dotnet-install: Installation finished

PR: #62624 before commit that totally removed the public API from the template to enable merging.

At the same time, tests that run on the same CI in

- powershell: . ./activate.ps1; ./src/ProjectTemplates/scripts/Run-BlazorWeb-Locally.ps1 -Verbose
fail:

src\ProjectTemplates\scripts\MyBlazorApp\Program.cs(18,51): error CS1739: The best overload for 'UseStatusCodePagesWithReExecute' does not have a parameter named 'createScopeForStatusCodePages'

Using

VERBOSE: Copying dotnet folder from D:\a\_work\1\s\.dotnet to D:\a\_work\1\s\src\ProjectTemplates\scripts/.dotnet
VERBOSE: PATH: 
D:\a\_work\1\s\src\ProjectTemplates\scripts/.dotnet;D:\a\_work\1\s\.dotnet;D:\a\_work\1\s\.dotnet\tools;C:\ToolCache\no
de\20.19.4\x64;D:\a\_work\1\s\.tools\ProcDump\;C:\vss-agent\4.258.1\externals\git\cmd;C:\vss-agent\4.258.1\externals\gi
t\mingw64\bin;C:\python3\Scripts\;C:\python3\;C:\Program Files (x86)\Microsoft 
SDKs\Azure\CLI2\wbin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0
\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client 
SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files (x86)\Windows 
Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program 
Files\PowerShell\7\;C:\Users\vmadmin\AppData\Local\Microsoft\WindowsApps;C:\ninja;C:\Users\cloudtest\AppData\Local\Micr
osoft\WindowsApps
VERBOSE: DOTNET_ROOT: D:\a\_work\1\s\src\ProjectTemplates\scripts/.dotnet
VERBOSE: Running dotnet --info
.NET SDK:
 Version:           10.0.100-preview.7.25322.101
 Commit:            67889d9d2f
 Workload version:  10.0.100-manifests.a24b8c3f
 MSBuild version:   17.15.0-preview-25322-101+67889d9d2

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.20348
 OS Platform: Windows
 RID:         win-x64
 Base Path:   D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\sdk\10.0.100-preview.7.25322.101\

.NET workloads installed:
...
 [wasm-tools]
   Installation Source: VS 17.14.36017.23
   Manifest Version:    10.0.100-preview.7.25322.101/10.0.100
   Manifest Path:       D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\sdk-manifests\10.0.100\microsoft.net.workload.mono.toolchain.current\10.0.100-preview.7.25322.101\WorkloadManifest.json
   Install Type:        FileBased
...
Host:
  Version:      10.0.0-preview.7.25367.101
  Architecture: x64
  Commit:       699b0116eb

.NET SDKs installed:
  10.0.100-preview.7.25322.101 [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 10.0.0-dev [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.0-preview.7.25322.101 [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 10.0.0-preview.7.25322.101 [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.0-preview.7.25367.101 [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 10.0.0-preview.6.25322.101 [D:\a\_work\1\s\src\ProjectTemplates\scripts\.dotnet\shared\Microsoft.WindowsDesktop.App]

If we revert the API rename in templates, it will make the *Locally.ps1 script pass but it will break the default build:

Project new blazor  --no-restore -int Server -au None failed to publish. Exit code 1.\r\nD:\a\_work\1\s\src\ProjectTemplates\test\Templates.Blazor.Tests\bin\Release\net10.0\TestTemplates\dotnet\dotnet.exe publish  -c Release /bl \nStdErr: \nStdOut:   Determining projects to restore...\r\n  All projects are up-to-date for restore.\r\nD:\a\_work\1\s\.dotnet\sdk\10.0.100-preview.7.25322.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(335,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [D:\a\_work\1\s\src\ProjectTemplates\test\Templates.Blazor.Tests\bin\Release\net10.0\TestTemplates\AspNet.ifa5mla2wcy3\AspNet.ifa5mla2wcy3.csproj]\r\nD:\a\_work\1\s\src\ProjectTemplates\test\Templates.Blazor.Tests\bin\Release\net10.0\TestTemplates\AspNet.ifa5mla2wcy3\Program.cs(18,51): error CS1739: The best overload for 'UseStatusCodePagesWithReExecute' does not have a parameter named 'createScopeForErrors' [D:\a\_work\1\s\src\ProjectTemplates\test\Templates.Blazor.Tests\bin\Release\net10.0\TestTemplates\AspNet.ifa5mla2wcy3\AspNet.ifa5mla2wcy3.csproj]\r\n

PR: #62768

This happens only on CI, when reproducing on the local machine, the problem is not there, both sets of commands pass.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Components

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions