Page 1 of 1

nameof() expression

Posted: Tue Jun 23, 2020 7:52 pm
by andrii.savka
Hello,

I updated all my projects to use C# 7.0 and .NET Framework 4.7.2.
But I couldn't use nameof() expression.

Any idea why is it?

P.S. Ranorex 9.3.2

Re: nameof() expression

Posted: Wed Jun 24, 2020 7:36 am
by odklizec
Hi

It is not possible to compile the solution or what? I believe that NameOf is C# 6 related? Actual Ranorex version should be able to compile C# code up to version 7, so there should not be a problem with compiling this expression. Could you please post a small sample solution, featuring problematic code?

Re: nameof() expression

Posted: Wed Jun 24, 2020 12:09 pm
by andrii.savka
Hello odklizec,

Yep, I could not compile. You can see it on screenshots.
2020-06-24_14-03-03.png
2020-06-24_14-02-53.png
As you can see, all my projects are updated to the last support version.
But I could not use C# 7.0 features.
2020-06-24_14-04-11.png

Re: nameof() expression

Posted: Wed Jun 24, 2020 1:14 pm
by odklizec
Hi,

I just tried to convert C#5 to C#7, added nameof and it compiles OK? So I guess something's missing on your computer? Have you tried to install 4.7.2 SDK and targeting pack?
2020-06-24_14-13-58.png

Re: nameof() expression

Posted: Wed Jun 24, 2020 1:21 pm
by andrii.savka
Hello,
I have already made this. I had converted all projects, and after that, I stuck with this problem.
Also, I have installed sdk.
2020-06-24_15-19-09.png
2020-06-24_15-16-36.png

Re: nameof() expression

Posted: Wed Jun 24, 2020 1:25 pm
by odklizec
Hi,

Well, there seems to be missing 4.7.2 targeting pack in your system? This is what I have installed:
2020-06-24_14-23-36.png

Re: nameof() expression

Posted: Thu Jun 25, 2020 2:34 pm
by andrii.savka
Could not solve the problem with targeting packs.
Fixed problem by downgrading to .net framework 4.6.2
thank you!