Slighthaze = [color blue]NULL[/color]
Using Visual Studio .NET create a C# Class Library project and name it "VFPMath" (I used "E:\Temp\NETDLLFORVFP6 for my location)
C# code for the Class1.cs file:
using System;
namespace VFPMATH {
public class MathFunctions : System.EnterpriseServices.ServicedComponent {
public Int32 Add(Int32 x, Int32 y) { return(x + y);}
public Int32 Subtract(Int32 x, Int32 y) { return(x - y);}
public Int32 Multiply(Int32 x, Int32 y) { return(x * y);}
public Int32 Divide(Int32 x, Int32 y) { return(x / y);}
}
}
...next in your Solution Explorer add a reference to "System.EnterpriseServices"
...then from a DOS command prompt, create a random key pair and store it in VFPMath.snk (You can use the Strong Name tool to do this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfstrongnameutilitysnexe.asp)
Here is what my DOS command looked like for creating the VFPMath.snk file:
E:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin>SN -k VFPMath.SNK
..next I copied VFPMath.snk into the folder where my dll was going to be built (I just used the "debug" folder in "bin", since I wasn't looking to release this)
Then back in your Solutions Explorer (in C#) select the AssembliesInfo.cs and look for the line that reads:
[assembly: AssemblyKeyFile("")]
...and change it to... [assembly: AssemblyKeyFile("E:\\Temp\\NETDLLFORVFP6\\VFPMATH\\bin\\Debug\\VFPMath.SNK")]
...as you can see I am using the fullpath, but you could use something relative or in the search path.
Then build your dll and go back to the DOS command prompt to register it. (I used the following command to register mine (modify your's to suit):
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.