Page 1 of 1

Execute external tool\script when building the project in Ranorex Studio

Posted: Wed May 12, 2021 1:47 pm
by andrii.savka
Hi,

We want to inspect our code using ReSharper command-line tools.
So we have created a PowerShell script that can execute it.
But we need to do it manually after we build the project.

We want to somehow execute the PowerShell script when we build the solution from Ranorex Studio (after the build action).

I found in options some external tools section, but I don't know if this could help:
2021-05-12_15-39-21.png
Is it possible to configure Ranorex Studio to do it automatically after the build action was made?

Thanks in advance!

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Thu May 13, 2021 9:56 am
by odklizec
Hi,

You can define pre/post build events in the project properties, as shown here:
BuildEvents.png
Just right-click a project and form the appeared menu select Properties >> Build events tab. Hope this helps?

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Thu May 13, 2021 6:05 pm
by andrii.savka
Hi odklizec,

I have tried to add a call of a bat file that would execute the PowerShell script with parameters.
But nothing happened when I had built a solution.
2021-05-13_19-58-33.png

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 8:31 am
by Stub
What is the 'call' thing for? Just a full filename to the batch file should be sufficient. You can also increase MSBuild verbosity to see more output, which may help diagnose this post build step.

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 8:53 am
by odklizec
Hi,

I just tried it and it definitely works. I guess the problem in your case is this...$(SolutionDir)
Just try to replace this 'variable' with absolute path.

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 9:41 am
by Stub
$(SolutionDir) is fine, it's a well-known MSBuild variable. We do similar things in our Ranorex solutions e.g.:

Code: Select all

"$(TargetFrameworkSDKToolsDirectory)TlbImp.exe" parameters_go_here
You can acquire a list of MSBuild variables from Visual Studio easily enough, or gander the MSBuild output in a higher verbosity. I can't recall if SolutionDir has a trailing path separator on it or not.

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 9:52 am
by odklizec
Hi Stub,

You are right. $(SolutionDir) works fine. So the problem must be in Andrii's bat/powershell.

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 11:52 am
by andrii.savka
I have created a new project just for the check. As you can see no TEST value in build logs:
2021-05-14_13-49-26.png

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 12:04 pm
by odklizec
I'm not quite sure that echo is displayed in output tab. Just create a simple test.cmd with single line notepad.exe. Then place this bat file to solution dir (where rxtst is located) and call it with this command in PostBuild action... "$(SolutionDir)test.cmd".
After build, notepad.exe should be started (as it does for me).

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri May 14, 2021 2:37 pm
by Stub
Have you adjusted the MSBuild output verbosity?

Re: Execute external tool\script when building the project in Ranorex Studio

Posted: Fri Mar 04, 2022 7:59 am
by celalsur
I'm also curious about MSBuild output verbosity