Highlighted
Absent Member.
Absent Member.
4278 views

porting COM to C#

I am getting started trying to port my COM objects into C# for use in Starteam 14 and using the ST14 SDK.  I will admit I am very new at C# and am just trying to learn it on my own.  I have ST14 and ST14 sdk loaded and am using Visual Studio Express 2013 for Desktop, which is using the .net framework 4.5.1.

To get started, I was just trying to compile one of the Samples, CRWatcher that is supplied.  I am getting an error saying that the Starteam namespace cannot be found.   It looks like the project is looking for Starteam.dll and Starteam.core.dll, which I can find nowhere on my machine.  I'm sure my project is not setup correctly, but I'm not sure where the references are supposed to be loaded from. 

Thanks,

Mark

Tags (1)
0 Likes
8 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

The installed st14 sdk is the java sdk. You need to install the .NET SDK, which you may download from Microfocus Support line. There are 2 .zip's available, a 32 bit and a 64 bit .zip. Please pick the one that matches your environment. You will also need to install the J# redistributable from the Microsoft web site.

Here is a link to the StarTeam SDK wiki page that describes all these dependencies.

community.microfocus.com/.../726.native-32-64-bit-net-starteam-sdks.aspx

Also, please follow the ftp link on this wiki page

community.microfocus.com/.../620.starteam-sdk-topics-releases.aspx to the SDK overview power point.

you'll find useful details on the basic differences between java & c#

as always, please feel free to ask questions.

0 Likes
Highlighted
Absent Member.
Absent Member.

Thanks.   Once completed, what would I need to distribute to any client machines to be able to run ?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

the 32/64 bit j# re-distributable and the 32/64 bit .NET SDK .zip

0 Likes
Highlighted
Absent Member.
Absent Member.

What is the link to download the .net sdk ?   I need the 32 bit version.  I tried to logon to the support line, but it wants a serial number.  HP is a huge company that uses Starteam everywhere, I have no idea who would have this information.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

hi mark,

please contact Phil Stopke at HP, who will be able to get you access to all StarTeam deliverables.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Anil,   just wanted to say thanks.  I got what I needed from Phil.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Anil,

I'm trying to get a very simple C# app to connect to Starteam before I start porting all my other stuff over.  Having an issue.  Since I'm running windows7-64, I had to load the J#-64 redistributable and am using the 64 bit SDK.   Targeting .net framework 4.5.1 and x86 (I assume I needed this since 64 bit), using VS2013.   Very simple code as follows:

 public static void Main(string[] args)

   {

       try

       {

           StIntFace app = new StIntFace();

           // load VJS libraries

        // doing this did not help

//            IntPtr ptr3 = LoadLibrary("C:\\windows\\microsoft.net\\framework\\v2.0.50727\\vjscor.dll");

//            IntPtr ptr1 = LoadLibrary("C:\\windows\\microsoft.net\\framework\\v2.0.50727\\vjslib.dll");

//            IntPtr ptr2 = LoadLibrary("C:\\windows\\microsoft.net\\framework\\v2.0.50727\\vjsnativ.dll");

           app.GetServer();

//            FreeLibrary(ptr1);

//            FreeLibrary(ptr2);

//            FreeLibrary(ptr3);

       }

       catch (Exception e)

       {

           Console.WriteLine("\n" + e.Message);

       }

   }

   protected Server GetServer()

   {

       // Simplest constructor, uses default encryption algorithm and compression level.

       Server s = new Server(m_strServer, m_nPort);

       // Optional; logOn() connects if necessary.

       s.Connect();

       // Logon using specified user name and password.

       s.LogOn(m_strUser, m_strPassword);

       return (s);

   }

I am able to instantiate a Server object, but on the Connect() call, it gets an SDKRuntimeException and the following:

'StarTeamIFace.vshost.exe' (CLR v4.0.30319: StarTeamIFace.vshost.exe): Loaded 'D:\Misc Tools\.Net Tools\StarTeam_IFace\StarTeam_IFace\StarTeamIFace\bin\Debug\StarTeam.Core.dll'. Module was built without symbols.

'StarTeamIFace.vshost.exe' (CLR v4.0.30319: StarTeamIFace.vshost.exe): Loaded 'C:\Windows\assembly\GAC_64\vjslib\2.0.0.0__b03f5f7f11d50a3a\vjslib.dll'. Cannot find or open the PDB file.

'StarTeamIFace.vshost.exe' (CLR v4.0.30319: StarTeamIFace.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\vjscor\2.0.0.0__b03f5f7f11d50a3a\vjscor.dll'. Cannot find or open the PDB file.

'StarTeamIFace.vshost.exe' (CLR v4.0.30319: StarTeamIFace.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

A first chance exception of type 'StarTeam.Exceptions.SDKRuntimeException' occurred in StarTeam.dll

The thread 0x18d0 has exited with code 259 (0x103).

I put the 3 vsj.dll files (cor, lib and nativ) and the 5 .dll files in the /debug directory of the app and have tried a couple other things.  I am not sure where it is looking for vjscor and vjslib for, assuming that is the issue.

Any ideas what I have missing ?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

in Project/Properties, under the Application TAB, pick Target Framework 2.0, 3.0 or 3.5

under thee Build TAB, change Platform from Any CPU to X64

rebuild your application & run it.

(Please note that x86 implies 32 bit, and LoadLibrary fails when used with VS2013

Use Assembly.LoadFrom, see the code below)

i ran and verified the following snippet works in VS2013 on my Windows 7 64 bit machine.

using System.Reflection;

using System.IO;

using StarTeam;

public class X ...{

       private static Assembly vjsLib;

public method m ... {

           String folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"..\Microsoft.NET\Framework64\v2.0.50727"); // Framework64 on 64 bit Windows 7+ Systems

           folder = Path.GetFullPath(folder);

           String imagepath = Path.Combine(folder, "vjslib.dll");

           vjsLib = Assembly.LoadFrom(imagepath);

           Console.WriteLine(vjsLib.FullName); // if the assembly fails to load, this call will throw an exception

           Server s = new Server("localhost", 49201);

           s.LogOn("Administrator", "Administrator");

           if (s.IsMPXAvailable)

               s.EnableMPX();

           Console.WriteLine(s.LoggedInUser.Name);

           s.Disconnect();

}

i'm seeing TypeInitializationException thrown for .NET Framework 4.0 & above.

I'll do some research to see if I can find out why.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.