将.NET核心库(DNXCore50)从VS 2015迁移到VS 2017时出现此错误。
框架的参考组件" DNXCore ,版本= v5.0"没找到。
我的项目文件目前如下所示:(在VS 2017迁移向导迁移我的" project.json"到.csproj文件之后)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>An FTP and FTPS library for .NET, optimized for speed. Provides extensive FTP commands, file uploads/downloads, SSL/TLS connections and FTP proxies.</Description>
<VersionPrefix>16.3.0</VersionPrefix>
<Authors>J.P. Trosclair;Harsh Gupta</Authors>
<TargetFrameworks>netstandard1.6;dnxcore50</TargetFrameworks>
<DefineConstants>$(DefineConstants);CORE</DefineConstants>
<RootNamespace>FluentFTP</RootNamespace>
<AssemblyName>FluentFTP</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>FluentFTP</PackageId>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<TargetFrameworkIdentifier>DNXCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO" Version="4.3.0.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0.0" />
<PackageReference Include="System.Net.Sockets" Version="4.3.0.0" />
<PackageReference Include="System.Net.Security" Version="4.3.0.0" />
</ItemGroup>
</Project>
我编译时遇到上述错误。我尝试过的事情:
我应该使用什么代替DNXCore 5.0?我需要最新的API,如TlsStream
和Uri
,不存在的东西或有没有办法强制编译器编译?请注意,当我使用VS 2015进行编译时,这是一个工作库。现在我已经切换到VS 2017了,我再也无法编译我的项目了!在.NET Core或.NET Portable中。
答案 0 :(得分:1)
dnxcore50
不再用作TargetFramework。您可以看到1.1.0 documentation for netstandard将其列为已弃用的名字对象。
有关最新的.NET标准文档,请参阅.NET Standard FAQ。
你可以完全放弃第二个TFM。 netstandard1.6
可以正常使用.NET Core。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>An FTP and FTPS library for .NET, optimized for speed. Provides extensive FTP commands, file uploads/downloads, SSL/TLS connections and FTP proxies.</Description>
<VersionPrefix>16.3.0</VersionPrefix>
<Authors>J.P. Trosclair;Harsh Gupta</Authors>
<TargetFramework>netstandard1.6</TargetFramework>
<DefineConstants>$(DefineConstants);CORE</DefineConstants>
<RootNamespace>FluentFTP</RootNamespace>
<AssemblyName>FluentFTP</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>FluentFTP</PackageId>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO" Version="4.3.0.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0.0" />
<PackageReference Include="System.Net.Sockets" Version="4.3.0.0" />
<PackageReference Include="System.Net.Security" Version="4.3.0.0" />
</ItemGroup>
</Project>
我还删除了设置TargetFrameworkIdentifier
和TargetFrameworkVersion
,因为这些属性是从TargetFramework
推断出来的。
答案 1 :(得分:0)
嗯,这太令人惊讶了!
我的lib已成功编译 .NETStandard v1.6 !
在此处包含我的XML,以防其他人遇到此问题:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>An FTP and FTPS library for .NET, optimized for speed. Provides extensive FTP commands, file uploads/downloads, SSL/TLS connections and FTP proxies.</Description>
<VersionPrefix>16.3.0</VersionPrefix>
<Authors>J.P. Trosclair;Harsh Gupta</Authors>
<TargetFrameworks>netstandard1.6;dnxcore50</TargetFrameworks>
<DefineConstants>$(DefineConstants);CORE</DefineConstants>
<RootNamespace>FluentFTP</RootNamespace>
<AssemblyName>FluentFTP</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>FluentFTP</PackageId>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.6</TargetFrameworkVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO" Version="4.3.0.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0.0" />
<PackageReference Include="System.Net.Sockets" Version="4.3.0.0" />
<PackageReference Include="System.Net.Security" Version="4.3.0.0" />
</ItemGroup>
</Project>