Skip to content

Some minor changes were needed for successful build #2

Open
@GergelyMarton

Description

@GergelyMarton

Hi. Thanks a lot for this tutorial, I guess these might be noob issues, but I just feel like sharing how I could make this code work since it was not evident for me as a non-expert.

  1. Set the Platform Toolset and SDK to fit my config (Visual Studio 2017 (v141) and 10.0.16299.0.)

  2. Built CSharpLibrary, it was successful.

  3. the build attempt of CSharpLibraryBridge gave the following error, which I ignored (since the CSharpLibraryBridge.lib, .dll and other files got created).
    Error MSB3073 The command "powershell.exe -ExecutionPolicy Unrestricted -Command D:\CPlusPlusCLI-Tutorial-master\src\CSharpLibraryBridge\PostBuild.ps1 Release
    :VCEnd" exited with code 1. CSharpLibraryBridge C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 133

  4. In the program.cpp of the NativeCLibrary project, changed the include line for ExampleObj.h:
    //#include <ExampleObj.h>
    #include "../CSharpLibraryBridge/ExampleObj.h"

  5. Created a "lib" folder within the "src" folder and copied the generated "CSharpLibraryBridge.lib" file into it.

  6. After these, the build and execution of NativeCLibrary were also successful.

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions