Restore broken when ContinuousIntegrationBuild is true
- Dominant language
- C#
- Stars
- 729
- Forks
- 397
- Avg merge
- 3d 15m
- Merged PRs (30d)
- 149
Description
[#15821](https://github.com/dotnet/arcade/pull/15821) made the following change
```diff
-
- $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', '.prebuilt-packages'))
+
+ $([MSBuild]::NormalizeDirectory('$(RepoRoot)', '.packages'))
```
This causes Roslyn's bootstrap build to [fail in CI](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1094472&view=logs&jobId=339cec17-08ed-510d-2993-786b72c8ba08&j=7cdae500-0ea5-58ba-9407-8d2db153220d&t=52ff1880-49f4-518f-c85b-bf903be07bd1) with the following errors.
```
D:\a\_work\1\s\artifacts\obj\CSharpSyntaxGenerator\Release\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,46): error CS0234: The type or namespace name 'TargetFrameworkAttributeAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) [D:\a\_work\1\s\src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj::TargetFramework=netstandard2.0]
D:\a\_work\1\s\artifacts\obj\CSharpSyntaxGenerator\Release\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,46): error CS0234: The type or namespace name 'TargetFrameworkAttribute' does not exist in the namespace 'System.Runtime.Versioning' (are you missing an assembly reference?) [D:\a\_work\1\s\src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj::TargetFramework=netstandard2.0]
D:\a\_work\1\s\artifacts\obj\CSharpSyntaxGenerator\Release\netstandard2.0\CSharpSyntaxGenerator.AssemblyInfo.cs(13,30): error CS0234: The type or namespace name 'AssemblyCompanyAttributeAttribute' does not exist in the namespace 'System.Reflection' (are you missing an assembly reference?) [D:\a\_work\1\s\src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj::TargetFramework=netstandard2.0]
D:\a\_work\1\s\artifacts\obj\CSharpSyntaxGenerator\Release\netstandard2.0\CSharpSyntaxGenerator.AssemblyInfo.cs(13,30): error CS0234: The type or namespace name 'AssemblyCompanyAttribute' does not exist in the namespace 'System.Reflection' (are you missing an assembly reference?) [D:\a\_work\1\s\src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj::TargetFramework=netstandard2.0]
...
```
It is as if netstandard2.0 refs were missing.
From looking at binlogs we can see that the NETStandard.Library does not seem to be in the NuGetPackageRoot
Just to be sure things are sane, the NuGetPackageRoot is the $(RepoRoot)/.packages
Inspecting the Restore Messages I see the following
```
Installed NETStandard.Library 2.0.3 from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json to C:\Users\cloudtest\.nuget\packages\netstandard.library\2.0.3
```
Restore is downloading packages to the default location (`C:\Users\cloudtest\.nuget\packages`) and not the updated NuGetPackageRoot (`D:\a\_work\1\s\.packages`).
As a workaround I've set the NUGET_PACKAGES env variable, but I don't think it should be necessary.
PR where I try taking a new SDK - https://github.com/dotnet/roslyn/pull/79394/files
Contributor guide
Assessment
This issue has not been assessed yet.