Page 1 of 1

How to build Ranorex projects from the command line

Posted: Fri Jan 07, 2011 10:26 am
by Support Team
A common task, e.g. when Ranorex is used with a Continuous Integration system, is that you need to compile your Ranorex tests from the test sources, i.e. the Ranorex projects. For example, when you have your Ranorex test sources checked into a source control system, you first update your test sources, compile the test projects to executables, and then run these test executables.

Ranorex Studio itself does not provide a command line interface, simply because the Ranorex project files are compatible with Visual Studio and MSBuild, which is installed as part of the .NET Framework. So you just have to use MSBuild and tell it to compile the Ranorex solution/project files:

Code: Select all

// solution
%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe solution.sln
// C# project
%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe project.csproj
// VBNet project
%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe project.vbproj
You can also specify the configuration and platform to use by providing additional command line parameters. Please, see following page on MSDN for available command line parameters for MSBuild:
http://msdn.microsoft.com/library/ms164311.aspx

Just let me bring two facts to your attention that could cause problems:
  • All test source files need to be up-to-date when compiling test solutions/projects from the command line. For example, the source code for Ranorex recordings/repositories will not be updated!
  • MSBuild is confused by the "rxsln" ending of the solution file, that's why Ranorex Studio automatically saves the same file with a "sln" file ending as well. Please, always use the "sln" file or the individual project files when using MSBuild.
Regards,
Alex
Ranorex Team

Re: How to build Ranorex projects from the command line

Posted: Thu Dec 04, 2014 8:22 am
by anil13
Hi Alex,
This does not seem to work.
I need to build a ranorex project which references other projects which in turn reference other projects.

Re: How to build Ranorex projects from the command line

Posted: Thu Dec 04, 2014 2:31 pm
by krstcs
It works fine for me. I do this all the time with multiple projects. All projects are in the same solution though. If it works in Ranorex Studio then it will work with MSBuid (since RXStudio uses MSBuild).

If by "project" you mean solution, then no, it won't work that way. MSBuild will only build one solution at a time. If you have dependencies from other solutions you will need to build those first then copy the resulting DLLs or EXEs into the right spot for the dependent solution. This can be done with the pre- and post-build actions in the project properties file.

Re: How to build Ranorex projects from the command line

Posted: Wed May 06, 2015 6:37 am
by anil13
When I build Ranorex projects via msbuild, I notice that the relative paths of the datasource files in the testsuite file(in bin\Debug) are not updated. e.g. ..\datasource remains as ..datasource(and not ..\..\..\datasource). Due to this, I get errors when I run the executable from Debug folder. How do I fix this?

Thanks

Re: How to build Ranorex projects from the command line

Posted: Thu May 07, 2015 7:40 am
by odklizec
Hi,

Check this post about Data source files organization and maintenance:
http://www.ranorex.com/forum/data-sourc ... ude#p31249

Re: How to build Ranorex projects from the command line

Posted: Fri Nov 10, 2017 11:05 pm
by Groostav
Do the project files and solution files include a step to generate the C# source code?

What I would like to have is a repository of only .rxrec and .rxrep files, and have my build system re-generate the test-driver exes files from just those two file types. My understanding is that the ranorex studio will do this, first rebuilding the generated C# source code, then internally using MS build to create the exe, but only when run from a GUI mode. MSBuild alone does not appear to generate the C# source files.

Is this possible? Is there some kind of pre-processing action I can have MS build take to re-generate the C# source files on each build? Can ranorex studio itself simply be run from the command line to accomplish this?

Re: How to build Ranorex projects from the command line

Posted: Mon Nov 13, 2017 9:12 am
by odklizec
Hi,

I'm afraid, there is no way to re-build the cs files outside Ranorex and as far as I know, there is currently no option to re-build them using Ranorex Studio command line. Your best hope is to build all necessary files in Studio and store and distribute them via source control system (TFS, GIT, etc...).

If you wish, you can always create a user voice entry here (and hope for enough votes to get Ranorex devs attention :))...
https://uservoice.ranorex.com/forums/15 ... ve-ranorex

Re: How to build Ranorex projects from the command line

Posted: Mon Nov 20, 2017 2:43 pm
by Stub
FWIW, like odklizec suggests, I store the Ranorex generated code in our source control system such that our automated build/test system can grab everything, build it all using MSBuild, then run the tests automagically. Works well. If I could automate generation of the Ranorex code files I'd remove these generated files from source control. So I'd vote for that at least!