Visual studio 2013 如何从VS2013.NETFramework4.8项目中添加对NetStandard2.0NuGet的引用

Visual studio 2013 如何从VS2013.NETFramework4.8项目中添加对NetStandard2.0NuGet的引用,visual-studio-2013,nuget,nuget-package,csproj,.net-standard-2.0,Visual Studio 2013,Nuget,Nuget Package,Csproj,.net Standard 2.0,我有一个vs 2013项目,目标是.net framework 4.8。我需要添加对Microsoft.Extensions.Hosting nuget软件包的引用,但当我添加时,在软件包管理器控制台上会出现以下错误 Error message: PM> Install-Package Microsoft.Extensions.Hosting -Version 2.2.0 Installing 'Microsoft.Extensions.Hosting 2.2.0'. You are

我有一个vs 2013项目,目标是.net framework 4.8。我需要添加对Microsoft.Extensions.Hosting nuget软件包的引用,但当我添加时,在软件包管理器控制台上会出现以下错误

Error message:

PM> Install-Package Microsoft.Extensions.Hosting -Version 2.2.0

Installing 'Microsoft.Extensions.Hosting 2.2.0'.

You are downloading Microsoft.Extensions.Hosting from Microsoft, the license agreement to which is available at https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.

Successfully installed 'Microsoft.Extensions.Hosting 2.2.0'.

Adding 'Microsoft.Extensions.Hosting 2.2.0' to QuartzExample.

Uninstalling 'Microsoft.Extensions.Hosting 2.2.0'.

Successfully uninstalled 'Microsoft.Extensions.Hosting 2.2.0'.

Install failed. Rolling back...

Install-Package : Could not install package 'Microsoft.Extensions.Hosting 2.2.0'. You are trying to install this package into

a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content

files that are compatible with that framework. For more information, contact the package author.

At line:1 char:1

+ Install-Package Microsoft.Extensions.Hosting -Version 2.2.0

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException

    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
我的项目文件如下所示

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{07E02FE5-9E9B-434D-B6A2-D037DE7CE6CA}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>QuartzExample</RootNamespace>
    <AssemblyName>QuartzExample</AssemblyName>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Quartz, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
      <HintPath>..\packages\Quartz.3.0.7\lib\net452\Quartz.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Quartz.Jobs, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
      <HintPath>..\packages\Quartz.Jobs.3.0.7\lib\net452\Quartz.Jobs.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Quartz.Plugins, Version=3.0.7.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
      <HintPath>..\packages\Quartz.Plugins.3.0.7\lib\net452\Quartz.Plugins.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Runtime.Remoting" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="MyJob.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="quartz_jobs.xml">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

调试
任意CPU
{07E02FE5-9E9B-434D-B6A2-D037DE7CE6CA}
Exe
性质
四次采样
四次采样
v4.8
512
符合事实的
任意CPU
符合事实的
满的
错误的
bin\Debug\
调试;查出
促使
4.
任意CPU
pdbonly
符合事实的
bin\Release\
查出
促使
4.
..\packages\Quartz.3.0.7\lib\net452\Quartz.dll
符合事实的
..\packages\Quartz.Jobs.3.0.7\lib\net452\Quartz.Jobs.dll
符合事实的
..\packages\Quartz.Plugins.3.0.7\lib\net452\Quartz.Plugins.dll
符合事实的
设计师
总是
我的App.Config如下

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>

  <startup> 
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
  </startup>

  <quartz>    
    <add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz.Plugins" />
    <add key="quartz.plugin.xml.fileNames" value="~/quartz_jobs.xml" />
  </quartz>
</configuration>


如果不更新Visual Studio 2013,我是否可以添加对.netstandard2 nuget(如Microsoft.Extensions.Hosting)的引用?

您不能。VS2013有一个古老版本的NuGet,它对.NET标准一无所知,因此不知道.NET标准2.0是否与.NET Framework 4.8兼容

如果你真的无法升级到更新的Visual Studio,也许你可以研究一下.NET内核。VisualStudio代码是一个很小的安装,提供了很好的.NET开发体验,否则任何文本编辑器都可以,如果不能使用支持Omnisharp的东西,就会失去intellisense