VS 2017 .NET Core BinaryFormatter [英] VS 2017 .NET Core BinaryFormatter

查看:102
本文介绍了VS 2017 .NET Core BinaryFormatter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET Core工具BinaryFormatter中是否包含VS 2017?创建.NET Core控制台应用程序时,找不到BinaryFormatter。有很多Nuget软件包,但是哪一个是使用.NET Core可以运行的BinaryFormatter的正确软件包?

Is with VS 2017 released in the .NET Core tools BinaryFormatter included? When I create a .NET Core console application I cannot find BinaryFormatter. There are many Nuget packages but which one is the right one to get a working BinaryFormatter with .NET Core?

用已发布的Visual Studio创建一个无法编译的项目有点尴尬。我需要启动.NET Core控制台应用程序所在的cmd shell并进行

By the way it is a bit awkward to create with a released Visual Studio a project which does not compile. I need to start a cmd shell where my .NET Core console application resides and do a

dotnet restore

进行编译。我在参考菜单中错过了VS命令吗?

to get it to compile. Did I miss a VS command in the references menu?

Edit1

使用 Install-Package BinaryFormatter 给了我一个例外

PM> Install-Package BinaryFormatter
Restoring packages for d:\source\vc17\NetCoreApp\ConsoleApp1\ConsoleApp2\ConsoleApp2.csproj...
Install-Package : Package BinaryFormatter 1.0.2 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package BinaryFormatter 1.0.2 supports:
  - dnx451 (DNX,Version=v4.5.1)
  - dnxcore50 (DNXCore,Version=v5.0)
At line:1 char:1
+ Install-Package BinaryFormatter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : One or more packages are incompatible with .NETCoreApp,Version=v1.1.
At line:1 char:1
+ Install-Package BinaryFormatter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package restore failed. Rolling back package changes for 'ConsoleApp2'.
At line:1 char:1
+ Install-Package BinaryFormatter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


推荐答案

编辑

感谢@ClockEndGooner指出,使用.Net-Core 2.1或更高版本的人员中有一个二进制格式化程序,位于:

Thanks to @ClockEndGooner for pointing out, that People who are using .Net-Core 2.1 or later there is a Binary Formatter Located in:

System.Runtime.Serialization.Formatters.Binary

这里是一个nuget包,它说它也支持core:

Here is a nuget package for that it says it supports core as well:

Install-Package BinaryFormatter

我不是确保它是否包含您所需的内容,但也包含System.Runtime.Serialization.Formatters

I'm not sure if this contains what you need but is also the System.Runtime.Serialization.Formatters

Install-Package System.Runtime.Serialization.Formatters

这些软件包与.Net-Core 1.0配合使用,以便它们在1.1环境下运行,您需要交叉通信,您可以参考此核心问题

These packages work with .Net-Core 1.0 in order for them to work with a 1.1 enviroment you will require cross comiplation you can reference this Core Issue

这篇关于VS 2017 .NET Core BinaryFormatter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