2016-08-02 60 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.

相關問題