How to use Linqpad with TFM net5.0-windows10.0.19041.0
I originally had a .NET Core 3.1 console application using the <PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
. After upgrading to .NET 5, I no longer can reference this NuGet package and these packages are not going to be needed going forward and I can pull them in directly by changing the TFM
from standard net5.0
to net5.0-windows10.0.19041.0
. This worked for me in Visual Studio 2019 and the application now compiles and I can access the library correctly. However I now have a bug and really would like to ability to reproduce and use LinqPad as I did previously however now it seems that is not possible because inside LinqPad, I cannot change the <TargetFramework
> as I do in the .csproj
with <TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
.
Will this be something added later on, or does anyone know a way I can do this?
Comments
Have you tried adding a NuGet package reference to Microsoft.Windows.SDK.NET.Ref?
Hi Joe, I tried this and it works. Thank you!
I missed out the targeting pack, since its not needed with the TFM method. This is awesome.
Hello,
I'm trying to do an example using windows 10 toasts based on https://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/send-local-toast?tabs=uwp and I added the Microsoft.Windows.SDK.NET.Ref Nuget package but the editor won't show me the "Show" method as it should if the project were set to net5.0-windows10.0.17763.0.
Any idea how I could set the TFM via code? And if I were to set it via code, I don't think it would allow the editor to show the hidden method.
I also tried using dynamic to invoke it like that, still wouldn't work.
Thanks,
Vlad V.
Looks like LINQPad needs to include the patch number in the NuGet TFM (right now it's net5.0-windows10 rather than net5.0-windows10.0.yourCurrentWindowsPatch)
I'll get this into the next LINQPad 6 beta update, which will be available in a few days.