Skip to content

NuGet errors when compiling on command line with UWP projects and PackageReferences #4515

Closed

Description

@twsouthwick

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): msbuild

NuGet version (x.x.x.xxx): 4.0 (msbuild v 15.1.523.56541)

VS version (if appropriate): 26127.3

OS version (i.e. win10 v1607 (14393.321)): 14393.693

Worked before? If so, with which NuGet version: No

Detailed repro steps so we can see the same problem

I've switched my UWP project to use PackageReferences which now support UWP projects. However, I find that it loads fine and compiles as expected in VS. When I try to compile on command line, it fails with the following errors:

[path]\KeePassWin\KeePassWin.sln" (restore;build target) (1) ->
"[path]\KeePassWin\test\KeePassLib.Test\KeePassLib.Test.csproj" (default target) (3:5) ->
(ResolveNuGetPackageAssets target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(19
7,5): error : The project.json is referencing the project [path]\KeePassWin\test\src\KeePass
Lib\KeePass.Models.csproj', but an output path was not specified on an item in the ProjectReferencesCreatingPackages pr
operty. [[path]\KeePassWin\test\KeePassLib.Test\KeePassLib.Test.csproj]

"[path]\KeePassWin\KeePassWin.sln" (restore;build target) (1) ->
"[path]\KeePassWin\src\KeePass.Win.Services\KeePass.Win.Services.csproj" (default target) (4:
5) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(19
7,5): error : Your project is not referencing the "UAP,Version=v10.0.10586" framework. Add a reference to "UAP,Version=
v10.0.10586" in the "frameworks" section of your project.json, and then re-run NuGet restore. 

I don't have any project.json files anymore in this project and I'm targeting the 14393 SDK not the 10586 so I'm confused why that's even showing up. Here's a link to the project in case it helps: https://github.com/twsouthwick/KeepassWin

Activity

  1. emgarten commented on Feb 6, 2017

    @emgarten
    Member

    @twsouthwick does it make a difference if you restore with Visual Studio vs the command line?

  2. twsouthwick commented on Feb 6, 2017

    @twsouthwick
    Author

    If I restore with msbuild /t:restore I see the same error in VS. If I clean my repo and build straight from VS, things restore fine and compile as expected.

  3. emgarten commented on Feb 6, 2017

    @emgarten
    Member

    @twsouthwick can you diff the project.assets.json files between the command line restore and the Visual Studio output from restore? Is there any difference?

  4. twsouthwick commented on Feb 7, 2017

    @twsouthwick
    Author

    Hmmm... I'm now getting a different error. I just upgraded to 26205 d15rel and am seeing the following:

    • I see this error when restoring from commandline
    • If I clear the repo and have VS restore, then no project.asset.json files are created
  5. emgarten commented on Feb 7, 2017

    @emgarten
    Member

    @twsouthwick try right clicking on the solution and selecting Restore NuGet Packages. Also make sure you have automatic package restore enabled under the Visual Studio NuGet options.

  6. twsouthwick commented on Feb 7, 2017

    @twsouthwick
    Author

    Ok - that seemed to work once I selected automatc package restore enabled; if that was disabled and I right click on the solution and select Restore NuGet packages, it does not work.

    I've created a repo here that has the project.assets.json files: https://github.com/twsouthwick/NugetRestoreUwp. The first commit is adding the files from VS, the second commit is when I just restore from the commandline. It seems like it has different versions of the UWP SDK, but the order also seems off, so I'm not sure what's important there.

    You'll notice that there is no change to KeePassWin (which is the UWP app and cannot be compiled for Any CPU. When I try msbuild /t:restore /p:Platform=x86 I get the following error:

      C:\Program Files (x86)\Microsoft Visual Studio\2017\Internal\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targe
    ts(97,5): error : Sequence contains more than one matching element [(path)\KeePass
    Win.sln]
    
  7. emgarten commented on Feb 7, 2017

    @emgarten
    Member

    I tried this on VS 15.0.0-RC4+26205.0.d15rel and was unable to repro it using the develop branch.

    Restore and build from the command line showed no errors. Restore and build in VS were also without errors.

    msbuild /t:restore /p:Platform=x86 does cause an error for me, it looks that is the same issue as #4316

  8. twsouthwick commented on Feb 7, 2017

    @twsouthwick
    Author

    Which command are you using that works? I'm running msbuild /t:restore;build

    That linked issue is one I filed earlier for a different project - hadn't realized they were similar :)

  9. emgarten commented on Feb 7, 2017

    @emgarten
    Member

    I'm able to repro it now. It isn't clear what the build task is expecting there.

    To get the repro on the command line a clean is needed before building. On a rebuild it showed up.

  10. added this to the 4.0 RTM milestone on Feb 13, 2017
  11. rrelyea commented on Feb 13, 2017

    @rrelyea
    Contributor

    @emgarten - thoughts on this?

  12. emgarten commented on Feb 13, 2017

    @emgarten
    Member

    @rrelyea this issue is similar to #4532 which @zhili1208 was investigating. There are no .xproj files in this solution however.

  13. modified the milestones: , 4.0 RTM on Feb 13, 2017
  14. martinsuchan commented on Jul 31, 2017

    @martinsuchan

    What is status of this issue? It's almost August 2017 and I just hit this issue when building our UWP app in PowerShell:. We use PackageReferences and use TargetVersion 15063 and MinVersion 14393.
    msbuild version '15.1.1012.6693', NuGet Version: 4.0.0.2283

    Update, it's failing with NuGet 4.0.0 but working with 4.1.0.

  15. emgarten commented on Jul 31, 2017

    @emgarten
    Member

    Thanks for the update @martinsuchan, it looks like this can be closed as it was fixed with #4532 in 4.1.0

  16. barishamil commented on Aug 23, 2017

    @barishamil

    Having this problem after updating to creators edition then reverting changes via version control

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions