.Net Core 1.1.0 NuGet packages fail to install in

2019-06-16 03:04发布

I'm playing around with a ASPNet.Core 1.1.0 application in Visual Studio Mac Preview and have problems updating/installing NuGet packages.

If I try to update eg. Microsoft.AspNetCore.Diagnostics from 1.0.0 to 1.1.0 it fails the download and removed the package completely. I then have to download and install the package for 1.0.0 again. Same goes for Microsoft.AspNetCore.Server.Kestrel.

Microsoft.EntityFrameworkCore I'm not able to install in any version. Heres the exception output: https://gist.github.com/anonymous/52ceb28b8d9781835b226bcbe9d04d58

I know everything is right out of the oven, but was wondering if other people have experienced the same issues and know of a workaround/solution.

4条回答
戒情不戒烟
2楼-- · 2019-06-16 03:25

Try upgrading your nuget latest version for core 1.1 https://dist.nuget.org/index.html will resolve the issue.

查看更多
叛逆
3楼-- · 2019-06-16 03:29

Try to change *.csproject file manually to

<TargetFramework>netcoreapp1.1</TargetFramework>

UPDATE

@egeek So, finally, I think I found some trick. I tried to add Swashbuckle Nuget package, but it failed. Then, when Visual Studio start to adding Swashbuckle, I click Forece Quit from Visual studio before the operation is complete. In *.csproj I see:

<PackageReference Include="Swashbuckle">
  <Version>6.0.0-beta902</Version>
</PackageReference>

And when I again open Visual studio, click "Restore" on "Packages" folder. Finally it not fail and added Swashbuckle correctly.

查看更多
时光不老,我们不散
4楼-- · 2019-06-16 03:30

I reached out on Twitter and got a response from Mikayla Hutchinson, Xamarin PM at Microsoft. Check out the conversation on Twitter here.

certain NuGet packages fail to restore if they're not already in your local cache - see https://developer.xamarin.com/releases/vs-mac/preview/vs-mac-preview1/#Known_Issues

as a workaround, you can use dotnet restore on the command-line, which will restore and cache them

I hope this helps.

查看更多
对你真心纯属浪费
5楼-- · 2019-06-16 03:31

For everyone else having similar problems, here's a walk-through:

  1. First install .NET Core 1.1.0: https://www.microsoft.com/net/core#macos

  2. The official .NET Core 1.1.0 installer (as of when this is written) includes the .NET Core SDK 1.0.0 Preview 2.

You will need .NET Core SDK 1.0.0 Preview 3. Download it here: https://github.com/dotnet/core/blob/master/release-notes/preview3-download.md

  1. Create a new project in Visual Studio Mac

  2. Close the project

  3. Open up project/src/myapp/myapp.csproj and change "netcoreapp1.0" to "netcoreapp1.1". Save and close the file.

<TargetFramework>netcoreapp1.1</TargetFramework>

  1. Open your solution in Visual Studio Mac and compile it.

Now you will be able to update your NuGet packages to newest versions.

Should you run into problems, do a "dotnet restore" when standing in /project/src/myapp/

查看更多
登录 后发表回答