error NETSDK1004: Assets file '...\project.assets.json' not found. Run a NuGet package restore to generate this file

hugo934753's Avatar

hugo934753

22 Sep, 2018 12:39 PM

Hello,

so basically I started one of my first open source projects and wanted to try out a free version of appveyor for the first tme.

https://ci.appveyor.com/project/janniksam/kinoheld

Unfortunately it directly hit me with the error you can see here:
error NETSDK1004: Assets file '...\project.assets.json' not found. Run a NuGet package restore to generate this file

My project targets .NET standard 2.0, the test project targets .NET Core 2.1.

I tried "nuget restore" as an before-build-script, but it is giving me the following error, which makes sense to me:
The folder 'C:\projects\kinoheld' does not contain an msbuild solution or packages.config file to restore

I would expect, my Visual Studio 2017 enviroment would automatically restore nuget packages during build, but it doesn't do that.
What do I need to do?

Please have mercy with me, I have never done anything related to CI besides VNext Builds.

  1. Support Staff 1 Posted by Owen McDonnell on 22 Sep, 2018 09:52 PM

    Owen McDonnell's Avatar

    I believe nuget restore only checks current directory and since you are running it from a directory without a .sln file it fails.

    Try running

      - nuget restore ./Kinoheld.Api.Client/Kinoheld.Api.Client.sln
    
  2. 2 Posted by hugo934753 on 22 Sep, 2018 10:30 PM

    hugo934753's Avatar

    Thanks you, that works. It also works with "dotnet restore ......"
    Will this be obsolete in the near future? It's a bit uncomfortable to do that everytime you add a solution.

    I don't mind this, because I will be only doing one or two solutions. But when it comes to bigger projects with alot of solutions, it might be a bit annoying.... :)

    Edit:\\

    Another small question: Is the automatic nuget package building with a nuspec also problematic with .NET standard / core? I think I set up everything like it should be, my nuspec is at the root of the project and is named exactly like the csproj-file, but it still isn't generating a nuget package, although I checked "Package NuGet projects". :(

    Edit 2:\\
    So, I dont know what changed, but its working now :)

  3. Support Staff 3 Posted by Owen McDonnell on 24 Sep, 2018 06:43 AM

    Owen McDonnell's Avatar

    For larger projects with multiple solutions you could always add the same repo as multiple projects in AppVeyor if that seems less "annoying" to you.

    Alternatively, you could enable Visual Studio nuget restore

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac