Reputation: 57
I've been getting frustrated with dependency problems since upgrading to Fall Creators, so I started with a fresh Windows 10 1709 image on my computer from our IT department, reinstalled Visual Studio 2017 from scratch with the UWP workload and the 16299 SDK. I made a blank UWP app, opened the Package Manager Console and ran "dotnet restore", and got the following error:
C:\Users\username\source\repos\App1\App1\App1.csproj(137,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.201\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.
I searched my C: drive and found that those files are stored in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\
EDIT:
I should have asked about my original problem instead of the problem I had when trying to fix my problem. I've really confused things here.
My app is a UWP app that uses EF Core, so I have a solution with two projects, just like Microsoft recommends. One is a library with the data models, the other is the UWP app.
When I upgraded to Windows 1803 and Visual Studio 2017, I could no longer compile my app. Visual Studio would give the error The imported project "C:\Program Files\dotnet\sdk\2.1.201\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found
I also couldn't do a migration without errors, which is what precipitated my question here. I thought something was wrong with my .NET Core SDK installation, so I made a blank app to test.
Using your answer here (and this Microsoft document, I determined that even though my data model project worked as a .NET Core Class Library in .NET Core 1.x, it needed to be a .NET Standard Class Library in .NET Core 2.x.
So I can compile my app and do migrations now, but I have to manually edit my .csproj file in between those things, as they don't both work with the same TargetFramework(s) setting. But I will make a separate question about that, because it is unrelated to my stupidity here.
Upvotes: 2
Views: 285
Reputation: 12993
This is normal, because dotnet CLI only supports NETCore projects, It does not support UWP project.json or packages.config projects. Link
If you add a new .NET Core Class Library project to the solution, then run dotnet restore
, it can work as expected.
There is an issue in dotnet
GitHub project which reports exactly the same symptom, and its status is still open.
Did you meant to run NuGet restore
, not dotnet restore
??
Upvotes: 1