ããã°ãã¯ã@IT 㧠NuGet å ¥éè¨äºãå ¨ã¦å ¬éããã¦ã»ã£ã¨ãã¦ã¾ãããã°ããã§ãã
ä»å @IT åãã«è¨äºãæ¸ãã«ããã£ã¦ãç§ãæã£ã¦ãã s-software.net ãã¡ã¤ã³ä¸ã« NuGet ã®ãã©ã¤ãã¼ããªãã¸ããªãæ§ç¯ãã¦ããããã¨æ¤è¨¼ãè¡ãã¾ããããã©ã¤ãã¼ããªãã¸ããªã®æ§ç¯ã¯è¨äºã«ãå°ãã ãæ¸ãã¾ããããHosting Your Own NuGet Feedsãã«ä½ãæ¹ãå ¨é¨æ¸ãã¦ãã¾ãã
ããããç§ã使ã£ã¦ãã ExpressWeb ã ã¨ãã®ã¾ã¾ã§ã¯åããªãã£ãã®ã§ããã®ããããè£è¶³ããªããã楽ãã NuGet ãã©ã¤ãã¼ããªãã¸ããªçæ´»ã楽ããã§é ãããã¨æãã¾ããããã§ã¯é çªã«èª¬æãã¦ããã¾ãã
空㮠ASP.NET Web ã¢ããªã±ã¼ã·ã§ã³ãä½æ
ã¤ãã¤ãç㧠ASP.NET MVC 3 åãã¢ããªãä½ã£ã¦ãã¾ãããã¾ãããä»åã¯æ®éã® ASP.NET ã¢ããªã±ã¼ã·ã§ã³ã§ããããã空ã£ã½ã®å¥´ã§ãã
ããã§ã¯ NuGet.Server ãã¤ã³ã¹ãã¼ã«ãã¦ããã¾ãããã
NuGet.Server ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«
Manage NuGet Packages ãã¤ã¢ãã°ã§ NuGet.Server ã¨å ¥ããã¨ããåºã¦ãã¾ãããããã¯
Install-Package NuGet.Server
ã§ãåé¡ãªãã§ããã¤ã³ã¹ãã¼ã«ãå®äºããã¨ããããã¨ãã¡ã¤ã«ãèªåçã«è¿½å ããã¦ãã¾ãã
ä¸ã§ã Packages ã¨ãããã£ã¬ã¯ããªã¯å®éã® NuGet ããã±ã¼ã¸ãæ ¼ç´ãããã®ã§éè¦ã§ãã
ãã®æç¹ã§ Packages ãã£ã¬ã¯ããªã« NuGet ããã±ã¼ã¸ãå ¥ããã¨ãã©ã¤ãã¼ããªãã¸ããªã¨ãã¦åä½ãã¾ããå®éã«ããã±ã¼ã¸ãå ¥ããF5 ãæ¼ãã¦åããã¦ã¿ã¾ãããã
NuGet.Server ã®ç¨¼åä¸ç»é¢ãåºã¦ãã¾ãããä¸çªä¸ã«åºã¦ãããã¹ã¯ãã¼ã«ã«ã§åä½ããã¦ããæã ã表示ããããã®ã§ãã
ãã㦠/nuget ã¸ã¢ã¯ã»ã¹ãã㨠OData ã§ãããããªæ å ±ãåããããã§ããå®éã«ã¯ /nuget ã¯ã¨ã³ããªãã¤ã³ããªã®ã§ /nuget/Packages ã¸ã¢ã¯ã»ã¹ãã¦ã¿ãã¨ããã©ã¦ã¶ã§ã¯ãã£ã¼ãã¨ãã¦èªèããã¾ãã
ã¢ã¯ã»ã¹ãã¼ãè¨å®
å®è¡ããæã«è¡¨ç¤ºããããã¼ã¸ã«ãWeb.config ã« apiKey ãè¨å®ããã¨æ¸ãã¦ããã¾ããããã¼ã«ã«ã§ Packages ãã£ã¬ã¯ããªãç°¡åã«å¼ããã®ãªãè¨å®ã¯ä¸è¦ã§ããããªã¢ã¼ããµã¼ãã§éç¨ããå ´åã«ã¯ããã±ã¼ã¸ã®è¿½å ãããã©ãããã§ããã
ãããªæ apiKey ãè¨å®ãã¦ããã° NuGet.exe ããããã·ã¥ã§ããããã«ãªã便å©ã§ãã
password ã¨æ¸ãã¦ã¾ãããé©å½ã«å¤ãã¦ãã ããããã㧠NuGet.exe ããããã·ã¥ã§ããããã«ãªãã¾ãããé常ã«ç°¡åã§ããã
ãµã¼ãã¼ã«ãããã¤
ããã§ã¯ ExpressWeb ã¸ãããã¤ãã¾ããããããµããã¡ã¤ã³ãå²ãå½ã¦ã¦ãæ®éã«ã¢ãããã¼ãããã ãã§ããã®ã§ãããå®éã«ã¢ã¯ã»ã¹ããã¨ä»¥ä¸ã®ãããªã¨ã©ã¼ãåºã¾ãã
ã¨ã©ã¼ã¡ãã»ã¼ã¸ã®éãã« multipleSiteBindingsEnabled="true" ã serviceModel ã«è¿½å ãã¦å¯¾å¿ãã¾ãããã
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel>
ããã§ã¨ã©ã¼ã¡ãã»ã¼ã¸ã表示ãããªããªãããã©ã¤ãã¼ããªãã¸ããªãåä½ããããã«ãªãã¾ãã
ããã§ãµã¼ãã¯åä½ããããã«ãªãã¾ãããããã®ã¾ã¾ã ã¨ããã±ã¼ã¸ã®è¿½å ãåºæ¥ã¾ãããåå 㯠Packages ãã£ã¬ã¯ããªã«æ¸ãè¾¼ã¿æ¨©éããªããããªã®ã§ããã¡ã¤ã«ããã¼ã¸ã£ããæ¸ãè¾¼ã¿æ¨©éãä»ãã¦ããã¾ãããã
ããã±ã¼ã¸ã追å
ããã§ã¯ããã±ã¼ã¸ã追å ãã¾ããããã³ãã³ã㯠NuGet gallery ã¨åãã§ããã-source ã§ãã©ã¤ãã¼ããªãã¸ããªã® URL ãæå®ããapiKey ã« Web.config ã«æ¸ãããã®ã¨åãæååãæå®ãã¾ãã
nuget push -source (url) MyPackage.1.0.nupkg (apiKey)
ãã£ãããã ãã§ããé常ã«ç°¡åã§ãããï¼
ASP.NET 4 ãåä½ãããµã¼ããªãåãã¯ããªã®ã§ãæ§ç¯ãã¦ãã¹ãç¨ã¨ä½¿ããããããã¼ã«ã«éå®ã«ãã¦ä½¿ãããããNuGet gallery ã«ç»é²ããã«ä½¿ãããªãã¸ããªãããã¯æã£ã¦ãã¦æã¯ãªãã¨æãã¾ããï¼