Home: [Test Failure] Error NETSDK1005 occurred when running command ‘msbuild /t:build /restore’ in VS Builds Tools

Created on 4 Aug 2020  Â·  9Comments  Â·  Source: NuGet/Home

Details about Problem

VS BuildTools Version: Master\30403.137
NuGet Build Tools SKU Version: Dev\5.8.0.6761

Installation steps:

  1. OS: Windows-10-Enterprise-RS5.
  2. Install VS BuildTools Master\30403.137 from: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3943992&view=ms.vss-build-web.run-extensions-tab
  3. Install NuGet Build Tools SKU vsix:
    <1>. Get the Build Tools vsix from: \\ddfiles\Drops\NuGet\Drops\CI\NuGet.Client\Dev\5.8.0.6761\artifacts\VS15\Microsoft.VisualStudio.NuGet.BuildTools.vsix
    <2>. Extract the vsix locally.
    <3>. Delete the content of C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet
    <4>. Go to the extracted folder and copy the contents of the folder: Contents\Common7\IDE\CommonExtensions\Microsoft\NuGet\
    <5>. Copy those files to C:\Program Files (x86)\ Microsoft Visual Studio\2019\Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet

Repro steps:

  1. Create a Console App (.NET Core) project with Target Framework is net5.0 (Create the project in VS Master\30403.137 in this case).
  2. Install some package to the project.
  3. Open VS BuildTools and cd to the project path.
  4. Run msbuild /t:restore.
  5. Run msbuild /t:build /restore.

Expected:

All of these should succeed without any error.

Actual:

Error NETSDK1005 occurred when running command msbuild /t:build /restore as below screenshot.
0804

Error Message:

"C:\Test\ConsoleNetCore\ConsoleNetCore\ConsoleNetCore.csproj" (build target) (1:7) ->
(ResolvePackageAssets target) ->
  C:\Program Files\dotnet\sdk\5.0.100-preview.7.20366.6\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResol
ution.targets(241,5): error NETSDK1005: Assets file 'C:\Test\ConsoleNetCore\ConsoleNetCore\obj\project.assets.json' doe
sn't have a target for '.NETCoreApp,Version=v5.0'. Ensure that restore has run and that you have included 'net5.0' in t
he TargetFrameworks for your project. [C:\Test\ConsoleNetCore\ConsoleNetCore\ConsoleNetCore.csproj]

Notes:

  1. The issue doesn’t repro on .NET Framework and .NET Standard project.
  2. The issue doesn’t repro when using a .NET Core project with Target Framework is net3.1.
  3. The issue doesn’t repro on VS Build Tools Master\30328.112 + NuGet Build Tools Vsix Dev\5.8.0.6753.
Restore 1

Most helpful comment

@zkat Hi, Kat, Verified on VS Build Tools Main\30417.28 + NuGet Build Tools Vsix Dev\5.8.0.6777 today, the issue has been fixed.

All 9 comments

It start to repro from NuGet Build Tools Vsix Dev\5.8.0.6761. Not repro on NuGet Build Tools Vsix Dev\5.8.0.6760.

Hi @zkat , is this related to NET5 changes is 6761?

@aortiz-msft

Based on the commits, I think it's https://github.com/NuGet/NuGet.Client/commit/280abd3f8a7f2656246450d91fb33fc7262e6de0. It's my change 👋

However, this is also likely by design based on The issue doesn’t repro when using a .NET Core project with Target Framework is net3.1..

The problem is that the dotnet SDK is reporting a TPI for P7, but it's something they fixed in P8.
I'll have to verify that first, but pretty confident the answer here is just waiting it out.

It might be good for @v-luzh to add this test case in NET5 SDK P8 and later, but I'll confirm that later today.

Cool, thanks for the info! In that case, I will continue the insertion of 6761 unless you tell me otherwise based on your findings.

@aortiz-msft

I think it'll be nice to not insert just this change.

The reading of Target framework props is a multi part change shared across the 3 of us.
I would be scared to have 1 be merged without the other 3.

So I'd recommend either inserting with the build prior to this chnage, or wait for today and for us to merge the 3 new PRs.

Update: We're going to wait until the 3 PRs are merged in order to proceed with the insertion. We'll check that they do indeed fix the issue at that point.

@v-luzh these changes should be in by now. Do you mind re-testing with the latest dotnet master? (this one's urgent, please)

Specifically, we need to test the following scenario:

  • dotnet master branch
  • NuGet dev branch

You can refer to our debugging guide on how to patch dotnet.exe for testing, and I'm available by email or Teams if you need any help getting all this set up.

@zkat Hi, Kat, the issue still repro on latest VS build tools Master\30412.164 + NuGet Build Tools Vsix Dev\5.8.0.6776, but doesn't repro when do not Install the latest NuGet Build Tools SKU vsix Dev\5.8.0.6776 (skip Installation steps 3).

@zkat Hi, Kat, Verified on VS Build Tools Main\30417.28 + NuGet Build Tools Vsix Dev\5.8.0.6777 today, the issue has been fixed.

Was this page helpful?
0 / 5 - 0 ratings