Page 1 of 1

Convert scripts from VB.Net to C#

Posted: Wed Nov 09, 2011 3:31 pm
by Nadeem
Hello,

I was wondering if anyone has ever converted scripts initially recorded in VB.Net to C#.

I have a whole Solution which has been recorded in VB.Net but I need to convert that C# (as most of our development is done in C# so would like to bring everything in line). I selected the Solution, performed right-click action, selected the Convert > from VB.Net to C# option.

After a certain amount of time, the conversion completed successfully. But when I try t compile the Converted Solution or run a particular Testcase, it displays the following Error message:

Code update error: 'C:\Projects\......\Dispatch_External.rxrec'. The project item for this file is invalid.

In short it displays this message for all the Recording modules in that Solution.

What does this mean? What do I need to do? Does conversion limit what is and is not converted? :?

I have noticed in the Converted Folder, the following files are missing:

<Solution Name>.rxsln
<Solution Name>.sln
<Solution Name>VS2010.sln
<Solution Name>VS2010.VS2010.sln

Not sure if i should copies these across or not. But i did. :-)

When i copy them and try to Build the Converted solution it now displays the following message:

The parameter to the compiler is invalid, '/define:TRACE=1' will be ignored. (MSB3052)
The parameter to the compiler is invalid, '/define:DEBUG=1' will be ignored. (MSB3052)

Regards
Nadeem

Re: Convert scripts from VB.Net to C#

Posted: Wed Nov 09, 2011 4:36 pm
by Support Team
Hi,

To overcome this issue please open the Project properties and switch to the compiling tab. There you will find a section with Conditional Compilation Symbols. Please replace the DEBUG=1;TRACE=1 with DEBUG;TRACE. After this change the warning should be cleared.

Regards,
Peter
Ranorex Team

Re: Convert scripts from VB.Net to C#

Posted: Wed Nov 09, 2011 4:39 pm
by Nadeem
No problem, Will give that a try. In regards to my action of copying the following files to the Converted folder:

<Solution Name>.rxsln
<Solution Name>.sln
<Solution Name>VS2010.sln
<Solution Name>VS2010.VS2010.sln

Is this allowed? Is it correct?

Re: Convert scripts from VB.Net to C#

Posted: Wed Nov 09, 2011 5:51 pm
by Support Team
Nadeem wrote:I have noticed in the Converted Folder, the following files are missing:
Those files are "missing", since they belong to the solution, not the original project. When you convert a project, the converted project gets added to the solution, i.e. the "missing" files are updated and don't need to be converted.

Usually, the solution files (.rxsln, .sln) should reside in a parent folder of the project files (.vbproj, .csprof). If you got the solution files in the same folder as the project files, you can copy them to the converted folder, but then the paths to the project files inside the .rxsln and .sln files might not be correct any more and you need to update them when you open the solution files.

Regards,
Alex
Ranorex Team