![](/img/trans.png)
[英]Getting the access to the System.Printing namespace in .NET Core Console Application
[英]System.Printing in .NET 5
过去,我在 System.Printing 命名空间中使用了 PrintServer class。 我如何能够检索打印队列的名称并在 .NET 5 中打印到它们?
感谢 Jeroen 和 Hans 的协助:这是我的解决方案:
"* Starting in .NET 5, Windows Forms and Windows Presentation Foundation (WPF) projects should specify the .NET SDK (Microsoft.NET.Sdk) instead of Microsoft.NET.Sdk.WindowsDesktop. For these projects, setting TargetFramework to net5.0- windows and UseWPF or UseWindowsForms to true will automatically import the Windows desktop SDK. If your project targets .NET 5 or later and specifies the Microsoft.NET.Sdk.WindowsDesktop SDK, you'll get build warning NETSDK1137."
我更改了 TargetFramework 并将您在下面看到的 UseWPF 元素添加到 my.csproj。
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
然后我就可以使用我现有的 PrintServer 和 PrintQueuesCollection 代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.