C#, C++/CLI and Visual Studio 2008
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: C#, C++/CLI and Visual Studio 2008

  1. #1
    Join Date
    Jun 2009
    Posts
    7

    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
    MyWrapper.dll.manifest
    MyUnmanagedLibrary.lib
    TestProgram.cs

    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.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,494

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center