Less dll-files in published directory


#1

Hi

I playing around with Dot.NET core.

I´m using: 1.0.0-preview2-003121, on a windows 7 x64.

Creating a project:

  1. mkdir helloWorld
  2. dotnet new
  3. dotnet restore

Then I remove the “type”: “platform”, property from the “Microsoft.NETCore.App” dependencies in the package.json file.

I also adding a runtime property:
“runtimes”: { “win7-x64”: {}}

Then I run:
dotnet publish

This will produce a published folder with 239 files.
The program only using the System.Console (and some host-files for dot.net core). It is possible to limit the use of dll-files then publish the application?

My goal is to have a “standalone”/“bundled” application, that do not required any Dot.NET runtime (installed on the target host).

// Micke


#2

their is no way if you want a standalone application, Your only option is shared application to limit the size. But in the next year or so , their will be corert ( https://github.com/dotnet/corert ) , a new runtime and tools that will compile .net core applications into native single executable. Currently corert only works for simple hello world and uwp applications but it will be expanded to support other types of applications in the future and will be made to work on linux and mac too.


#3

You can limit the dependencies for a self-contained Hello World application to:

"dependencies": {
  "Microsoft.NETCore.DotNetHostPolicy": "1.0.1",
  "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2",
  "System.Console": "4.0.0"
}

For me, that brings down the file count from 239 down to 158. Though a lot of those files are required because of Windows 7. For win10-x64, the count goes down to 35.


.NET Foundation Website | Blog | Projects | Code of Conduct