I want to publish package about sdl_mixer, it's a native package. I did as tutorial said. I put .dll
.h
and .lib
files into package content, but the final package didn't work. So what is right way to create c++ nuget package?
Another question: I found in nuget, most native c++ package are published in two packages, for example:
sdl2_ttf.v140
sdl2_ttf.v140.redist
What is difference between those two files? And how can I publish my packages like that?
Update:
I followed the tutorial on how to publish native packages. I have written the following autopkg file
nuget{
nuspec {
id = MySdl_mixer;
version :2.0.0.0;
title: sdl mixer;
authors: { Sam Lantinga, Stephane Peter, Ryan Gordon};
owners: {spartawhy117};
licenseUrl: "http://libsdl.org/license.php";
projectUrl: "http://libsdl.org/index.php";
iconUrl:"";
requireLicenseAcceptance:false;
summary:Nothing;
description: @"SDL_mixer is a sample multi-channel audio mixer library....
";
releaseNotes: "Release of C++ ";
copyright:Copyright 2015;
tags: {v140 ,sdl_mixer , native, CoApp };
};
files {
#defines {
Include = include\;
Bin = bin64\;
Lib = lib64\;
}
include:{"${Include}*"};
[x64,v140,debug,desktop]{
lib: ${Lib}SDL2_mixer.lib;
bin: ${Bin}SDL2_mixer.dll;
}
[x64,v140,release,desktop]{
lib: ${Lib}SDL2_mixer.lib;
bin: ${Bin}SDL2_mixer.dll;
}
};
targets {
Defines += HAS_SDLMIXER;
};
}
Running the command Write-NuGetPackage .\sdl_mixer.autopkg
returns an error unexpected input of the end. What is the problem here?
Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.
NET Core projects You can quickly create a NuGet package for your . NET or . NET Standard project — right-click the project in the Solution Explorer and choose Advanced Build Actions | Pack Selected Project from context menu.
The NuGet website (nuget.org) has extensive documentation on how to install and use NuGet. You can use NuGet in any C++ project type – this works for desktop, Windows Store, and Windows Phone 8 applications equally.
I searched around for days until I found there is really no help out there on the internet at all. I did managed to piece together how to do it, and through trial and error got it working well. Which I have documented here:
https://digitalhouseblog.wordpress.com/2019/08/22/how-to-make-a-nuget-package-for-c/
But I'll summarize here anyways:
Notice that the nuget tools inside the visual studio IDE are NEVER used. You have to do a LOT manually. See the link for full details and explanations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With