User Tools

Site Tools


vulcan_to_xsharp

This is an old revision of the document!


Migrate an existing Vulcan.NET to X#

This chapter contains the steps you must take to have an existing Vulcan run in X# with the least amount of work. You may not need to do all steps, and the few errors I got and solved you may not see at all, while some others errors may occur in your project. But in general, if you are aware of what is described below, the Vulcan to X# conversion can be done very quickly.

The X# documentation says:

VO and Vulcan support is available in this build of XSharp through what we call the Bring Your Own Runtime principle.   If you own a license of Vulcan, you can copy the DLLs that you find in the <Vulcan.NET BaseFolder>\Redist\4.0 folder to a folder that is inside your solution. Then add references to the DLLs that you need in your project.

In this example, we set up an existing Vulcan WPF project into X#.

Step 1 Creating a new project, and fix name and directory problems

In Visual Studio, choose File/New/Project, select X# WPF Application

Default it says: WpfApplication1, both for Name and Solution name. Now it makes sense to rename that to MyProject and change path to e.g. d:\xSharpProjects\MyProject. My project is called iConnectMailReader so I will use that in the further documentation.

This has 2 consequences (which is a Visual Studio flaw in my opinion)

1) The sln is created under D:\XSharpProjects\iConnectMailReader\iConnectMailReader which contains another directory iConnectMailReader that contains the actual program data. 2 My prg and XAML files are called WPFWindow1.xaml.prg. Why does VS not call this 'iConnectMailReader'? I can change it in the Solution Explorer but after that I still have to change it in one or more places in the program. E.g. in the WPF XAML it still says: <Window x:Class=“iConnectMailReader.WPFWindow1”.

A better solution is:

1) Uncheck the box Create directory for solution. This saves you one level of directories.
2) Directly delete the WPF window. Then create a new one via the projects right mouse option Add/New Item, and add a WPF windows with the desired name.

If, in the end, your program doesn't do anything, you may most likely see in the debugger that it stops at app:Run() with a missing wpfwindow1.xaml (in small letters!).

This comes from a file called App.g.prg, in the Debug directory, and this may still show:

SELF:StartupUri := System.Uri{“WPFWindow1.xaml”, System.UriKind.Relative}

Change the bold part to the name you gave the new WPF window and the program will work.

