如何为本机c++创建nuget包

时间:2022-09-01 18:32:56

I want to publish package about sdl_mixer, it's a native package .I did as tutorial said . i put .dll .hand .lib files into package content ,but the final package didn't work .so what is right way to create c++ nuget package ?

我想发布关于sdl_mixer的包,它是一个本机包。我将.dll .hand .lib文件放入包内容中,但是最终的包不起作用,那么创建c++ nuget包的正确方法是什么呢?

another question is I found in nuget,most native c++ package were published in two package ,for example :

另一个问题是我在nuget中发现,大多数本机c++包都是在两个包中发布的,例如:

sdl2_ttf.v140

sdl2_ttf.v140

sdl2_ttf.v140.redist

sdl2_ttf.v140.redist

so what is difference between those two files ?and how can I publish package like that ?

那么这两个文件之间有什么区别呢?我如何发布这样的包呢?

---------------------------------------update------------------------------------

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

when i do like tutorial said about how to publish native package .i have writen like the following autopkg file

当我学习如何发布本机包的教程时,我已经写了如下的autopkg文件。

 

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;
     };

}

}

after run command

运行命令后

Write-NuGetPackage .\sdl_mixer.autopkg

Write-NuGetPackage。\ sdl_mixer.autopkg

it returns error:unexpected input of the end . so what's the problem ?

它返回错误:结束的意外输入。那么问题是什么呢?

1 个解决方案

#1


2  

You can use CoApp PowerShell tools to create the Native Nuget packages easily.

您可以使用CoApp PowerShell工具轻松创建本地Nuget包。

Creating Native Packages

创建本地包

If you’re interested in publishing your native libraries via NuGet, you can choose to create the NuGet packages manually. However, there’s an easier way--the CoApp project volunteered to write C++ oriented tools to create NuGet packages, and they have released a beta version of their tools. These tools simplify the process of generating the MSBuild files and NuGet packages from existing header and library files--you just need to create a configuration script to describe the contents of the package and then run the tools to generate the NuGet package.

如果您对通过NuGet发布本地库感兴趣,可以选择手动创建NuGet包。然而,有一种更简单的方法——CoApp项目自愿编写面向c++的工具来创建NuGet包,他们已经发布了他们工具的beta版本。这些工具简化了从现有头文件和库文件生成MSBuild文件和NuGet包的过程——您只需创建一个配置脚本来描述包的内容,然后运行工具来生成NuGet包。

Refer to this link for more detailed information: Support for Native Projects.

请参考此链接获取更详细的信息:支持本地项目。

#1


2  

You can use CoApp PowerShell tools to create the Native Nuget packages easily.

您可以使用CoApp PowerShell工具轻松创建本地Nuget包。

Creating Native Packages

创建本地包

If you’re interested in publishing your native libraries via NuGet, you can choose to create the NuGet packages manually. However, there’s an easier way--the CoApp project volunteered to write C++ oriented tools to create NuGet packages, and they have released a beta version of their tools. These tools simplify the process of generating the MSBuild files and NuGet packages from existing header and library files--you just need to create a configuration script to describe the contents of the package and then run the tools to generate the NuGet package.

如果您对通过NuGet发布本地库感兴趣,可以选择手动创建NuGet包。然而,有一种更简单的方法——CoApp项目自愿编写面向c++的工具来创建NuGet包,他们已经发布了他们工具的beta版本。这些工具简化了从现有头文件和库文件生成MSBuild文件和NuGet包的过程——您只需创建一个配置脚本来描述包的内容,然后运行工具来生成NuGet包。

Refer to this link for more detailed information: Support for Native Projects.

请参考此链接获取更详细的信息:支持本地项目。