dotnet / dotnet/aspnetcore

Numerous failures while building `aspnetcore` tests in VMR

Open
#60,095 1 comment 0 reactions 1 assignee Claimed by @wtgodbe View on GitHub
area-infrastructure Priority:1
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

Tests are not building in VMR. There are numerous issues.

This is the latest issue with latest SHA:

`C:\git\dotnet2\src\aspnetcore\src\Components\test\testassets\Components.WasmMinimal\Components.WasmMinimal.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.Mono.browser-wasm with version (= 10.0.0-dev) [C:\Program Files\Microsoft Visual Studio\2022\Enterprise_Pre\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets]`

This seems expected due to: https://github.com/dotnet/aspnetcore/blob/1312da2106ecfb70100e6bdfed3af38d6b080d95/src/ProjectTemplates/TestInfrastructure/Directory.Build.props.in#L14-L20

Conditioning the download didn't help, as runtime json contains the pack reference with local dev version 10.0.0-dev and fails to build. Version is likely coming from project template.

Back in January, when I tried to enable tests, we were not hitting this issue, but several other ones, listed below. All of those issues are likely still present, but they are masked by the issue above.

## Missing test certificates

At first this was failing due to missing test certificates, required by various tests. The build is skipping the creation of those certificates due to this false condition: https://github.com/dotnet/aspnetcore/blob/7340678143d9ade4b772bad5e3ffd0b86718706e/src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets#L34-L38

`MSBuildRuntimeType` is set to `Full` due to: https://github.com/dotnet/dotnet/blob/81f0f65d674c3aebd3c1ce78f2e5d831d32980f8/repo-projects/aspnetcore.proj#L19-L21
```

$(BuildArgs) -msbuildEngine vs
false
```

This requires enabling `GenerateTestDevCert` task for .NET FX. Either by shelling out to use external tooling, or reuse some of the code from `CertificateManager`.

## Tests setup - mutation of .NET SDK

With test certificates available, we get the following failures:
`C:\git\dotnet\src\aspnetcore\src\ProjectTemplates\TestInfrastructure\PrepareForTest.targets(118,5): error MSB3030: Could not copy the file "DontDareMutateThisSDKdotnet.exe" because it was not found. [C:\git\dotnet\src\aspnetcore\src\ProjectTemplates\test\Templates.Blazor.WebAssembly.Auth.Tests\Templates.Blazor.WebAssembly.Auth.Tests.csproj]`

The root cause is in this section that talks about not running tests on source-build: https://github.com/dotnet/aspnetcore/blob/731c3b711bd81cc7c809e4e0164e8248e854f0b0/Directory.Build.props#L188-L210

One idea for fixing this: https://github.com/dotnet/sdk/pull/44843#issuecomment-2616815509

For repro, add `/p:DotNetBuildTests=true` to your Windows VMR build command, i.e.: `build -prepareMachine -c Release /p:TargetOS=windows /p:TargetArchitecture=x64 /bl /p:DotNetBuildTests=true`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.