Windows 10ã§ã¯ããããŒãžèšèªïŒCïŒãVBïŒã®WindowsããŒã¹ã®ãŠãããŒãµã«ã¢ããªã±ãŒã·ã§ã³ã¯ã.NET Nativeã䜿çšããŠã¹ãã¢ã®ã³ã³ãã€ã«ããã»ã¹ãçµãŠãã·ã³ã³ãŒãã«ãªããŸãã ãã®èšäºã§ã¯ããããã©ã®ããã«æ©èœãããããã¢ããªã±ãŒã·ã§ã³éçºããã»ã¹ã«ã©ã®ããã«åœ±é¿ãããã«ã€ããŠããã«åŠã¶ããšãå§ããŸãã 以äžã«ã.NET NativeéçºããŒã ã®ä»£è¡šè ãšã®ãããªã€ã³ã¿ãã¥ãŒããã³é¢é£èšäºã®ç¿»èš³ã瀺ããŸãã
.NET Nativeãšã¯äœã§ããïŒ
.NET Nativeã¯ãVisual Studio 2015ã§ãŠãããŒãµã«Windowsã¢ããªã±ãŒã·ã§ã³ãäœæããããã«äœ¿çšãããããªã³ã³ãã€ã«ãã¯ãããžã§ãã.NETNativeããŒã«ã¯ããããŒãžã³ãŒãILã©ã€ãã©ãªããã€ãã£ãã©ã€ãã©ãªã«ã³ã³ãã€ã«ããŸãã åãããŒãžïŒCïŒãŸãã¯VBïŒãŠãããŒãµã«Windowsã¢ããªã±ãŒã·ã§ã³ã¯ããã®ãã¯ãããžãŒã䜿çšããŸãã ã¢ããªã±ãŒã·ã§ã³ã¯ããšã³ãããã€ã¹ã«å°éããåã«èªåçã«ãã€ãã£ãã³ãŒãã«ã³ã³ãã€ã«ãããŸãã ãããã©ã®ããã«æ©èœããããããã«è©³ããç¥ãããå Žåã¯ãèšäºã .NETãã·ã³ã³ãŒãã䜿çšããã¢ããªã±ãŒã·ã§ã³ã®ã³ã³ãã€ã« ãããå§ãããŸã ã
.NET Nativeã¯ç§ãšã¢ããªã±ãŒã·ã§ã³ã«ã©ã®ãããªåœ±é¿ãäžããŸããïŒ
ç¹å®ã®ã€ã³ãžã±ãŒã¿ãŒã¯ç°ãªãå ŽåããããŸãããã»ãšãã©ã®å Žåãã¢ããªã±ãŒã·ã§ã³ã¯ããéãèµ·åããããéãå®è¡ãããã·ã¹ãã ãªãœãŒã¹ã®æ¶è²»ã¯å°ãªããªããŸãã
- ã³ãŒã«ãã¹ã¿ãŒãé床ãæ倧60ïŒ åäž
- ãããã¹ã¿ãŒãé床ãæ倧40ïŒ åäž
- ãã·ã³ã³ãŒããžã®ã³ã³ãã€ã«æã®ã¡ã¢ãªæ¶è²»éã®åæž
- ã€ã³ã¹ããŒã«äžã«ãã¹ã¯ããã.NââETã©ã³ã¿ã€ã ã«äŸåããªã
ã¢ããªã±ãŒã·ã§ã³ã¯ãã€ãã£ãã³ãŒãã«ã³ã³ãã€ã«ãããããããã€ãã£ãã³ãŒãã®å®è¡é床ã«é¢é£ããããã©ãŒãã³ã¹ã®åäžãåŸãããŸãïŒC ++ããã©ãŒãã³ã¹ã«è¿ãïŒã ãã ããç£æ¥çšããã°ã©ãã³ã°èšèªã®CïŒãŸãã¯VBããã³é¢é£ããŒã«ãåŒãç¶ãå©çšã§ããŸãã
ãŸããããžãã¹ããžãã¯ãèšè¿°ããããã®ããŸããŸãªAPIãããã³çµã¿èŸŒã¿ã®ã¡ã¢ãªç®¡çãšäŸå€åŠçã¡ã«ããºã ãåãã.NETã§å©çšå¯èœãªããã°ã©ãã³ã°ã¢ãã«ã®å šæ©èœãåŒãç¶ã䜿çšã§ããŸãã
ã€ãŸããC ++ã«è¿ãããã©ãŒãã³ã¹ãåãããããŒãžãéçºãšãããäž¡æ¹ã®é·æãæ倧éã«æŽ»çšã§ããŸãã ããã¯çŽ æŽãããããšã§ã¯ãããŸãããïŒ
ãããã°ãšãªãªãŒã¹ã®ã³ã³ãã€ã«èšå®ã®éã
.NET Nativeã§ã®ã³ã³ãã€ã«ã¯è€éãªããã»ã¹ã§ãããéåžžã¯.NETã§ã®åŸæ¥ã®ã³ã³ãã€ã«ã«æ¯ã¹ãŠæéãããããŸãã äžèšã®å©ç¹ã¯ãã³ã³ãã€ã«æã«äŸ¡æ Œãèšå®ãããŸãã ã¢ããªã±ãŒã·ã§ã³ãå®è¡ãããã³ã«ãã€ãã£ãã«ã³ã³ãã€ã«ããããšãéžæã§ããŸããããã«ããå®äºãããŸã§åŸ æ©ããæéãé·ããªããŸãã Visual StudioããŒã«ã¯ãéçºçµéšãå¯èœãªéãã¹ã ãŒãºã«ããããšã§ããããããé©åã«ç®¡çããã®ã«åœ¹ç«ã¡ãŸãã
ãããžã§ã¯ãããã«ãããŠãããã°ã¢ãŒãã§å®è¡ãããšãã¢ããªã±ãŒã·ã§ã³ã«ããã±ãŒãžåãããCoreCLRã®äžã«ILã³ãŒãã䜿çšãããŸãã .NETã·ã¹ãã ã¢ã»ã³ããªãã¢ããªã±ãŒã·ã§ã³ã³ãŒãã«è¿œå ãããã¢ããªã±ãŒã·ã§ã³ã¯Microsoft.NET.CoreRuntimeïŒCoreCLRïŒããã±ãŒãžãžã®äŸåé¢ä¿ãèæ ®ããŸãã
ããã¯ãå¯èœãªéãæé«ã®éçºäœéšãåŸãããããšãæå³ããŸããã€ãŸããé«éãªã³ã³ãã€ã«ãšå±éãåºç¯ãªãããã°ãšèšºæãããã³.NETã§éçºãããšãã«äœ¿çšããä»ã®ãã¹ãŠã®ããŒã«ã®ããã©ãŒãã³ã¹ã§ãã
ãªãªãŒã¹ã¢ãŒãã«åãæ¿ãããšãããã©ã«ãã§ãã¢ããªã±ãŒã·ã§ã³ã¯.NET Nativeãã«ããã§ãŒã³ã䜿çšããŠèµ·åããŸãã ããã±ãŒãžã¯ãã·ã³ã³ãŒãã«ã³ã³ãã€ã«ããããããããã±ãŒãžã«.NET Frameworkã©ã€ãã©ãªãå«ãŸããŠããå¿ èŠã¯ãªããªããŸããã ããã«ãCoreCLRããã±ãŒãžãšã¯ç°ãªããããã±ãŒãžã¯ææ°ããŒãžã§ã³ã®.NET Nativeç°å¢ã«äŸåããããã«ãªããŸããã ããã€ã¹äžã®.NET Nativeã©ã³ã¿ã€ã ã¯ãåžžã«ã¢ããªã±ãŒã·ã§ã³ããã±ãŒãžãšäºææ§ããããŸãã
ãªãªãŒã¹æ§æã®ããŒã«ã«ãã€ãã£ãã³ã³ãã€ã«ã䜿çšãããšããšã³ããŠãŒã¶ãŒã®ç°å¢ã«è¿ãç°å¢ã§ã¢ããªã±ãŒã·ã§ã³ããã¹ãã§ããŸãã éçºäžã¯ããã®ã¢ãŒãã§å®æçã«ãã¹ãããããšãéèŠã§ãã
æ £ããã®ã«è¯ãçµéšåã¯ãéçºããã»ã¹äžã«ãã®æ¹æ³ã§ã¢ããªã±ãŒã·ã§ã³ããã¹ããã.NET Nativeã§ã®ã³ã³ãã€ã«ã«èµ·å ããåé¡ãèŠã€ããŠä¿®æ£ããããšã§ãã ã»ãšãã©ã®å Žåãåé¡ã¯çºçããŸãããã.NET Nativeã§ã¯ããŸãæ©èœããªãããã€ãã®ããšãç¥ã£ãŠããŸãã ããšãã°ã4ãã倧ãã次å ãæã€é åã æçµçã«ããŠãŒã¶ãŒã¯.NET Nativeãä»ããŠã³ã³ãã€ã«ãããã¢ããªã±ãŒã·ã§ã³ã®ããŒãžã§ã³ãåãåããããã¢ããªã±ãŒã·ã§ã³ãé ä¿¡ãããåã«ãã¹ãŠãäºåã«æ©èœããããšã確èªããŠãããšäŸ¿å©ã§ãã
ãã€ãã£ãã³ã³ãã€ã«ã¢ãŒãã§ãã¹ãããã®ã«é©ããŠããã ãã§ãªããAnyCPUã¢ã»ã³ããªã®æ§ææ§æãæ¶ããŠããããšã«ãæ°ä»ãããšãã§ããŸãã .NET Nativeã®ç»å Žã«ããããã€ãã£ãã³ã³ãã€ã«ã¯ã¢ãŒããã¯ãã£ã«äŸåãããããAnyCPUã®æ§æã¯æå³ãæããªããªããŸããã ããã®è¿œå ã®çµæã¯ãã¢ããªã±ãŒã·ã§ã³ãããã±ãŒãžåãããšãã«ã3ã€ã®ã¢ãŒããã¯ãã£æ§æïŒx86ãx64ãããã³ARMïŒããã¹ãŠéžæããŠãã¢ããªã±ãŒã·ã§ã³ãã§ããã ãå€ãã®ããã€ã¹ã§å®è¡ãããããã«ããå¿ èŠãããããšã§ãã ããã§ããããã¯ãŠãããŒãµã«Windowsãã©ãããã©ãŒã ã§ãïŒ ããã©ã«ãã§ã¯ãVisual Studioã¯ã以äžã®ã¹ã¯ãªãŒã³ã·ã§ããã«ç€ºãããã«ãŸã£ããåãæ¹æ³ã§ãã«ãããããã«æ§æãããŠããŸãã
ããã©ã«ãã§ã¯ã3ã€ã®ã¢ãŒããã¯ãã£ããã¹ãŠéžæãããŠããŸãã
AnyCPUã©ã€ãã©ãªãæ§ç¯ããUWPã¢ããªã±ãŒã·ã§ã³ã§é©åãªDLLã䜿çšã§ããããšã«æ³šæããããšãéèŠã§ãã ãããã®ã³ã³ããŒãã³ãã¯ããããžã§ã¯ãèšå®ã§æå®ããã察å¿ããã¢ãŒããã¯ãã£ã®ãã€ããªã©ã€ãã©ãªã«ã³ã³ãã€ã«ãããŸãã
æåŸã«ã.NET Nativeãžã®åãæ¿ãããçãããããç¥ãããã¢ãããŒãã®æåŸã®éèŠãªå€æŽã¯ãã¹ãã¢çšã®ããã±ãŒãžã®äœææ¹æ³ã§ãã .NET Nativeã®äž»èŠãªæ©èœã®1ã€ã¯ãã³ã³ãã€ã©ãã¯ã©ãŠãã§åäœã§ããããšã§ãã Visual Studioã§ã¹ãã¢ã®ããã±ãŒãžãäœæãããšãã¹ãã¢çšã®.appxuploadãšããŒã«ã«ã€ã³ã¹ããŒã«çšã®ãtestã.appxã®2ã€ã®ããã±ãŒãžãäœæãããŸãã .appxuploadããã±ãŒãžã«ã¯ãMSILã¢ã»ã³ããªãšãã¢ããªã±ãŒã·ã§ã³ïŒAppxManifest.xmlã§æå®ïŒã§äœ¿çšããã.NET Nativeã®ããŒãžã§ã³ãžã®æ瀺çãªåç §ãå«ãŸããŠããŸãã ãã®åŸããã®ããã±ãŒãžã¯ã¹ãã¢ã«éä¿¡ãããåãããŒãžã§ã³ã®.NET Nativeã³ã³ãã€ã«ãã§ãŒã³ã䜿çšããŠã³ã³ãã€ã«ãããŸãã ã³ã³ãã€ã©ã¯ã¯ã©ãŠãå ã«ãããããã¢ããªã±ãŒã·ã§ã³ãããŒã«ã«ã§åã³ã³ãã€ã«ããããšãªããã°ãä¿®æ£ããããã«åå©çšã§ããŸãã
.appxuploadããã±ãŒãžãã¹ãã¢ã«éä¿¡ãããŸãã ãã¹ããã©ã«ããŒã«ã¯ãããŒã«ã«ã€ã³ã¹ããŒã«çšã®appxããã±ãŒãžãå«ãŸããŠããŸã
ããã®2ã€ã®çµæïŒæåã«ãéçºè ãšããŠãã¢ããªã±ãŒã·ã§ã³ã®ãªããžã§ã³çªå·ïŒ4çªç®ã®çªå·ïŒã«ã¢ã¯ã»ã¹ã§ããªããªããŸãã äœããã®çç±ã§ã¯ã©ãŠãã§ã®åã³ã³ãã€ã«ãå¿ èŠãªå Žåãã¹ãã¢ã¯ãã®çªå·ãã¢ããªã±ãŒã·ã§ã³ããã±ãŒãžã®ããŒãžã§ã³ç®¡çæ¹æ³ãšããŠäºçŽããŸãã å¿é ããå¿ èŠã¯ãããŸããã ä»ã®3ã€ã®çªå·ãåŒãç¶ãå¶åŸ¡ã§ããŸã ã
2çªç®ã«çæããå¿ èŠãããã®ã¯ãã¹ãã¢ã«ã¢ããããŒãããããã±ãŒãžã«ã€ããŠæ³šæããå¿ èŠããããšããããšã§ãã ã¹ãã¢ã¯ãã·ã³ã³ãŒãã«ã³ã³ãã€ã«ããããããããŒã«ã«ã®.NETãã€ãã£ãã³ã³ãã€ã©ã«ãã£ãŠäœæããããã€ãã£ãã¢ã»ã³ããªãèªã¿èŸŒãããšã¯ã§ããŸããã Visual Studioã¯ããããææ¡ããŠé©åãªããã±ãŒãžãéžæã§ããããã«ããŸãã
ãã¯ãããéžæããŠã¹ãã¢ã«ã¢ããããŒãããŸãã
ãã«ããŒã䜿çšããŠã¢ããªã±ãŒã·ã§ã³ããã±ãŒãžãäœæããå Žåãã¹ãã¢ã«ã¢ããããŒãããããã±ãŒãžãäœæãããã©ãããVisual Studioããå°ãããããã[ã¯ã]ãéžæããå¿ èŠããããŸãã ãŸãããã¢ããªãã³ãã«ã®çæããªãã·ã§ã³ã«ãåžžã«ããéžæããããšããå§ãããŸããããã«ãããããŠã³ããŒãã®æºåãã§ããåäžã®.appxuploadãã¡ã€ã«ãäœæãããŸãã ã¹ãã¢çšã®ããã±ãŒãžã®äœæã«é¢ãã詳现ãªèª¬æã¯ãèšäºã Windows 10çšã®ãŠãããŒãµã«Windowsã¢ããªã±ãŒã·ã§ã³ã®ããã±ãŒãžå ããåç §ããŠãã ããã
ãã®çµæãäœæ¥æ¹æ³ã®äž»ãªå€æŽç¹ã¯ã.NET Nativeã®äœ¿çšã«ãããã®ã§ãã
- ãªãªãŒã¹ã¢ãŒãã§ã¢ããªãå®æçã«ãã¹ãããŸãã
- ããã±ãŒãžã®ãªããžã§ã³çªå·ã0ã®ãŸãŸã«ããŠãã ãããVisualStudioã§ã¯å€æŽã§ããŸããããä»ã®ãšãã£ã¿ãŒã§ã¯å€æŽã§ããŸããã
- ã¹ãã¢ã®ããã±ãŒãžã®äœæäžã«åéããã.appxuploadã®ã¿ãã¹ãã¢ã«ã¢ããããŒãããŸã.UWPã¢ããªã±ãŒã·ã§ã³ã®.appxãããŠã³ããŒããããšãã¹ãã¢ã§ãšã©ãŒã衚瀺ãããŸãã
.NET Nativeã䜿çšããããã®è¿œå ã®ãã³ã
.NET Nativeãçãããåé¡ã«ééããå Žåããã®ãããªåé¡ã®ãããã°ã«åœ¹ç«ã€ãã¯ããã¯ããããŸãã ããã©ã«ãã§ã¯ããªãªãŒã¹æ§æã«ããã³ãŒããæé©åããããããã°ã§äœ¿çšãããã¢ãŒãã£ãã¡ã¯ãã®äžéšã倱ãããŸãã ãã®çµæããªãªãŒã¹æ§æããããã°ããããšãããšè€éã«ãªããŸãã 代ããã«ã.NETãã€ãã£ãã³ã³ãã€ã«ã䜿çšã§ããããã«ããããšã§ãç¬èªã®æ§æãäœæã§ããŸãã ã³ãŒããæé©åããŠããªãããšã確èªããŠãã ããã ããã«ã€ããŠã¯ããã NETãã€ãã£ãWindowsãŠãããŒãµã«ã¢ããªã®ãããã° ãã®èšäºã§è©³ãã説æããŠããŸã ã
åé¡ããããã°ããæ¹æ³ãããã£ãã®ã§ããããåé¿ããæ¹æ³ãåŠã¶ã®ã¯ããã«è¯ãããšã§ã¯ãªãã§ããããïŒ ãããè¡ãã«ã¯ãNuGetã䜿çšããŠMicrosoft.NETNative.Analyzerãã¢ããªã±ãŒã·ã§ã³ã«é 眮ããŸãïŒããã±ãŒãžç®¡çã³ã³ãœãŒã«ãããInstall-Package Microsoft.NETNative.Analyzerãã³ãã³ãã䜿çšã§ããŸãïŒã éçºäžã«ãã³ãŒãã.NET Nativeã³ã³ãã€ã©ãšäºææ§ããªãå Žåãã¢ãã©ã€ã¶ã¯èŠåã衚瀺ããŸãã äºææ§ã®ãªã.NETã¹ããŒã¹ã®å°ããªãµãã»ããããããŸãããã»ãšãã©ã®ã¢ããªã±ãŒã·ã§ã³ã¯ãã®ãããªåé¡ã«ééããããšã¯ãããŸããã
.NET Nativeãžã®åãæ¿ãããããŠã³ããŒãæéã®æ¹åãç¬ç«ããŠè©äŸ¡ãããå Žåã¯ãèªåã§æž¬å®ã§ããŸãã
æ¢ç¥ã®åé¡ãšè§£æ±ºç
Windows Application Certification KitïŒWACKïŒã䜿çšããŠã¢ããªã±ãŒã·ã§ã³ããã¹ãããéã«çæãã¹ãç¹ãããã€ããããŸãã
- ã³ã³ãã€ã«æé ãå®äºããŠããªãUWPã¢ããªã±ãŒã·ã§ã³ã§WACKãå®è¡ãããšãé倧ãªåé¡ãçºçããŸãã 次ã®ããã«ãªããŸãã
- uwphost.dllã®API ExecuteAssemblyã¯ããã®ã¢ããªã±ãŒã·ã§ã³ã¿ã€ãã§ã¯ãµããŒããããŠããŸããã App.exeã¯ãã®APIãåŒã³åºããŸãã
- uwphost.dll APIã®DllGetActivationFactoryã¯ããã®ã¢ããªã±ãŒã·ã§ã³ã¿ã€ãã§ã¯ãµããŒããããŠããŸããã App.exeã«ã¯ããã®APIã«è»¢éãããšã¯ã¹ããŒãããããŸãã
- ap-ms-win-core-synch-11-1-0.dllã®API OpenSemaphoreã¯ããã®ã¢ããªã±ãŒã·ã§ã³ã¿ã€ãããµããŒãããŠããŸããã System.Threading.dllã¯ãã®APIãåŒã³åºããŸãã
- api-ms-win-core-kernel32-legacy-11-1-0.dllã®API CreateSemaphoreã¯ããã®ã¢ããªã±ãŒã·ã§ã³ã¿ã€ãã§ã¯ãµããŒããããŠããŸããã System.Threading.dllã¯ãã®APIãåŒã³åºããŸãã
解決çã¯ãããã±ãŒãžãæ£ããäœæããé©åãªããã±ãŒãžã§WACKãå®è¡ããããšã確èªããããšã§ãã ãã®åé¡ãåé¿ããã«ã¯ ã ãã«ãã®æšå¥šäºé ã«åŸã£ãŠãã ããã
- ãªãã¬ã¯ã·ã§ã³ã䜿çšãã.NET Nativeã®ã¢ããªã±ãŒã·ã§ã³ã¯ãWindows App Network KitïŒWACKïŒã§å€±æããŠãä¿®æ£ã®ããã«Windows.Networking.Vpnãžã®ãªã³ã¯ã衚瀺ãããããšããããŸãã åé¡ã解決ããã«ã¯ãrd.xmlãã¡ã€ã«ã«æ¬¡ã®è¡ãè¿œå ããããã±ãŒãžãåæ§ç¯ããŸãã
< Namespace Name=âWindows.Networking.Vpnâ Dynamic=âExcludedâ Serialize=âExcludedâ Browse=âExcludedâ Activate=âExcludedâ />
ãŸãšãããš
ãã¹ãŠã®WindowsãŠãŒã¶ãŒã¯ã.NET Nativeã䜿çšããããšã§æ©æµãåããã¯ãã§ãã ã¹ãã¢ã®ç®¡ç察象ã¢ããªã±ãŒã·ã§ã³ã¯ãããé«éã«èµ·åããã³å®è¡ãããŸãã éçºè ã¯Visual Studioã§.NETã®éçºçµéšãçµã¿åãããããšãã§ãããŠãŒã¶ãŒã¯ãã€ãã£ãã³ãŒãããçç£æ§ã®åäžã享åã§ããŸãã ããªãã®çµéšãåžæã«ã€ããŠã話ãããå Žåã¯ã UserVoiceã䜿çšããŠãã ããã ãšã©ãŒãå ±åããå Žåã¯ã æ¥ç¶ã«é¢ããæ å ±ãå ¥åããŠãã ããã