[英]net5.0-windows: warning CA1416: 'RegistryValueKind.DWord' is supported on 'windows'
The target framework of my project is set to net5.0-windows
.我项目的目标框架设置为net5.0-windows
。
A C# file contains a call to Microsoft.Win32.Registry.SetValue()
which gives me the following warning: C# 文件包含对Microsoft.Win32.Registry.SetValue()
的调用,这给了我以下警告:
warning CA1416: 'Registry.SetValue(string, string?, object, RegistryValueKind)' is supported on 'windows'
Why do I get this warning if my project is set to net5.0-windows
?如果我的项目设置为net5.0-windows
,为什么会收到此警告?
Update: What is the proper way to handle error CA1416 for .NET core builds?更新: 为 .NET 核心构建处理错误 CA1416 的正确方法是什么? as pointed out by pavel-anikhouski does not fix the problem.正如pavel-anikhouski 所指出的那样并不能解决问题。
My issue arises because I use a shared AssemblyInfo.cs file in my project and have <GenerateAssemblyInfo>
set to false
.出现我的问题是因为我在项目中使用了共享的 AssemblyInfo.cs 文件并将<GenerateAssemblyInfo>
设置为false
。
Adding the following line to AssemblyInfo.cs fixes the issue:将以下行添加到 AssemblyInfo.cs 可解决此问题:
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows")]
The issue and workaround at GitHub: https://github.com/dotnet/sdk/issues/14502 GitHub 的问题和解决方法: https://github.com/dotnet/sdk/issues/14502
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.