Migrating User Interfaces to .NET Core

Consider the following when migrating custom user interfaces to .NET Core:

  1. Ensure that your custom UI applications work correctly on high-DPI monitors by making them DPI-unaware. Follow the below methods to disable DPI awareness for your UI in different programming languages:
    • For custom UIs developed in C#, make your application DPI-unaware by calling the Application.SetHighDpiMode method with the HighDpiMode.DpiUnaware parameter before running the application in your main method, like in the following example:
      [STAThread] 
      
      private static void Main(string[] args) 
      
      { 
      	// Set the application to be DPI-unaware 
      
      	Application.SetHighDpiMode(HighDpiMode.DpiUnaware); 
      
      	// Your application initialization code here 
      
      } 
    • For custom UIs created with other programming languages, you can make them DPI-unaware by setting the dpiAware flag to False in the application’s manifest file.
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware> 
  2. Update the .csproj file or the runtime configuration file for your custom user interface to depend on Microsoft.NETCore.App, Microsoft.WindowsDesktop.App, and Microsoft.AspNetCore.App. You can use the below format to include dependencies on these .NET runtimes.
    <ItemGroup>
    <FrameworkReference 
    	Include="Microsoft.WindowsDesktop.App" /> 
    <FrameworkReference 
    	Include="Microsoft.AspNetCore.App" />
    </ItemGroup> 
  3. If you want to run LabVIEW with .NET in your custom UI, create a token file named <ApplicationName>.ini next to your application which includes the following content:
    [LVRT] 
    
    DisableDotNetFrameworkSupport=True 
    Note This file must be created for any TestStand application that uses LabVIEW.
  4. For .NET applications, set the EnableUnsafeBinaryFormatterSerialization property to true in the .csproj file.
    <PropertyGroup>
    	<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
    </PropertyGroup>