C# 在.Net Core中添加System.Windows.forms的引用

C# 在.Net Core中添加System.Windows.forms的引用,c#,asp.net,.net,.net-core,C#,Asp.net,.net,.net Core,我想在.resx文件中写入。我使用过ResXResourceWriter,它在Windows窗体中运行良好,但在.Net核心应用程序中不可用。它需要system.Windows.Forms,但.net core不引用它 ResXResourceWriter resx=新的ResXResourceWriter(hostingEnvironment.WebRootPath+“\Localization\LabelResource.EN.resx”)您当前需要使用,因为System.Windows.F

我想在.resx文件中写入。我使用过ResXResourceWriter,它在Windows窗体中运行良好,但在.Net核心应用程序中不可用。它需要system.Windows.Forms,但.net core不引用它


ResXResourceWriter resx=新的ResXResourceWriter(hostingEnvironment.WebRootPath+“\Localization\LabelResource.EN.resx”)

您当前需要使用,因为System.Windows.Forms是.Net Core 3.0中新增的。从:

您可以使用dotnet new命令创建新的WinForms应用程序, 使用以下命令:

dotnet new winforms -o MyWinFormsApp
cd MyWinFormsApp
dotnet run

如果您已经安装了.net Core 3.0(或更高版本),并且希望添加对现有项目(.csproj)的引用

您只能添加以下标记:

true
进入以下部分:

我认为它是新的:Visual Studio中项目上下文菜单中的“编辑项目文件”菜单。

与此类似(添加到WPF项目中):


netcoreapp3.1
符合事实的
符合事实的

您的问题是什么?System.Windows.Forms在.net core中不存在。如果您正在寻找本地化,请参阅我实际上希望将数据库数据转储到.resx文件中。在.net core中可能吗?ResXResourceWriter类在.net core中不可用,要创建一个您需要使用.net Framework的类,请告诉我该过程吗?不确定您所说的是什么过程,如果您想了解编写资源文件,请看,我想我没有把我的问题讲清楚。实际上,它是一个基于.net核心MVC的网站,基于您问题中的注释,.resx文件只是XML文件。您应该能够使用XDocument打开和更改它们。
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>   
    <UseWindowsForms>true</UseWindowsForms>   
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\GeneralCore\GeneralCore.csproj" />   </ItemGroup>

</Project>