Skip to content

How to get started #1951

Open
Open

Description

@Levi--G

Hi,

I'm trying to use cppsharp to convert a few headers but i can't figure out the gaps in the documentation.

First i tried using the nuget.org package, but that is terribly outdated and not compatible anymore. Then i tried the GitHub package, but that only contains the linux runtime, since I'm on windows that is a no-go. Then i tried compiling myself, building went fine. Testing didn't work through the test script but went fine in the sln. So i think i have a properly built cppsharp, somewhere...

But now the getting started markdown ends and there is no list anywhere what i need to include in a new generator project to get this working.

I tried to pack the nugets myself with the windows runtime with the build script, but that fails at runtime with an error "Could not load file or assembly CppSharp.Parser.CLI ...". I also tried to include the dlls in the bin directory, but nothing seems to be working. Any chance of extending the docs to what we are supposed to do after the building? Or including the windows runtime in the nuget package?

Thank you.

Activity

  1. tritao commented on Nov 17, 2025

    @tritao
    Collaborator

    Easiest way to get started is probably to invoke the CppSharp CLI at https://github.com/mono/CppSharp/blob/main/src/CLI/CLI.cs

    For the more traditional way of using CppSharp, which is probably what you want long-term, check for example the driver code of the example: https://github.com/mono/CppSharp/blob/main/examples/SDL/SDL.cs

    For the NuGet and Windows stuff, unfortunately I don't use Windows these days anymore, so I don't have a way to test this. I would appreciate if someone else could help, I'll happy review and merge such PRs.

  2. tritao commented on Nov 17, 2025

    @tritao
    Collaborator

    Let me know if this helps or you need further assistance.

  3. Levi--G commented on Nov 17, 2025

    @Levi--G
    Author

    I think the major problem is the nuget package does not include the windows runtimes, this is what is in the nuget package from github:

    Image

    I think windows just isn't being built in the workflow to generate the package?

    The driver code i get completely, but neither of these samples have a buildable csproj i can build so i have no way of knowing what dlls i need to include in my project to build since the nuget package isn't working and the output of the build seems to spam a huge amount of artifacts (dll, json, lib, ...) that are not at all included in the nuget. this step of which dlls to include is also not in the docs, which is the only step that im missing atm to get it working.

    Thank you for the assistance! :)

  4. fengxinran233 commented on Nov 17, 2025

    @fengxinran233

    @Levi--G
    I think you can learn how to use and compile CppSharp from this video.
    https://b23.tv/I4ZfRfh

  5. Levi--G commented on Nov 17, 2025

    @Levi--G
    Author

    @Levi--G I think you can learn how to use and compile CppSharp from this video. https://b23.tv/I4ZfRfh

    Like i said before i have the source built, that is not the issue. The issue is being able to use the built binaries in a project to generate bindings. Which is also not shown in that video, at least i think so because i don't speak the same language. All the samples across github i could find all use the nuget, but the nuget does not include the windows runtime, so there are not samples using the binaries directly.

  6. tritao commented on Nov 17, 2025

    @tritao
    Collaborator

    I think the NuGet issue has been caused due to a regression in c25c7df.

    The update to upload-artifact@v4 caused a difference in behavior from v3, we were relying on same named artifacts being merged together, which is not possible now: https://github.com/actions/upload-artifact#not-uploading-to-the-same-artifact

    Pinging @duckdoom5 in case he is still around, for possible help on this.

  7. duckdoom5 commented on Nov 18, 2025

    @duckdoom5
    Contributor

    Hi, I see.
    To be honest, I don't remember why the change was needed. Wasn't it because v3 was no longer supported and would fail automatically?

    Also, I'm no expert on GitHub actions. Maybe there is still a way to get the old behavior back?

  8. duckdoom5 commented on Nov 18, 2025

    @duckdoom5
    Contributor

    If I were to guess a proper solution though;

    I think we can simply change the name 'intermediate' to include some os/config variables. (And then don't forget to pick that same name on the side that uses the artifacts)

  9. tritao commented on Nov 19, 2025

    @tritao
    Collaborator

    The CI action is now fixed, I published a new v1.2 release: https://github.com/mono/CppSharp/releases/tag/v1.2
    It also published a new NuGet at: https://www.nuget.org/packages/CppSharp/1.1.84.17100

    There is still a mismatch where the NuGet package version is not in sync with the branch/release version, I'll have to debug and fix that at a later stage.

    But feel free to test this new release and let me know if it works or not.

  10. Levi--G commented on Nov 21, 2025

    @Levi--G
    Author

    I can confirm the nuget is working now on windows, thank you everyone!

    Small last question, i see the linux runtime now has a .net 10 lib folder and the windows version has a .net 9 version? Is this correct?

    Image
  11. duckdoom5 commented on Nov 22, 2025

    @duckdoom5
    Contributor

    That looks like an error, but I can't say for sure @tritao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions