虽然我可以在命令行上使用Mono编译WinForms应用程序,但在Rider中这是不可能的.

没有可用的解决方案/项目模板也没关系,也没有设计器,这并不重要.但我自己编写代码时甚至不能使用System.Windows.Forms.

有什么方法可以告诉Rider使用已安装的WinForms库吗?

我try 构建的简单代码如下:

using System.Windows.Forms;

public class Program
{
    [STAThread]
    public static void Main()
    {
    }
}

构建输出(来自Rider):

Build with surface heuristics started at 22:13:46
Use build tool: /home/arrow/.dotnet/sdk/7.0.100/MSBuild.dll
CONSOLE: MSBuild version 17.4.0+18d5aef85 for .NET
CONSOLE: Build started 2/9/2024 10:13:46PM.
CONSOLE: Project "/tmp/JetBrainsPerUserTemp-1000-1/Sytivel.proj" on node 1 (default targets).
CONSOLE: ControllerTarget:
CONSOLE:   Run controller from /home/arrow/.local/share/JetBrains/Toolbox/apps/rider/lib/ReSharperHost/JetBrains.Platform.MsBuildTask.v17.dll
0>------- Started building project: ConsoleApp2
/home/arrow/.dotnet/dotnet exec "/home/arrow/.dotnet/sdk/7.0.100/Roslyn/bincore/csc.dll" /noconfig /unsafe- /checked- /nowarn:1701,1702,IL2121,1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:7 /define:TRACE;DEBUG;NET;NET7_0;NETCOREAPP;NET5_0_OR_GREATER;NET6_0_OR_GREATER;NET7_0_OR_GREATER;NETCOREAPP1_0_OR_GREATER;NETCOREAPP1_1_OR_GREATER;NETCOREAPP2_0_OR_GREATER;NETCOREAPP2_1_OR_GREATER;NETCOREAPP2_2_OR_GREATER;NETCOREAPP3_0_OR_GREATER;NETCOREAPP3_1_OR_GREATER /highentropyva+ /nullable:enable /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/Microsoft.CSharp.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/Microsoft.VisualBasic.Core.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/Microsoft.VisualBasic.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/Microsoft.Win32.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/Microsoft.Win32.Registry.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/mscorlib.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/netstandard.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.AppContext.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Buffers.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Collections.Concurrent.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Collections.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Collections.Immutable.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Collections.NonGeneric.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Collections.Specialized.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.Annotations.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.DataAnnotations.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.EventBasedAsync.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ComponentModel.TypeConverter.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Configuration.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Console.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Core.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Data.Common.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Data.DataSetExtensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Data.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.Contracts.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.Debug.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.DiagnosticSource.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.FileVersionInfo.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.Process.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.StackTrace.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.TextWriterTraceListener.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.Tools.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.TraceSource.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Diagnostics.Tracing.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Drawing.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Drawing.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Dynamic.Runtime.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Formats.Asn1.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Formats.Tar.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Globalization.Calendars.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Globalization.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Globalization.Extensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Compression.Brotli.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Compression.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Compression.FileSystem.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Compression.ZipFile.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.FileSystem.AccessControl.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.FileSystem.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.FileSystem.DriveInfo.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.FileSystem.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.FileSystem.Watcher.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.IsolatedStorage.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.MemoryMappedFiles.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Pipes.AccessControl.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.Pipes.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.IO.UnmanagedMemoryStream.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Linq.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Linq.Expressions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Linq.Parallel.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Linq.Queryable.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Memory.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Http.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Http.Json.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.HttpListener.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Mail.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.NameResolution.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.NetworkInformation.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Ping.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Quic.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Requests.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Security.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.ServicePoint.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.Sockets.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.WebClient.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.WebHeaderCollection.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.WebProxy.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.WebSockets.Client.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Net.WebSockets.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Numerics.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Numerics.Vectors.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ObjectModel.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.DispatchProxy.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Emit.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Emit.ILGeneration.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Emit.Lightweight.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Extensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Metadata.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Reflection.TypeExtensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Resources.Reader.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Resources.ResourceManager.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Resources.Writer.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.CompilerServices.Unsafe.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.CompilerServices.VisualC.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Extensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Handles.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.InteropServices.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.InteropServices.JavaScript.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.InteropServices.RuntimeInformation.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Intrinsics.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Loader.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Numerics.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Serialization.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Serialization.Formatters.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Serialization.Json.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Serialization.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Runtime.Serialization.Xml.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.AccessControl.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Claims.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.算法rithms.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.Cng.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.Csp.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.Encoding.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.OpenSsl.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.Primitives.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Cryptography.X509Certificates.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Principal.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.Principal.Windows.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Security.SecureString.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ServiceModel.Web.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ServiceProcess.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.Encoding.CodePages.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.Encoding.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.Encoding.Extensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.Encodings.Web.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.Json.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Text.RegularExpressions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Channels.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Overlapped.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Tasks.Dataflow.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Tasks.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Tasks.Extensions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Tasks.Parallel.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Thread.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.ThreadPool.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Threading.Timer.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Transactions.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Transactions.Local.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.ValueTuple.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Web.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Web.HttpUtility.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Windows.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.Linq.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.ReaderWriter.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.Serialization.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.XDocument.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.XmlDocument.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.XmlSerializer.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.XPath.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/System.Xml.XPath.XDocument.dll /reference:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/ref/net7.0/WindowsBase.dll /debug+ /debug:portable /filealign:512 /optimize- /out:obj/Debug/net7.0/ConsoleApp2.dll /refout:obj/Debug/net7.0/refint/ConsoleApp2.dll /target:exe /warnaserror- /utf8output /deterministic+ /langversion:11.0 /analyzerconfig:obj/Debug/net7.0/ConsoleApp2.GeneratedMSBuildEditorConfig.editorconfig /analyzer:/home/arrow/.dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll /analyzer:/home/arrow/.dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll /analyzer:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll /analyzer:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll /analyzer:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll /analyzer:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll /analyzer:/home/arrow/.dotnet/packs/Microsoft.NETCore.App.Ref/7.0.0/analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll Program.cs obj/Debug/net7.0/ConsoleApp2.GlobalUsings.g.cs "obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs" obj/Debug/net7.0/ConsoleApp2.AssemblyInfo.cs /warnaserror+:NU1605,SYSLIB0011
0>Program.cs(1,22): Error CS0234 : The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
0>------- Finished building project: ConsoleApp2. Succeeded: False. Errors: 1. Warnings: 0
Build completed in 00:00:01.533

And Rider itself doesn't recognize it either: Rider not recognizing System.Windows.Form

推荐答案

我是这样让它工作的:

  1. 创建新的.NET/.NET核心控制台项目.将所有内容保留为默认设置
  2. 进入项目属性(右击项目,而不是解决方案,然后 Select 属性)
  3. 对于"目标框架", Select 三个点,net7.0,然后 Select net4.8
  4. 返回到项目属性,将语言版本至少设置为C#10.0
  5. Dependencies上单击鼠标右键并 Select Reference....添加所需的部件(如System.Windows.Form).还要添加System.Net.Http(从项目模板自动生成的文件需要)
  6. 构建并运行您的WinForm应用程序!

Csharp相关问答推荐

如何从顶部提取发票号作为单词发票后的第一个匹配

注册通用工厂的C# Dep注入

MongoDB将JS查询转换为C#的问题

图形API基于appid列表检索多个应用程序

在C#中使用类中的对象值

(乌龙)1&#比c#中的UL&#慢吗?

具有单一导航属性的EF核心一对多关系

Quartz调度程序不调用作业(job)类

System.Net.Http.HttpClient.SendAsync(request)在docker容器内的POST方法30秒后停止

TeamsBot SendActivityActivityTypes与ActivityTypes同步.键入不再起作用

.NET:从XPath定位原始XML文档中的 node

System.NotSupportdException:流不支持读取

发布.NET 8 Blazor WebAssembly独立应用程序以进行静态站点部署

错误:此版本的Visual Studio无法打开以下项目

SharpZipLib在文件名前加上目录名,生成tar.gz

如何在更新数据库实体时忽略特定字段?

客户端/服务器RPC如何处理全局变量?

Unity 3D-意外轴捕捉和未知力对脉冲react 行为的影响

ASP.NET Core 7空字符串

现在是否有一个.NET SDK等效于AsyncEx的AsyncLock?