0

將.NET核心庫(DNXCore50)從VS 2015遷移到VS 2017時遇到此錯誤。.NET核心 - 未找到框架「DNXCore,Version = v5.0」的參考程序集

爲框架的參考組件「DNXCore,版本= 5.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> 

,我發現了上述的錯誤時,我編譯。事情我已經嘗試:

  • 使用.NETPortable V5.0代替。這裏缺少太多的課程。
  • 使用.NETCoreApp V1.0代替。每班都缺課。我使用了錯誤的版本嗎?
  • 使用DNXCore。沒有缺課。 VS只有一個錯誤。

我應該使用,而不是DNXCore 5.0是什麼?我需要最新的API,如TlsStreamUri,東西不存在或有沒有辦法強制編譯器編譯?請注意,當我使用VS 2015進行編譯時,這是一個工作庫。現在我已經切換到VS 2017,我無法編譯我的項目了!在.NET Core或.NET Portable中。

+0

通常一個套接字相關庫應該只需要1.3。我不知道爲什麼你的1.6是必需的。 –

回答

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> 
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> 

我也刪除設置TargetFrameworkIdentifierTargetFrameworkVersion因爲這些屬性從TargetFramework推斷。

相關問題