自包含.NET Core应用程序作为一个文件

时间:2017-07-14 09:42:41

标签: .net-core

是否可以将自包含的.NET Core应用程序作为一个文件发布?

现在如果我要复制它,那么我将不得不推送很多文件,如果它只是一个文件会很酷。

我这样做的方式是dotnet publish -c release -r ubuntu.16.04-x64。当然,我还在<RuntimeIdentifiers>ubuntu.16.04-x64</RuntimeIdentifiers>文件中添加了.csproj

&#34; Hello World&#34;控制台应用程序。

-rwxrw-r-- 1 stan stan  152024 Nov  8  2016 l*
-rwxrw-r-- 1 stan stan  126881 Jul 14 09:32 l.deps.json*
-rwxrw-r-- 1 stan stan    4096 Jul 14 09:32 l.dll*
-rwxrw-r-- 1 stan stan 2783048 Apr 11 17:58 libclrjit.so*
-rwxrw-r-- 1 stan stan 8580744 Apr 11 17:58 libcoreclr.so*
-rwxrw-r-- 1 stan stan  712200 Apr 11 17:58 libcoreclrtraceptprovider.so*
-rwxrw-r-- 1 stan stan 1045744 Apr 11 17:58 libdbgshim.so*
-rwxrw-r-- 1 stan stan 1013680 Nov  8  2016 libhostfxr.so*
-rwxrw-r-- 1 stan stan 1259848 Apr 28 19:12 libhostpolicy.so*
-rwxrw-r-- 1 stan stan 3637408 Apr 11 17:58 libmscordaccore.so*
-rwxrw-r-- 1 stan stan 2420536 Apr 11 17:58 libmscordbi.so*
-rwxrw-r-- 1 stan stan   90328 Apr 11 17:58 libsosplugin.so*
-rwxrw-r-- 1 stan stan  589472 Apr 11 17:58 libsos.so*
-rwxrw-r-- 1 stan stan  499051 Jul 14 08:42 libuv.so*
-rwxrw-r-- 1 stan stan     396 Jul 14 09:32 l.pdb*
-rwxrw-r-- 1 stan stan      26 Jul 14 09:32 l.runtimeconfig.json*
-rwxrw-r-- 1 stan stan 4211112 Jul 14 08:42 Microsoft.CodeAnalysis.CSharp.dll*
-rwxrw-r-- 1 stan stan 2049432 Jul 14 08:42 Microsoft.CodeAnalysis.dll*
-rwxrw-r-- 1 stan stan 5061040 Jul 14 08:42 Microsoft.CodeAnalysis.VisualBasic.dll*
-rwxrw-r-- 1 stan stan  450248 Jul 14 08:42 Microsoft.CSharp.dll*
-rwxrw-r-- 1 stan stan  188120 Jul 14 08:42 Microsoft.VisualBasic.dll*
-rwxrw-r-- 1 stan stan   25992 Nov  5  2016 Microsoft.Win32.Primitives.dll*
-rwxrw-r-- 1 stan stan   39816 Jul 14 08:42 Microsoft.Win32.Registry.dll*
-rwxrw-r-- 1 stan stan   31744 Apr 11 17:58 mscorlib.dll*
-rwxrw-r-- 1 stan stan   45056 Apr 11 17:58 mscorlib.ni.dll*
-rwxrw-r-- 1 stan stan   65418 Apr 11 17:58 sosdocsunix.txt*
-rwxrw-r-- 1 stan stan   15360 Apr 11 17:58 SOS.NETCore.dll*
-rwxrw-r-- 1 stan stan   21856 Jul 14 08:42 System.AppContext.dll*
-rwxrw-r-- 1 stan stan   27320 Jul 14 08:42 System.Buffers.dll*
-rwxrw-r-- 1 stan stan   93432 Jul 14 08:42 System.Collections.Concurrent.dll*
-rwxrw-r-- 1 stan stan   98504 Nov  5  2016 System.Collections.dll*
-rwxrw-r-- 1 stan stan  180984 Jul 14 08:42 System.Collections.Immutable.dll*
-rwxrw-r-- 1 stan stan   83368 Jul 14 08:42 System.ComponentModel.Annotations.dll*
-rwxrw-r-- 1 stan stan   21720 Jul 14 08:42 System.ComponentModel.dll*
-rwxrw-r-- 1 stan stan   93528 Nov  5  2016 System.Console.dll*
-rwxrw-r-- 1 stan stan   40832 Nov  5  2016 System.Diagnostics.Debug.dll*
-rwxrw-r-- 1 stan stan   35760 Jul 14 08:42 System.Diagnostics.DiagnosticSource.dll*
-rwxrw-r-- 1 stan stan   28584 Jul 14 08:42 System.Diagnostics.FileVersionInfo.dll*
-rwxrw-r-- 1 stan stan   88808 Jul 14 08:42 System.Diagnostics.Process.dll*
-rwxrw-r-- 1 stan stan   27544 Jul 14 08:42 System.Diagnostics.StackTrace.dll*
-rwxrw-r-- 1 stan stan   22400 Nov  5  2016 System.Diagnostics.Tools.dll*
-rwxrw-r-- 1 stan stan   37264 Nov  5  2016 System.Diagnostics.Tracing.dll*
-rwxrw-r-- 1 stan stan  114392 Jul 14 08:42 System.Dynamic.Runtime.dll*
-rwxrw-r-- 1 stan stan   23448 Nov  5  2016 System.Globalization.Calendars.dll*
-rwxrw-r-- 1 stan stan   22384 Nov  5  2016 System.Globalization.dll*
-rwxrw-r-- 1 stan stan   31136 Jul 14 08:42 System.Globalization.Extensions.dll*
-rwxrw-r-- 1 stan stan   70592 Apr 11 17:58 System.Globalization.Native.so*
-rwxrw-r-- 1 stan stan  117624 Jul 14 08:42 System.IO.Compression.dll*
-rwxrw-r-- 1 stan stan    7112 Nov  5  2016 System.IO.Compression.Native.so*
-rwxrw-r-- 1 stan stan   29592 Jul 14 08:42 System.IO.Compression.ZipFile.dll*
-rwxrw-r-- 1 stan stan   39232 Nov  5  2016 System.IO.dll*
-rwxrw-r-- 1 stan stan   98160 Nov  5  2016 System.IO.FileSystem.dll*
-rwxrw-r-- 1 stan stan   22432 Jul 14 08:42 System.IO.FileSystem.Primitives.dll*
-rwxrw-r-- 1 stan stan   55024 Jul 14 08:42 System.IO.FileSystem.Watcher.dll*
-rwxrw-r-- 1 stan stan   49552 Jul 14 08:42 System.IO.MemoryMappedFiles.dll*
-rwxrw-r-- 1 stan stan   45472 Jul 14 08:42 System.IO.UnmanagedMemoryStream.dll*
-rwxrw-r-- 1 stan stan  128840 Jul 14 08:42 System.Linq.dll*
-rwxrw-r-- 1 stan stan  458104 Jul 14 08:42 System.Linq.Expressions.dll*
-rwxrw-r-- 1 stan stan  224976 Jul 14 08:42 System.Linq.Parallel.dll*
-rwxrw-r-- 1 stan stan   69848 Jul 14 08:42 System.Linq.Queryable.dll*
-rwxrw-r-- 1 stan stan   93682 Nov  5  2016 System.Native.a*
-rwxrw-r-- 1 stan stan   57280 Nov  5  2016 System.Native.so*
-rwxrw-r-- 1 stan stan  288600 Jul 14 08:42 System.Net.Http.dll*
-rwxrw-r-- 1 stan stan   12608 Nov  5  2016 System.Net.Http.Native.so*
-rwxrw-r-- 1 stan stan   68488 Jul 14 08:42 System.Net.NameResolution.dll*
-rwxrw-r-- 1 stan stan  309104 Nov  5  2016 System.Net.Primitives.dll*
-rwxrw-r-- 1 stan stan   55664 Jul 14 08:42 System.Net.Requests.dll*
-rwxrw-r-- 1 stan stan  228200 Jul 14 08:42 System.Net.Security.dll*
-rwxrw-r-- 1 stan stan    9696 Nov  5  2016 System.Net.Security.Native.so*
-rwxrw-r-- 1 stan stan  221032 Nov  5  2016 System.Net.Sockets.dll*
-rwxrw-r-- 1 stan stan   32504 Jul 14 08:42 System.Net.WebHeaderCollection.dll*
-rwxrw-r-- 1 stan stan  158080 Jul 14 08:42 System.Numerics.Vectors.dll*
-rwxrw-r-- 1 stan stan   49352 Jul 14 08:42 System.ObjectModel.dll*
-rwxrw-r-- 1 stan stan 2281472 Apr 11 17:58 System.Private.CoreLib.dll*
-rwxrw-r-- 1 stan stan 9568256 Apr 11 17:58 System.Private.CoreLib.ni.dll*
-rwxrw-r-- 1 stan stan  125800 Nov  5  2016 System.Private.Uri.dll*
-rwxrw-r-- 1 stan stan   42400 Jul 14 08:42 System.Reflection.DispatchProxy.dll*
-rwxrw-r-- 1 stan stan   22880 Nov  5  2016 System.Reflection.dll*
-rwxrw-r-- 1 stan stan   22392 Jul 14 08:42 System.Reflection.Emit.dll*
-rwxrw-r-- 1 stan stan   22960 Jul 14 08:42 System.Reflection.Emit.ILGeneration.dll*
-rwxrw-r-- 1 stan stan   22952 Jul 14 08:42 System.Reflection.Emit.Lightweight.dll*
-rwxrw-r-- 1 stan stan   24816 Nov  5  2016 System.Reflection.Extensions.dll*
-rwxrw-r-- 1 stan stan  452840 Jul 14 08:42 System.Reflection.Metadata.dll*
-rwxrw-r-- 1 stan stan   22256 Nov  5  2016 System.Reflection.Primitives.dll*
-rwxrw-r-- 1 stan stan   29600 Jul 14 08:42 System.Reflection.TypeExtensions.dll*
-rwxrw-r-- 1 stan stan   32992 Jul 14 08:42 System.Resources.Reader.dll*
-rwxrw-r-- 1 stan stan   22784 Nov  5  2016 System.Resources.ResourceManager.dll*
-rwxrw-r-- 1 stan stan   39768 Nov  5  2016 System.Runtime.dll*
-rwxrw-r-- 1 stan stan   75648 Nov  5  2016 System.Runtime.Extensions.dll*
-rwxrw-r-- 1 stan stan   22904 Nov  5  2016 System.Runtime.Handles.dll*
-rwxrw-r-- 1 stan stan   34200 Nov  5  2016 System.Runtime.InteropServices.dll*
-rwxrw-r-- 1 stan stan   27616 Jul 14 08:42 System.Runtime.InteropServices.RuntimeInformation.dll*
-rwxrw-r-- 1 stan stan   22232 Jul 14 08:42 System.Runtime.Loader.dll*
-rwxrw-r-- 1 stan stan   71392 Jul 14 08:42 System.Runtime.Numerics.dll*
-rwxrw-r-- 1 stan stan   57720 Jul 14 08:42 System.Security.Claims.dll*
-rwxrw-r-- 1 stan stan   92608 Jul 14 08:42 System.Security.Cryptography.Algorithms.dll*
-rwxrw-r-- 1 stan stan   31136 Jul 14 08:42 System.Security.Cryptography.Cng.dll*
-rwxrw-r-- 1 stan stan   24992 Jul 14 08:42 System.Security.Cryptography.Csp.dll*
-rwxrw-r-- 1 stan stan   47032 Jul 14 08:42 System.Security.Cryptography.Encoding.dll*
-rwxrw-r-- 1 stan stan   75656 Jul 14 08:42 System.Security.Cryptography.Native.OpenSsl.so*
-rwxrw-r-- 1 stan stan   56240 Jul 14 08:42 System.Security.Cryptography.OpenSsl.dll*
-rwxrw-r-- 1 stan stan   45504 Jul 14 08:42 System.Security.Cryptography.Primitives.dll*
-rwxrw-r-- 1 stan stan  164312 Jul 14 08:42 System.Security.Cryptography.X509Certificates.dll*
-rwxrw-r-- 1 stan stan   21736 Jul 14 08:42 System.Security.Principal.dll*
-rwxrw-r-- 1 stan stan   29608 Jul 14 08:42 System.Security.Principal.Windows.dll*
-rwxrw-r-- 1 stan stan  759712 Jul 14 08:42 System.Text.Encoding.CodePages.dll*
-rwxrw-r-- 1 stan stan   22384 Nov  5  2016 System.Text.Encoding.dll*
-rwxrw-r-- 1 stan stan   22944 Nov  5  2016 System.Text.Encoding.Extensions.dll*
-rwxrw-r-- 1 stan stan  113912 Jul 14 08:42 System.Text.RegularExpressions.dll*
-rwxrw-r-- 1 stan stan   50016 Jul 14 08:42 System.Threading.dll*
-rwxrw-r-- 1 stan stan   23440 Jul 14 08:42 System.Threading.Overlapped.dll*
-rwxrw-r-- 1 stan stan  179104 Jul 14 08:42 System.Threading.Tasks.Dataflow.dll*
-rwxrw-r-- 1 stan stan   26488 Nov  5  2016 System.Threading.Tasks.dll*
-rwxrw-r-- 1 stan stan   25864 Jul 14 08:42 System.Threading.Tasks.Extensions.dll*
-rwxrw-r-- 1 stan stan   58112 Jul 14 08:42 System.Threading.Tasks.Parallel.dll*
-rwxrw-r-- 1 stan stan   22400 Jul 14 08:42 System.Threading.Thread.dll*
-rwxrw-r-- 1 stan stan   22416 Jul 14 08:42 System.Threading.ThreadPool.dll*
-rwxrw-r-- 1 stan stan   22392 Nov  5  2016 System.Threading.Timer.dll*
-rwxrw-r-- 1 stan stan  606592 Jul 14 08:42 System.Xml.ReaderWriter.dll*
-rwxrw-r-- 1 stan stan  111312 Jul 14 08:42 System.Xml.XDocument.dll*
-rwxrw-r-- 1 stan stan  138104 Jul 14 08:42 System.Xml.XmlDocument.dll*
-rwxrw-r-- 1 stan stan  187744 Jul 14 08:42 System.Xml.XPath.dll*
-rwxrw-r-- 1 stan stan   36744 Jul 14 08:42 System.Xml.XPath.XDocument.dll*

我想要实现的目标

-rwxrw-r-- 1 stan stan {a lot of megabytes} Nov  8  2016 l*

1 个答案:

答案 0 :(得分:0)

嗯,你不需要大多数这些文件用于普通的hello world应用程序,但不,在.NET Core应用程序中没有静态链接,至少现在还没有。那里有proposal for static linking个位,但我不相信它会被用掉。