Sdk: dotnet restore fails with error for UWP project

Created on 25 Feb 2017  路  4Comments  路  Source: dotnet/sdk

Steps to reproduce

  1. Create UWP project.
  2. type dotnet restore in console

Expected behavior

Command finishes successfully or with warning (see below)

Actual behavior

Command finishes with error:

App.csproj(139,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\WindowsXaml\v14.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

If I run from VS 2017 dev console error changes to:

App.csproj(139,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004771)

Product Information:
 Version:            1.0.0-rc4-004771
 Commit SHA-1 hash:  4228198f0e

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-rc4-004771

Cause of the issue is absence of Xaml CSharp targets. I think MSBuild seeks for them during parsing of
csproj on restore.

Same command finishes successfully if I use sdk version 1.0.0-preview2-1-003177.

Most helpful comment

Tooling support for UWP, Xamarin (with Xamarin Forms) would be fantastic. Hope to see it soon.

All 4 comments

Yep, at RTM of 1.0.0 CLI will not support Windows-specific scenarios. It had to during preview2 because there was not direct support for .NET Core in Visual Studio 2015. We may be able to bring in some OS-specific scenarios in the future, but for the time being this is out of scope. Moving to backlog.

Is there other way to restore packages? I.e. With msbuild or something like this. Or maybe somehow explicitly specify msbuild path that cli should use.

You can try restoring with msbuild /t:restore

Tooling support for UWP, Xamarin (with Xamarin Forms) would be fantastic. Hope to see it soon.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gkhanna79 picture gkhanna79  路  3Comments

dasMulli picture dasMulli  路  3Comments

joffreykern picture joffreykern  路  3Comments

davkean picture davkean  路  3Comments

natemcmaster picture natemcmaster  路  3Comments