Reputation: 1297
In the past I have used the PrintServer class in the System.Printing namespace. How am I able to retrieve the names of the print queues and print to them in .NET 5?
Upvotes: 1
Views: 380
Reputation: 1297
Thanks to Jeroen and Hans for the assist! Here is what my solution was:
"* 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."
I changed the TargetFramework and added the UseWPF elements you see below to my .csproj.
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
Then i was able to use my existing PrintServer and PrintQueuesCollection code
Upvotes: 1