Thank you for reaching out. I understand that when publishing your WinForms application as a remote app on Windows Server 2022, the application opens successfully via .RDP file but appears inactive and does not receive focus.
This behavior can occur due to how remote app sessions handle window focus end user interaction differently than full remote desktop session.
Possible cause causes and solution
**1. **Disable “show desktop” at launch
when remote desktop launches, windows may momentarily shift focus away from the published window.
You can force focus to remain on the app window by adjusting RDP settings:
- Open your .rdp file in notepad.
- Add or modify the following line:
Remoteapplicationmode:i:1
Disableremoteappcapscheck:i:1
- Save and relaunch.
**2. **Check group policy and session settings
ensure remote app is allowed to interact with the desktop:
- open local group policy editor on your remote desktop host.
- Navigate to:
computer configuration > administrative templates > windows components > remote desktop services > remote app and desktop connections - Set " do not allow remote app programs to run with a blank taskbar button” to disabled.
- Restart the RDS session host.
**3. **Ensure application is not minimizing or losing focus programmatically
if your WinForms code includes or windows state changes (e.g., Form.Activate(), Focus() calls), The remote app may not honor them correctly. Try setting the form’s startup behavior as:
this.TopMost = true;
this.Activate();
**4. **Verify RDS and remote app configuration
run the following PowerShell command on the Rdp session host:
Get-RDRemoteApp | Select Alias, DisplayName, ShowInWebAccess
Confirm your apps correctly registered. If not, republish it using:
New-RDRemoteAPP -CollectionName “<CollectionName>” -Alias “<AppAlias>” -DisplayName “<AppName>” -FilePath “C:\Path\To\App.exe”
**5. **Try launching in compatibility mode
if the behavior persists, try:
- right click the application executable
- go to properties> compatibility.
- Select run this program as an administrator and disable full screen optimization.
References:
Remote Desktop Services | Microsoft Learn
If after applying these steps the window still opens in an inactive state, please share:
- whether the issue occurs for all users or specific one.
- The WinForms target framework version.
- If the same behavior appears when launching other published apps.
We will use that information to determine if its focus handling in the remote desktop shell or a session isolation issue.
Please let us know if you require any further assistance we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer".