Home: NuGet Restore does not work with TFSO and UWP

Created on 12 Apr 2016  路  11Comments  路  Source: NuGet/Home

If I have UWP projects in the solution and a UWP project has no Debug AnyCPU entry then following error appears when restoring nuget packages using the NuGet Installer on TSFO

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'XXXX.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

[error]Unexpected exit code 1 returned from tool NuGet.exe

Adding a AnyCPU entry for the UWP projects solves the issue but this is not the correct way since AnyCPU is not supported for UWP projects and thus I do not want to have such a configuration

Docs

Most helpful comment

@chrisrpatterson Thank you with proving the link. Its true that NuGet on TFSO is about restoring the packages for the solution.

@yishaigalatzer The problem is the following. Normally a UWP package has following Configurations:

  • DEBUG

    • ARM

    • x86

    • x64

  • RELEASE

    • ARM

    • x86

    • x64

But in order to successful restore packages using the TFSO Nuget Task I have to modify it:

  • DEBUG

    • _Any CPU_

    • ARM

    • x86

    • x64

  • RELEASE

    • ARM

    • x86

    • x64

Solution

I have now investigated the problem. The problem was introduced by me by migrating WP8.1 to UWP. The solution was to edit the .csproj file and change

<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>

to

 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>

for every UWP library.

Now I am able to remove _Any CPU_ from Debug and the solution restore works.

All 11 comments

@xxMUROxx can you give us some more info? I'm not sure what is the NuGet install on TSFO?

Does this work on your local machine and only breaks somewhere else?

Here is the documentation for building a UWP app with VSTS https://msdn.microsoft.com/en-us/library/vs/alm/build/apps/universal. The NuGet Installer task is designed to work against a solution not an individual csproj.

@chrisrpatterson Thank you with proving the link. Its true that NuGet on TFSO is about restoring the packages for the solution.

@yishaigalatzer The problem is the following. Normally a UWP package has following Configurations:

  • DEBUG

    • ARM

    • x86

    • x64

  • RELEASE

    • ARM

    • x86

    • x64

But in order to successful restore packages using the TFSO Nuget Task I have to modify it:

  • DEBUG

    • _Any CPU_

    • ARM

    • x86

    • x64

  • RELEASE

    • ARM

    • x86

    • x64

Solution

I have now investigated the problem. The problem was introduced by me by migrating WP8.1 to UWP. The solution was to edit the .csproj file and change

<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>

to

 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>

for every UWP library.

Now I am able to remove _Any CPU_ from Debug and the solution restore works.

Are you broken on your desktop as well?

No. But if someone follows the docuemnt in Migrate apps to the Universal Windows Platform (UWP) especially point 6g then there are no issue. Therefore it was my error by not correctly following the document

Thanks for clarofying. Is it OK to close the issue?

Yes. Maybe, there is somewhere space in the documentation or issue list for including this kind of issue and solution.

@chrisrpatterson This would probably make more sense to be documented on the TFS https://msdn.microsoft.com/en-us/library/vs/alm/build/apps/universal doc here. Can you help update this?

Guys, sorry for posting here. But I have almost the same question and don't know whether I need to create new question or ask here. The question about restoring packages in the c:/users/userprofile/.nuget/packages folder.
I have 3.4.3.855 version of nuget.exe. I've read that Nuget downloads packages to "c:/users/userprofile/.nuget/packages" folder and after build from Visual Studio it really appears in this folder. But not from my Powershell script. In powershell script I'm using "nuget restore mysln" and it doesn't restore packages to the "UserProfile/.nuget/packages" folder. Currently I'm testing it locally, but in future I need this script because I'll make builds in build-machine. So builds will be created without opening and making rebuild in Visual Studio.
Thanks, Oleg.

This should definitely work, there is probably something small you are missing. Please shoot an email to support @ nuget.org with your script and we will help you analyze

This should definitely work, there is probably something small you are missing. Please shoot an email to support @ nuget.org with your script and we will help you analyze

Was this page helpful?
0 / 5 - 0 ratings