c# - 在 .Net Core 中添加 System.Windows.forms 的引用
问题描述
我想写在我的 .resx 文件中。我使用了 ResXResourceWriter,它在 Windows 表单中运行良好,但在 .Net Core 应用程序中不可用。它需要 system.Windows.Forms 但 .net 核心不引用它。
ResXResourceWriter resx = new ResXResourceWriter(hostingEnvironment.WebRootPath + "\Localization\LabelResource.EN.resx")
解决方案
如果您已经安装了 .net Core 3.0(或更高版本)并且想要添加对现有项目 (.csproj) 的引用。
您只能添加以下标签:
<UseWindowsForms>true</UseWindowsForms>
进入以下部分: <PropertyGroup>
我认为它是新的:Visual Studio 中项目上下文菜单中的菜单“编辑项目文件”。
像这样(添加到 WPF 项目中):
<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>
推荐阅读
- list - 如何将数据列表保存到flutter dart中的变量
- c# - 如何在带有ms access数据库的ac#windows窗体中添加条件语句?
- javascript - 修改用 Array.fill() 填充的矩阵的值会修改整列
- java - 使用在 Spring Security 5.2.x 的 spring 服务器之外获得的令牌解析 @RegisteredOAuth2AuthorizedClient
- c - 我的 C 表达式必须具有结构或联合类型
- regex - 使用正则表达式提取匹配模式
- php - Laravel 7.3 路由显示空白页没有错误
- c - 分配给非左值 'uxCurrentEventBits' event_groups.c 时出错
- npm - Conda:从 Github 和 pip 安装软件包的最佳方法
- sql - SQL 查询 - 未在下一个预计日期发货的订单