从wiki for the main "aspnet" GitHub repo人中:
"The DNX is an SDK containing all of the bits needed to build and run an application, including the CLR in the case of Core CLR. It can be bin deployed with your application...".
我有点不明白这到底意味着什么.基于这个描述,以及我在微软公告和博客文章中看到的其他 comments ,你似乎可以 Select ASP.NET 5应用程序,并创建一个没有外部依赖项的自包含包.该Bundle 包将包括您的代码、DNX runner、~11MB的CoreCLR,以及您可能使用的任何其他NuGet依赖项."运行应用程序所需的所有信息",随时准备投入到一台干净的目标机器上.
然而,当我使用dnu publish
时,情况并非如此.生成的包包含我的代码,以及我实际使用的标准库片段的DLL.然而,它并没有吸引整个CoreCLR...而且它肯定不会引入DNX.我的project.json
文件中的run
命令被转换为run.cmd
批处理文件,如下所示:
@"dnx.exe" --appbase "%~dp0approot\src\ConsoleApplication" Microsoft.Framework.ApplicationHost run %*
... 表明DNX预计已经安装在目标系统上,不在该Bundle 包中.
Am I missing something fundamental here? If you need DNX installed on the target system, then I'm not sure what advantages are provided by this approach at all. Is there an additional step that one can take, to publish a bundle that has DNX and CoreCLR fully baked-in and self-contained?
我看到dnu publish
有一个可选的--native
参数,但我不确定这是否相关.该参数希望您指定运行时.当我使用"clr"时,我得到错误消息"Native image generation is only supported for .NET Core flavors
".当我使用"coreclr"时,我得到这个难看的堆栈跟踪:
C:\Users\Steve\Desktop\ConsoleApplication>dnu publish --native --runtime active
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Framework.Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Framework.Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.Framework.Project'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.Framework.PackageManager.Publish.NativeImageGenerator.<>c.<Create>b__4_0(String r)
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at Microsoft.Framework.PackageManager.Publish.NativeImageGenerator.Create(PublishOptions options, PublishRoot root, IEnumerable`1 contexts)
at Microsoft.Framework.PackageManager.Publish.PublishManager.Publish()
at Microsoft.Framework.PackageManager.Program.<>c__DisplayClass3_2.<Main>b__4()
at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.Framework.PackageManager.Program.Main(String[] args)
System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.Framework.Project'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)