How To get project's options using code

Class library usage, coding and language questions.
User avatar
Broadnick
Certified Professional
Certified Professional
Posts: 29
Joined: Tue Nov 04, 2014 4:18 pm

How To get project's options using code

Post by Broadnick » Fri Jun 19, 2015 3:50 pm

How can I get the selected Build Configuration (and other project options) for my Ranorex Project, using Code?

afleitas
Certified Professional
Certified Professional
Posts: 26
Joined: Thu May 14, 2015 3:57 pm

Re: How To get project's options using code

Post by afleitas » Mon Jun 22, 2015 4:55 pm

Hello

While you can get all the project properties via the MSBuild API, there is no helper functions to help with this in Ranorex. Furthermore, I'm not sure but that sounds like it would fall out of the scope of a Ranorex topic and more or an MSBuild question.

What exactly are you trying to achieve?
Normal people... believe that if it ain't broke, don't fix it. Engineers believe that if it ain't broke, it doesn't have enough features yet.
-Scott Adams :)

User avatar
Broadnick
Certified Professional
Certified Professional
Posts: 29
Joined: Tue Nov 04, 2014 4:18 pm

Re: How To get project's options using code

Post by Broadnick » Tue Jun 23, 2015 12:34 pm

I'm trying different solutions to automatically load a specific Excel data file, according to the configuration in which the test is Builded and executed. So rather than checking the machine on which the build is created, I would like to check the build configuration.

If the configuration is Debug, then the data file to be loaded is in a development context and is different for each dev team. If the configuration is Release, the data file to be loaded is a common production data file, used by TeamCity.

I think the simplest way is to use the Pre-Build Event command Line, but as I said, I'm trying different solutions ...

:)

mojohlic
Posts: 31
Joined: Thu Oct 11, 2012 4:37 pm

Re: How To get project's options using code

Post by mojohlic » Wed Jun 24, 2015 3:03 pm

Do you run your test from command prompt?

Just an idea if you do:

Create a global variable and pass the variable in the command line.
Example:

KeePassTestSuite.exe /pa:GlobalRunConfiguration=Debug /rc:Debug

And inside you can check that variable and load the specific excel file.

But I would love to know if you can get the value during the execution. Please let us know if you find an answer :)