Skip to content

Compilation of netcoreapp3.1 targets fails on CI (both AppVeyor and Azure Pipelines) #3699

Closed
@mikkelbu

Description

@mikkelbu

On December 14 we had a successful build on master in both pipelines:

Since then we have noticed that the builds are failing on master, see e.g. #3696 (comment).

The errors are the same in both AppVeyor and Azure Pipelines error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. (and the same for Microsoft.WindowsDesktop.App):

...
  nunit.framework.tests -> C:\projects\nunit\bin\Release\net46\nunit.framework.tests.dll
  nunit.testdata.fsharp -> C:\projects\nunit\bin\Release\netcoreapp2.1\nunit.testdata.fsharp.dll
  nunit.framework.tests -> C:\projects\nunit\bin\Release\netcoreapp2.1\nunit.framework.tests.dll
C:\Users\appveyor\AppData\Local\Microsoft\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [C:\projects\nunit\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Users\appveyor\AppData\Local\Microsoft\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.WindowsDesktop.App is not installed. Please restore and try again. [C:\projects\nunit\src\NUnitFramework\tests\nunit.framework.tests.csproj]
  nunit.framework.tests -> C:\projects\nunit\bin\Release\net5.0-windows\nunit.framework.tests.dll
  nunitlite.tests -> C:\projects\nunit\bin\Release\net35\nunitlite.tests.exe
  nunitlite.tests -> C:\projects\nunit\bin\Release\net40\nunitlite.tests.exe
  nunitlite.tests -> C:\projects\nunit\bin\Release\net45\nunitlite.tests.exe
  nunitlite.tests -> C:\projects\nunit\bin\Release\netcoreapp2.1\nunitlite.tests.dll
C:\Users\appveyor\AppData\Local\Microsoft\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [C:\projects\nunit\src\NUnitFramework\nunitlite.tests\nunitlite.tests.csproj]
  nunitlite.tests -> C:\projects\nunit\bin\Release\net5.0\nunitlite.tests.dll
  nunitlite-runner -> C:\projects\nunit\bin\Release\net35\nunitlite-runner.exe
  nunitlite-runner -> C:\projects\nunit\bin\Release\net40\nunitlite-runner.exe
  nunitlite-runner -> C:\projects\nunit\bin\Release\net45\nunitlite-runner.exe
  nunitlite-runner -> C:\projects\nunit\bin\Release\netcoreapp2.1\nunitlite-runner.dll
C:\Users\appveyor\AppData\Local\Microsoft\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again. [C:\projects\nunit\src\NUnitFramework\nunitlite-runner\nunitlite-runner.csproj]
C:\Users\appveyor\AppData\Local\Microsoft\dotnet\sdk\5.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(324,5): error NETSDK1127: The targeting pack Microsoft.WindowsDesktop.App is not installed. Please restore and try again. [C:\projects\nunit\src\NUnitFramework\nunitlite-runner\nunitlite-runner.csproj]
  nunitlite-runner -> C:\projects\nunit\bin\Release\net5.0-windows\nunitlite-runner.dll
Cake.exe : An error occurred when executing task 'Build'.
...

Comparing the failing lines with the successful we can see that it is all the builds of netcoreapp3.1 targets that fail (and it is the same error in both CIs).

In AppVeyor the only difference in the logs are that NuGetRestore restores the projects in another order and that MSBuild has been bumped from 16.8.1+bd2ea1e3c to 16.8.2+25e4d540b. For Azure Pipelines we log more, and again the order of restores have been changes and the Windows image has been changed from '20201202.1' to '20201210.0' and the tasks UseDotNet from 2.175.0 to 2.179.0 and PowerShell from 2.177.0 to 2.179.1.

I've tried to retrigger the build on master and now it fails with the same error as in the PRs

The problem seems related to dotnet/runtime#45755, but setting GenerateErrorForMissingTargetingPacks to false for netcoreapp3.1 does not work as it then fails to compile the code

....
 nunit.framework.tests -> D:\a\1\s\bin\Release\netcoreapp2.1\nunit.framework.tests.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Collections" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Console" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Diagnostics.Debug" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Linq" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Runtime" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Runtime.Extensions" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Threading" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Threading.Tasks" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): warning MSB3277: Found conflicts between different versions of "System.Threading.Thread" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
D:\a\1\s\src\NUnitFramework\tests\Properties\AssemblyInfo.cs(35,12): error CS0012: The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
D:\a\1\s\src\NUnitFramework\tests\Properties\AssemblyInfo.cs(35,27): error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
D:\a\1\s\src\NUnitFramework\tests\Properties\AssemblyInfo.cs(35,41): error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
D:\a\1\s\src\NUnitFramework\tests\Properties\AssemblyInfo.cs(35,12): error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
CSC : error CS1705: Assembly 'nunit.testdata' with identity 'nunit.testdata, Version=0.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' [D:\a\1\s\src\NUnitFramework\tests\nunit.framework.tests.csproj]
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions