2016-08-02 309 views
8

我想发布关于sdl_mixer的包,它是一个本地包。我的确如tutorial所说。我把.dll.h.lib文件到包内容 ,但最终方案没有奏效。那么什么是创造C++的NuGet包正确的方式?如何为本地C++创建nuget包

另一个问题是我的NuGet发现,大多数原生C++封装刊登在两份套餐为例:

sdl2_ttf.v140

sdl2_ttf.v140.redist

所以就是这两个文件之间的差异,我怎么能发布包这样的?

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

当我喜欢教程说如何发布本地包。我写了像下面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; 
    }; 

}

运行命令

Write-NuGetPackage .\sdl_mixer.autopkg

后返回错误:最终的意外输入。所以有什么问题 ?

+0

“不工作”不知道多少......问题是什么?什么都没有安装,运行时错误发生,组件丢失? – dlatikay

+0

@dlatikay当我想包含.h文件时,它提醒我找不到头文件。 – spartawhy117

+0

你可以确保你没有错过你的autopkg文件末尾的“}”吗?该错误表明autopkg文件内容不正确。 –

回答

2

您可以使用CoApp PowerShell tools轻松创建本地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.

参考此链接以获取更多的详细信息:Support for Native Projects.

相关问题