Step 2: copy existing Vulcan files (like .prg's)

Just copy the WPF window XAML code in the editor from your Vulcan project into iConnectMailReader.xaml Xaml code. You can do (almost) the same for the code in iConnectMailReader.xaml.prg. I think X# needs PUBLIC Constructor while Vulcan uses Constructor. If you have more .prg (or other files) in Vulcan, just copy them to the same directory where you have the Mainwindow files. In the Solution Explorer, select the project, then right mouse Add/Existing items and select all these files.

Step 3: Change some project settings

Right mouse click Properties on the project. In the General tab, change Dialect to Vulcan.NET

In the Language tab (see left, same screen), I keep everything on False except Implicit signed/unsigned conversions : true Treat missing types as USUAL : true Enable Implicit Namespace lookup: true (Reason: see error below) Allow Unsafe Code: maybe true (Reason: see error below)

In the Build tab, I change Any CPU to X86. Prefer 32 bits changes to false then.

Step 4: Set references

Should you compile your product now, you will get a run time error:

Error XS9014 The dialect 'Vulcan' requires a reference to the runtime DLLs VulcanRT.DLL and VulcanRTFuncs.DLL or XSharp.VO.DLL.

On the project, go via Right Mouse menu to Add/Reference, click on tab Browse and select Vulcan DLL's from for example:

C:\Program Files (x86)\Vulcan.NET 3.0\Redist\Assemblies\v4.0

Note that version 4 does not have different Vulcan DLL's so you can also choose C:\Program Files (x86)\Vulcan.NET 4.0\Redist\Assemblies\v4.0

The X# help file says:


DLLs you MUST add if you compile for the VO/Vulcan dialect:

  ·VulcanRT.DLL

·VulcanRTFuncs.DLL   These 2 files are NEVER added to your Vulcan projects, Vulcan adds a reference to these DLLs automatically. XSharp does not do that, so you should add them yourself.

DLLs that you MAY want to add, depending on what you are using in your application:   ·VulcanVOSystemClasses.dll ·VulcanVORDDClasses.dll ·VulcanVOGUIClasses.dll ·VulcanVOInternetClasses.dll ·VulcanVOSQLClasses.dll ·VulcanVOConsoleClasses.dll ·VulcanVOWin32APILibrary.dll


E.g. you would need the VulcanVORDDClasses.dll of you are going to use DBF files. You won't need VulcanVOGUIClasses.dll if you are using WPF/Winforms but you do need it for VOVulcan compatible windows and menu's for example.

Other projects

I also had a C# project included. Go to the solution, Right mouse menu, Add Existing Project and point to the .csproj files; these show on the same level in the solution explorer with every included file, references etc. After that, on the project: Right Mouse menu to Add/Reference, click on tab Projects and select the just added C# project from there.

Other references

For ADS you can download several RDDs, e.g.:

http://devzone.advantagedatabase.com/forum/upfiles/Advantage_RDD_302_F2F4.zip

http://devzone.advantagedatabase.com/forum/upfiles/Advantage_RDD_301_F2F4.zip

It must match your VulcanRT.DLL

I included AdvantageRDD.dll 11.10.0.20 with my Vulcan version 3 DLL's. For external library Chilkat I use ChilkatDotNet45.dll 9.5.0.56. I place them in the same directory as the .sln file and then include it using Add/Reference, click on tab Browse.

I was left with one more errors:

Error XS0246The type or namespace name 'DbServer' could not be found (are you missing a using directive or an assembly reference?)

Solution A reference to to VulcanVORDDClasses.dll was present however. This was solved by Project settings, the Language page and enable the option “Enable Implicit Namespace lookup”.

One error then remained:

Error XS0012 The type 'DataServer' is defined in an assembly that is not referenced. You must add a reference to assembly 'VulcanVOSystemClasses, Version=4.0.401.0, Culture=neutral, PublicKeyToken=0e73a8bf006af00c'. iConnectMailReader

Solution: This was solved adding also that Vulcan DLL as reference.

Step 5: solving other errors

If you have a working Vulcan project, you may come across errors you did not have in Vulcan because the X# compiler is more strict. Some examples:

Error XS0127 Since 'MailReaderWindow.SetReadinterval()' returns void, a return keyword must not be followed by an object expression iConnectMailReader D:\XSharpProjects\iConnectMailReader\iConnectMailReader\iConnectMailReader.xaml.prg 352

Solution: I changed the type and return value from void to logic

Error XS0029 Cannot implicitly convert type 'int' to 'logic' iConnectMailReader D:\XSharpProjects\iConnectMailReader\iConnectMailReader\Chilkat class PopAX.prg 66

Solution: For unknown reasons booleans were assigned as 0 and 1 in Vulcan. I changed that to true and false

Error: Severity Code Description Project File Line Suppression State Error XS0214 Pointers and fixed size buffers may only be used in an unsafe context iConnectMailReader D:\XSharpProjects\iConnectMailReader\iConnectMailReader\Functions.prg 40

Solution: In Project, Right Mouse menu Properties, tab Language : Allow Unsafe Code = true

Error

warning MSB3270: There was a mismatch between the processor architecture of the project being built “MSIL” and the processor architecture of the reference “ChilkatDotNet45, Version=9.5.0.56, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd”, “x86”. This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

Solution: This you will see if your project is still Any CPU. In the Build tab, change Any CPU to X86.

After this, the project compiled and worked as it did in Vulcan 8-)

Dick van Kooten

vulcan_to_xsharp.1517528295.txt.gz · Last modified: 2018/02/01 23:38 by dickvankooten