diff options
author | Egor Bogatov <egorbo@gmail.com> | 2019-08-02 18:06:37 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-08-02 18:06:37 +0300 |
commit | d0aa0310ee386433a9ef0b4c15ac07c928211bcb (patch) | |
tree | e509472825441bc39476f715da252d1b08c3814e /netcore | |
parent | 40f28b2e6371c708989ff59dd1cb4f7dcc22aedc (diff) |
[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>
```
Diffstat (limited to 'netcore')
-rw-r--r-- | netcore/Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/netcore/Makefile b/netcore/Makefile index 902c0c49a49..6cc2710b647 100644 --- a/netcore/Makefile +++ b/netcore/Makefile @@ -9,6 +9,10 @@ ROSLYN_VERSION:= $(shell cat ../eng/Versions.props | sed -n 's/.*MicrosoftNetCo # Extracted from https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/master/latest.version ASPNETCOREAPP_VERSION := 3.0.0-preview-18614-0151 +# runtime version used by $(DOTNET) - local .net core sdk to bootstrap stuff +# it doesn't match NETCOREAPP_VERSION +BOOTSTRAP_RUNTIME = $(shell ls ../.dotnet/shared/Microsoft.NETCore.App) + ifeq ($(HOST_PLATFORM),win32) PLATFORM_AOT_SUFFIX := .dll PLATFORM_AOT_PREFIX := @@ -95,6 +99,12 @@ run-aspnet-sample: prepare cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/ COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(ASPNETCOREAPP_VERSION)" sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/AspNetCore.dll +# makes $(DOTNET) to use mono runtime (to run real-world apps using '$(DOTNET) run') +patch-local-dotnet: prepare + cp ../mono/mini/.libs/libmonosgen-2.0$(PLATFORM_AOT_SUFFIX) ../.dotnet/shared/Microsoft.NETCore.App/$(BOOTSTRAP_RUNTIME)/$(PLATFORM_AOT_PREFIX)coreclr$(PLATFORM_AOT_SUFFIX) + cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll ../.dotnet/shared/Microsoft.NETCore.App/$(BOOTSTRAP_RUNTIME) + cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.pdb ../.dotnet/shared/Microsoft.NETCore.App/$(BOOTSTRAP_RUNTIME) + # COREHOST_TRACE=1 SHAREDRUNTIME := shared/Microsoft.NETCore.App/$(NETCOREAPP_VERSION) |