I am building my own custom rules for Workflow Analyzer using this site as basis for my understanding:
I have built several rules that are working just fine, but now I ran in to a wierd problem.
My rules are working fine when I select Build Solution within Visual Studio, that produces 3 .dll files that are copied to the following folder:
C:\Program Files\UiPath\Studio\Rules\net8.0
However after selecting the option to produce a .NuGet package on Build, the rules are not loaded correctly into Studio, after pointing Package Manager to the file. I need the .NuGet file for Marketplace/Package Sources.
Turns out the error lies in how rules are loaded into Workflow Analyzer I presume.
After installing a package containing Workflow Analyzer Rules, I have to Close the project and reopen it, for the rules to display/load in.
@cprima (one of the previous MVPs) has started an initiative for supporting writing WFA Custom rules. We can recommend this resource as a first stop support guide, and for any other development help as well
Indeed Closing and reopening UiPath Studio helps in many situations, since I started to use coded source files I find myself doing that a lot!
Glad that it also solved your challenge.
With WatchfulAnvil I try to deliver a baseline that is known to work. Just this week I added a nupkg with custom rules as a dependency. The full solution project code is out there, for anybody to compare with their own setup.
Just following the GettingStarted instructions should give in 30min a folder that is known to work.
For example the .csproj in this folder
The repository’s wiki is my dump of everything I encountered: If you filter the Pages for “KB PS” (abbreviation for knowledgebase problem-solution) there I have documented all obstacles that I encountered, like
One feature of WacthfulAnvil: If you forked it, then the GitHub actions should also build dll and nupkg for you! IIRC only the 4th action “publish to myget” needs a secret and will fail.
So far I did not get feedback on the repo, would be great if you told me if anything is not working.
If you decide to fork it first, why not into an organization that you could invite me to? I would gladly do some troubleshooting in case something is not working.
I just take this occasion to braindump my learnings about the folders:
C:\Program Files\UiPath\Studio\Rules was my preferred way of doing it, besides the fact that Admin permissions are needed. On the job I do not have these permissions.
But it is the only way where debug symbols work, and Visual Studio can connect to the UiPath Studio process.
When I found out that it breaks the uninstaller of the UiPath Studio, I began to use C:\Program Files\UiPath\Studio\Rules only for active rule development, when I want to connect with the debugger.
And indeed my initially least preferred way, to use a nupkg dependency, became my preferred way. Even if we have no “development dependencies”, and I prefer to remove the rule nupkg before publishing to production, it is the most hassle-free way.
Because then it is easy to consume new versions from many machines.
I always setup my UiPath Studio to also point AdditionalAnalyzerRulePath to e.g. C:\Users\Public\Documents\UiPath\Rules. This setting is made in the UiPath Studio backstage view > Settings > Locations. The setting is persisted into to %APPDATA%\UiPath\UiStudio.v2.settings
Works like the C:\Program Files location with the .dll file(s). But again, as I need to have the dll files available on potentially many machines this approach became only a fallback.
As it does not require Windows Admin permissions and does not break the uninstaller I think such a setting is a great option.