Convert scripts from VB.Net to C#

Ask general questions here.
Nadeem
Posts: 10
Joined: Fri Jul 01, 2011 9:26 am

Convert scripts from VB.Net to C#

Post by Nadeem » Wed Nov 09, 2011 3:31 pm

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Convert scripts from VB.Net to C#

Post by Support Team » Wed Nov 09, 2011 4:36 pm

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

Nadeem
Posts: 10
Joined: Fri Jul 01, 2011 9:26 am

Re: Convert scripts from VB.Net to C#

Post by Nadeem » Wed Nov 09, 2011 4:39 pm

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?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Convert scripts from VB.Net to C#

Post by Support Team » Wed Nov 09, 2011 5:51 pm

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