June 30th, 2009, 02:06 PM
C#, C++/CLI and Visual Studio 2008
So I've been working on writing a C++/CLI wrapper around an unmanaged library. I've now got that working, but only on the command line, and I was hoping to get some quick help on how to get this all working in Visual Studio 2008.
I have the following files:
MyWrapper.dll is compiled from C++/CLI code, MyUnmanagedLibrary.lib is compiled from unmanaged C code and TestProgram.cs is a C# program which calls functions defined in MyWrapper.dll
When I compile this code at the command line the following two commands are executed.
$ csc TestProgram.cs /r:MyWrapper.dll
$ mt /manifest MyWrapper.dll.manifest /outputresource:TestProgram.exe
Which produces TestProgram.exe
I'd like to know how I would go about importing this into, or creating, a Visual Studio 2008 project.
Any and all advice is very much appreciated.
July 4th, 2009, 04:18 AM
Re: C#, C++/CLI and Visual Studio 2008
If TestProgram.cs contains text for Console application (function main), create new C# project of type "Console Application". Paste code from TestProgram.cs to the file generated by Application Wizard. In the Solution Explorer, open References, right-click and select "Add Reference". Add reference to MyWrapper.dll. Compile and run the program.
Click Here to Expand Forum to Full Width