简体   繁体   中英

VS 2017 and .net core 1.1 can't install Nuget package for logging

Just had a chance to install VS2017 today because I needed logging for my azure app service with .net core 1.1.

Unfortunately I can't install the Nuget Microsoft.Extensions.Logging.AzureAppServices. It gives me errors. Here are some of the errors in the output window:

Package Microsoft.Data.OData 5.6.4 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Data.OData 5.6.4 supports: - net40 (.NETFramework,Version=v4.0) - portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - sl4 (Silverlight,Version=v4.0)

I really need to be able to use ILogger to somehow save errors the app is encountering. I figured this would be best, but if anyone has any other ideas as well that are somewhat easy to configure I am open to them.

Also I've been asked to include the content of my .csproj file so here goes:

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
  <TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
  <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
  <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>

</Project>

Thanks!

James

OK, I figured this out. This isn't in the MS documentation yet (that I can see) but it appears that the Microsoft.Extensions.Logging.AzureAppServices is not ready for .NET core yet. If you include the "pre-releases" of nuget packages in your search you will see one that is a newer version that only targets .NET Standard. I installed this package successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM