Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuget doesn't restore a net461 project failing the build #4280

Closed
dasMulli opened this issue Jan 13, 2017 · 2 comments
Closed

Nuget doesn't restore a net461 project failing the build #4280

dasMulli opened this issue Jan 13, 2017 · 2 comments

Comments

@dasMulli
Copy link

Using dotnet cli 1.0.0-preview5-004478.
Create a csproj with the following content:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
  </PropertyGroup>
</Project>

Try to build:

>dotnet restore
  Nothing to do. None of the projects specified contain packages to restore.
>dotnet build
Microsoft (R) Build Engine version 15.1.509.30326
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\1.0.0-preview5-004478\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(113,5): error : Assets file 'C:\Users\martin.ullrich\Downloads\TmpProj\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Users\martin.ullrich\Downloads\TmpProj\TmpProj.csproj]

Workaround:
Change TargetFramework to TargetFrameworks => restore will produce an assets file.

dotnet --info:

>dotnet --info
.NET Command Line Tools (1.0.0-preview5-004478)

Product Information:
 Version:            1.0.0-preview5-004478
 Commit SHA-1 hash:  4d3e2872fe

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0-preview5-004478

cc @emgarten @rrelyea (don't know better..)

@dasMulli
Copy link
Author

Seems to work with 1.0.0-rc3-004479 if you know where to get it from at the moment 😁

@emgarten
Copy link
Member

@dasMulli add this property to your project file:

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

It will be set automatically by the SDK, but you may have the updated nuget.targets without the latest SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants