-
Notifications
You must be signed in to change notification settings - Fork 266
Open
Labels
Area:RestoreStaticGraphIssues related to the Static Graph restoreIssues related to the Static Graph restoreFunctionality:RestorePriority:2Issues for the current backlog.Issues for the current backlog.Type:Bug
Description
Take the following project for example:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
</PropertyGroup>
</Project>
Run the following command:
msbuild /t:restore /p:TargetFramework="net5.0" /p:RestoreUseStaticGraphEvaluation="true"
Actual
See output below.
C:\Code\Temp\MultiTargetted [master]> msbuild /t:restore /p:TargetFramework="net5.0" /p:RestoreUseStaticGraphEvaluation="true"
Microsoft (R) Build Engine version 17.2.0-preview-22116-01+7d926d7ab for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20-Apr-22 5:09:34 PM.
Project "C:\Code\Temp\MultiTargetted\MultiTargetted.csproj" on node 1 (Restore target(s)).
Restore:
Determining projects to restore...
Evaluated 1 project(s) in 1259ms (1 builds, 0 failures).
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.RestoreEx.targets(19,5): error : Object reference not set to an instance of an object. [C:\Code\Temp\MultiTargetted\MultiTargetted.
csproj]
Done Building Project "C:\Code\Temp\MultiTargetted\MultiTargetted.csproj" (Restore target(s)) -- FAILED.
Build FAILED.
"C:\Code\Temp\MultiTargetted\MultiTargetted.csproj" (Restore target) (1) ->
(Restore target) ->
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.RestoreEx.targets(19,5): error : Object reference not set to an instance of an object. [C:\Code\Temp\MultiTargetted\MultiTargette
d.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.11Run it without static graph, and note that there's no failure.
msbuild /t:restore /p:TargetFramework="net5.0"
Expected
C:\Code\Temp\MultiTargetted [master]> msbuild /t:restore /p:TargetFramework="net5.0"
Microsoft (R) Build Engine version 17.2.0-preview-22116-01+7d926d7ab for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 20-Apr-22 5:09:39 PM.
Project "C:\Code\Temp\MultiTargetted\MultiTargetted.csproj" on node 1 (Restore target(s)).
_GetAllRestoreProjectPathItems:
Determining projects to restore...
Restore:
Assets file has not changed. Skipping assets file writing. Path: C:\Code\Temp\MultiTargetted\obj\project.assets.json
Restored C:\Code\Temp\MultiTargetted\MultiTargetted.csproj (in 81 ms).
NuGet Config files used:
C:\Code\NuGet.Config
C:\Users\Roki2\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files\dotnet\library-packs
All projects are up-to-date for restore.
Done Building Project "C:\Code\Temp\MultiTargetted\MultiTargetted.csproj" (Restore target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.79
Discovered this while working on #11653.
Note that when fixing this, we might need to do the same thing as the fix in #11653
zdenek-jelinek and Nirmal4G
Metadata
Metadata
Assignees
Labels
Area:RestoreStaticGraphIssues related to the Static Graph restoreIssues related to the Static Graph restoreFunctionality:RestorePriority:2Issues for the current backlog.Issues for the current backlog.Type:Bug