Setting up defaultRunDotNetScriptReferences
If your migrated PAD flow uses .NET scripts that requires loaded .dll references, in PAD we have to explicitly reference the required assemblies.
Our strong recommendation is to download the standard .NET developer pack directly from Microsoft which includes all .NET assemblies. This will resolve any potential future missing references (For example. Taking screenshots from UiPath)
Steps to follow:
- Download .NET dev pack: https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net472-developer-pack-offline-installer
- This will install .NET assemblies to C:\Program Files (x86)\Reference Assemblies\
- Delete or move System.EnterpriseServices files from assembly folder as PAD is unable to load these files.
- In Init_Variables, set %defaultRunDotNetScriptReferences% to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2
- In Init_Variables, set %defaultRunDotNetScriptImports% to include whatever .NET script imports/namespace your scripts require.
Understanding Blueprint-Generated .NET Scripts
During the UiPath to PAD migration, Blueprint may generate custom .NET scripts to replicate functionality not natively supported in PAD. These scripts are automatically created and inserted into the PAD flow to ensure functional parity with the original UiPath automation.
Why These Scripts Are Created
Some UiPath activities—especially those involving:
- Complex string manipulation
- Advanced data structure handling
- Screenshot or image processing
- Custom logic blocks
...may not have direct equivalents in PAD. In such cases, Blueprint generates a .NET script to bridge the gap.
Script Description Format
Each generated script now includes a description comment at the top, explaining:
- The purpose of the script
- The original UiPath activity it replaces
- Any required input/output variables
Example
1 // Description: This script replicates the behavior of UiPath's "Take Screenshot" activity.
2 // Inputs: windowHandle
3 // Output: imagePath
Best Practices
- Review the script descriptions to understand their role in the flow.
- Ensure all required .NET assemblies are referenced using
%defaultRunDotNetScriptReferences%
. - If needed, customize the script logic to better fit your PAD environment.
Assigned Namespaces per XAML File
Update as of V.8.3: When migrating from UiPath to Power Automate Desktop (PAD), Blueprint now automatically assigns the required .NET namespaces to the %defaultRunDotNetScriptImports%
variable per XAML file.
This enhancement ensures that each migrated XAML file includes only the namespaces it needs, reducing manual configuration and improving script compatibility in PAD.
What You Need to Know:
- You no longer need to manually define all common namespaces globally.
- Each XAML file will have its own tailored
%defaultRunDotNetScriptImports%
value. - This change improves maintainability and reduces the risk of missing imports during execution.
Example:
1 // %defaultRunDotNetScriptImports% =
2 // System,
3 // System.Linq,
4 // System.Collections.Generic
**This value will vary depending on the script content in each XAML file.