Ranorex 9 and C# 7

Ask general questions here.
Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Ranorex 9 and C# 7

Post by Vaughan.Douglas » Thu Mar 21, 2019 1:50 pm

I've run into trouble with Ranorex's support for C# 7. I'm personally no good at C#, so I'm trying to expand my skill set. I created a solution and upgraded it to use CSharp 7. All was fine until I stuck my solution out on GIT and another user grabbed it. He got an error about the language version in the solution.

Turns out the Ranorex installation on his machine only had up to C# 5. I'm also responsible for updating the Ranorex installation packages in our distribution system. The distribution system is supposed to install the included vcredist executable via script. I want to make sure that's working properly and add any additional files necessary so our users can take full advantage of this upgrade.

The extra wrinkle here is that this user is still on Window 7, so maybe there is a conflict there too. I'm on Windows 10 and I also have Visual Studio installed, so I'm not sure where I got the language stuff. When I turn to Google, I get so many results pointing in different directions that I'm spinning in circles.

Is C# 7 included in Microsoft Visual C++ 2017 Redistributable that is packaged in the vcredist executable?
If not, what do I need to add to our distribution package?
Doug Vaughan

User avatar
Support Team
Site Admin
Site Admin
Posts: 11994
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex 9 and C# 7

Post by Support Team » Fri Mar 22, 2019 2:00 pm

Hello Douglas,

Thank you for your post.

In order to use C# 7 in your Ranorex project, please download and install Microsoft Build Tools 2017:

Afterwards, you should be able to select C# 7 in your project properties.

Kind Regards,
Stephan
.
Image

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Ranorex 9 and C# 7

Post by Vaughan.Douglas » Mon Mar 25, 2019 3:55 pm

Support Team wrote:
Fri Mar 22, 2019 2:00 pm
Hello Douglas,

Thank you for your post.

In order to use C# 7 in your Ranorex project, please download and install Microsoft Build Tools 2017:

Afterwards, you should be able to select C# 7 in your project properties.

Kind Regards,
Stephan
This is exactly what I needed. Thank you!
Doug Vaughan

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Ranorex 9 and C# 7

Post by Vaughan.Douglas » Wed Mar 27, 2019 12:46 pm

So just a follow up to this. Installing MS Build Tools (really Visual Studio Build Tools 2017) does indeed add C# 7 language support. However when setting the .Net Framework to 4.6.2 the compiler throws errors saying it can't find the targeting pack. The 4.6.1 targeting pack can be installed in Visual Studio Build Tools 2017, but you have to download 4.6.2 separately for Windows 7 machines I guess. The 4.6.2 Framework does show up when I run the same installer in Windows 10, but I have Visual Studio installed there too so I didn't draw any concrete conclusions.

What I ended up doing was to install only the .Net Desktop Build Tools workload with ONLY the required components. Then I added the optional .NET Framework 4 – 4.6 development tools component. Then installed the 4.6.2 framework via separate installer.

This allowed us to successfully build the project, but when ran into trouble when we added the ClosedXML NuGet package. We get the following build warning:
Found conflicts between different versions of "DocumentFormat.OpenXml" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. (MSB3277) - C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets:2110,5
It's only a warning, so it's not going to stop work. However I'd like to understand why this warning is coming up.
Doug Vaughan

User avatar
Support Team
Site Admin
Site Admin
Posts: 11994
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Ranorex 9 and C# 7

Post by Support Team » Fri Mar 29, 2019 10:05 am

Hi Vaughan.Douglas,

Thank you for the further details.
I'm glad you are able to successfully build your project now.
It's only a warning, so it's not going to stop work. However I'd like to understand why this warning is coming up.
This warning appears because the "DocumentFormat.OpenXml.dll" is also needed by Ranorex and therefore, it already exists in the the installation directory.

Kind regards,
Stephan
.
Image

Patrick Hollerbach
Posts: 25
Joined: Thu Jan 02, 2014 4:00 pm

Re: Ranorex 9 and C# 7

Post by Patrick Hollerbach » Thu Oct 17, 2019 2:19 pm

Hi,

I installed the Visual Studio Build Tools 2019 but C# 6 / 7 is not available.

I tried with Visual Studio Build Tools 2015, after installing this c# 6 can be choosed for Ranorex Projects.

It seems that the Visual Studio Build Tools 2017 are not longer available for download :-(

Any hope for support of "Visual Studio Build Tools 2019" by ranorex?

Thanks
Patrick

Patrick Hollerbach
Posts: 25
Joined: Thu Jan 02, 2014 4:00 pm

Re: Ranorex 9 and C# 7

Post by Patrick Hollerbach » Thu Oct 17, 2019 4:06 pm


dugovic.milan
Posts: 66
Joined: Wed Jun 29, 2016 1:19 pm
Location: Frankfurt, Germany
Contact:

Re: Ranorex 9 and C# 7

Post by dugovic.milan » Thu Oct 31, 2019 2:00 pm

Patrick Hollerbach wrote:
Thu Oct 17, 2019 4:06 pm
OK, found it by my self:
https://visualstudio.microsoft.com/de/t ... ls&rel=15#
Hi Patrick. Here are the MS Build Tools 2019 ;)
https://visualstudio.microsoft.com/than ... ols&rel=16
Ranorex Explorer @DVAG
Support my Ranorex Ideas & Improvements
My current approach: Ranorex 8.3.0