[netcore] Use mono-netcore to run real world apps using `dotnet run` (#15942)
commitd0aa0310ee386433a9ef0b4c15ac07c928211bcb
authorEgor Bogatov <egorbo@gmail.com>
Fri, 2 Aug 2019 15:06:37 +0000 (2 18:06 +0300)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 2 Aug 2019 15:06:37 +0000 (2 17:06 +0200)
treee509472825441bc39476f715da252d1b08c3814e
parent40f28b2e6371c708989ff59dd1cb4f7dcc22aedc
[netcore] Use mono-netcore to run real world apps using `dotnet run` (#15942)

So currently we have two .NET Core:

1) `mono-repo/.dotnet` - we use it to bootstrap and build stuff (the SDK version is specified in `global.json`) - if you open `netcore/Makefile` it's referred there as `$(DOTNET)` variable.
2) `mono-repo/netcore/.dotnet` - it's just a runtime + CoreFX libs (it doesn't contain SDK stuff, templates, msbuild, etc) - we use it only to run tests because this runtime is synchronized with corefx tests in `eng/Versions.prop` file which is updated by a bot and `netcore/shared` sources for our System.Private.CoreLib also depend on that exact runtime version (the sources also updated by the bot).

This PR introduces a rule to copy mono bits to the `mono-repo/.dotnet` folder to be able to run real world apps (at your own risk) using mono-netcore (so when you run `mono-root/.dotnet/.dotnet run -c Release` for an app - even MSBuild will use mono runtime to build that app). However in theory we need exact SDK for the runtime version we have but I have no idea where and how to get one.

BTW, currently MSBuild crashes when it's powered by mono on `$(DOTNET) build` command for a hello world.
```
monoeg_assertion_message
mono_domain_assembly_preload
invoke_assembly_preload_hook
...
at <unknown> <0xffffffff>
at System.Reflection.RuntimeAssembly:GetExportedTypes <0x000a2>
at AssemblyInfoToLoadedTypes:ScanAssemblyForPublicTypes <0x0008e>
```
eng/Versions.props
global.json
netcore/Makefile