Upgrade DotNetAppHost package to .NET 5 to use its static nethost lib and headers.
Sean Hall committed
Jul 22, 2020 at 18:39 UTC
70b5d207d799308a6c3742f5d0348ab4fca75a3d
5 files changed
+5
-106
src/dnchost/dnchost.vcxproj
+2
-7
@@ -28,8 +28,8 @@
28
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
30
<PropertyGroup>
31
- <NetHostPath>..\..\packages\runtime.win-x86.Microsoft.NETCore.DotNetAppHost.3.1.3\runtimes\win-x86\native\</NetHostPath>
32
- <ProjectAdditionalLinkLibraries>shlwapi.lib;$(NetHostPath)nethost.lib</ProjectAdditionalLinkLibraries>
31
+ <NetHostPath>..\..\packages\runtime.win-x86.Microsoft.NETCore.DotNetAppHost.5.0.0-preview.7.20364.11\runtimes\win-x86\native\</NetHostPath>
32
+ <ProjectAdditionalLinkLibraries>shlwapi.lib;$(NetHostPath)libnethost.lib</ProjectAdditionalLinkLibraries>
33
</PropertyGroup>
34
<ItemGroup>
35
<ClCompile Include="dnchost.cpp" />
@@ -42,7 +42,6 @@
42
<ClInclude Include="coreclrhost.h" />
43
<ClInclude Include="dnchost.h" />
44
<ClInclude Include="dncutil.h" />
45
- <ClInclude Include="hostfxr.h" />
45
<ClInclude Include="precomp.h" />
46
</ItemGroup>
47
<ItemGroup>
@@ -50,10 +49,6 @@
49
</ItemGroup>
50
<ItemGroup>
51
<None Include="packages.config" />
53
- <Content Include="$(NetHostPath)nethost.dll">
54
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
55
- <Visible>False</Visible>
56
- </Content>
52
</ItemGroup>
53
<ItemDefinitionGroup>
54
<ClCompile>
src/dnchost/hostfxr.h
deleted
-96
@@ -1,96 +0,0 @@
1
-// Licensed to the .NET Foundation under one or more agreements.
2
-// The .NET Foundation licenses this file to you under the MIT license.
3
-// See the LICENSE file in the project root for more information.
4
-
5
-
6
-
7
-// ***** ABOUT THIS HEADER *****
8
-// **************************************************************************************
9
-//
10
-// This is the version on 2019-12-22 from
11
-// https://github.com/dotnet/runtime/blob/master/src/installer/corehost/cli/hostfxr.h
12
-//
13
-// **************************************************************************************
14
-// ****************************
15
-
16
-
17
-#ifndef __HOSTFXR_H__
18
-#define __HOSTFXR_H__
19
-
20
-#include <stddef.h>
21
-#include <stdint.h>
22
-
23
-#if defined(_WIN32)
24
- #define HOSTFXR_CALLTYPE __cdecl
25
- #ifdef _WCHAR_T_DEFINED
26
- typedef wchar_t char_t;
27
- #else
28
- typedef unsigned short char_t;
29
- #endif
30
-#else
31
- #define HOSTFXR_CALLTYPE
32
- typedef char char_t;
33
-#endif
34
-
35
-enum hostfxr_delegate_type
36
-{
37
- hdt_com_activation,
38
- hdt_load_in_memory_assembly,
39
- hdt_winrt_activation,
40
- hdt_com_register,
41
- hdt_com_unregister,
42
- hdt_load_assembly_and_get_function_pointer
43
-};
44
-
45
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_fn)(const int argc, const char_t **argv);
46
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_startupinfo_fn)(
47
- const int argc,
48
- const char_t **argv,
49
- const char_t *host_path,
50
- const char_t *dotnet_root,
51
- const char_t *app_path);
52
-
53
-typedef void(HOSTFXR_CALLTYPE *hostfxr_error_writer_fn)(const char_t *message);
54
-typedef hostfxr_error_writer_fn(HOSTFXR_CALLTYPE *hostfxr_set_error_writer_fn)(hostfxr_error_writer_fn error_writer);
55
-
56
-typedef void* hostfxr_handle;
57
-struct hostfxr_initialize_parameters
58
-{
59
- size_t size;
60
- const char_t *host_path;
61
- const char_t *dotnet_root;
62
-};
63
-
64
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_initialize_for_dotnet_command_line_fn)(
65
- int argc,
66
- const char_t **argv,
67
- const struct hostfxr_initialize_parameters *parameters,
68
- /*out*/ hostfxr_handle *host_context_handle);
69
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_initialize_for_runtime_config_fn)(
70
- const char_t *runtime_config_path,
71
- const struct hostfxr_initialize_parameters *parameters,
72
- /*out*/ hostfxr_handle *host_context_handle);
73
-
74
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_property_value_fn)(
75
- const hostfxr_handle host_context_handle,
76
- const char_t *name,
77
- /*out*/ const char_t **value);
78
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_set_runtime_property_value_fn)(
79
- const hostfxr_handle host_context_handle,
80
- const char_t *name,
81
- const char_t *value);
82
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_properties_fn)(
83
- const hostfxr_handle host_context_handle,
84
- /*inout*/ size_t * count,
85
- /*out*/ const char_t **keys,
86
- /*out*/ const char_t **values);
87
-
88
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_run_app_fn)(const hostfxr_handle host_context_handle);
89
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_delegate_fn)(
90
- const hostfxr_handle host_context_handle,
91
- enum hostfxr_delegate_type type,
92
- /*out*/ void **delegate);
93
-
94
-typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_close_fn)(const hostfxr_handle host_context_handle);
95
-
96
-#endif //__HOSTFXR_H__
\ No newline at end of file
src/dnchost/packages.config
+1
-1
@@ -4,7 +4,7 @@
4
<package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="native" developmentDependency="true" />
5
<package id="Microsoft.SourceLink.GitHub" version="1.0.0" targetFramework="native" developmentDependency="true" />
6
<package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
7
- <package id="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" version="3.1.3" targetFramework="native" />
7
+ <package id="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" version="5.0.0-preview.7.20364.11" targetFramework="native" />
8
<package id="WixToolset.BalUtil" version="4.0.33" targetFramework="native" />
9
<package id="WixToolset.BootstrapperCore.Native" version="4.0.31" targetFramework="native" />
10
<package id="WixToolset.DUtil" version="4.0.45" targetFramework="native" />
src/dnchost/precomp.h
+2
-1
@@ -21,9 +21,10 @@
21
#include <balutil.h>
22
23
#include <WixToolset.Dnc.Host.h>
24
+#define NETHOST_USE_AS_STATIC
25
#include <nethost.h>
26
+#include <hostfxr.h>
27
28
#include "coreclrhost.h"
27
-#include "hostfxr.h"
29
#include "dncutil.h"
30
#include "dnchost.h"
src/wixlib/Dnc.wxs
-1
@@ -40,7 +40,6 @@
40
41
<Fragment>
42
<PayloadGroup Id='Dnc'>
43
- <Payload Compressed='yes' SourceFile='nethost.dll' />
43
<Payload Compressed='yes' SourceFile='WixToolset.Dnc.Host.dll' />
44
<Payload Compressed='yes' SourceFile='wixstdba.dll' Name='dncpreq.dll' />
45
</PayloadGroup>