Dotnet核心:将netstandard2.0 classlib添加到netcoreapp2.0 Web服务

时间:2018-08-15 05:03:17

标签: reference .net-core projects-and-solutions

我正在尝试将classlib添加到点网核心Web服务中。

该Web服务具有以下配置mtss-ws.proj文件(即,我可以从ws项目引用classlib项目):

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <VersionPrefix>0.0.3</VersionPrefix>
  </PropertyGroup>

  [...]

  <ItemGroup>
    <ProjectReference Include="..\mtss-ws.pjn\mtss-ws.pjn.csproj" />
  </ItemGroup>

</Project>

这是classlib项目的.csproj文件

<PropertyGroup>
  <TargetFramework>netstandard2.0</TargetFramework>
  <RootNamespace>mtss_ws.pjn</RootNamespace>
</PropertyGroup>

现在,我可以毫无问题地将classlib项目(mtss-ws.pjn)引用添加到Web服务项目(mtss-ws),但是当我尝试对classlib项目执行相同操作时,出现以下错误:

// (running from the folder of the classlib project)
$ ...src/mtss-ws.pjn (develop)
$ dotnet add reference ../mtss-ws/mtss-ws.csproj 
Project `/media/data/sas/devel/apps/dotnet/mtss-ws/src/mtss-ws/mtss-ws.csproj` cannot be added due to incompatible targeted frameworks between the two projects. Please review the project you are trying to add and verify that is compatible with the following targets:
    - netstandard2.0

我只想定义一个具有多个实用程序类的项目,然后从ws-project调用它。

0 个答案:

没有答案