diff options
Diffstat (limited to 'src/installer/managed/Microsoft.NET.HostModel/Bundle')
3 files changed, 11 insertions, 26 deletions
diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs index 29e9635d4fd..320969c101d 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs @@ -90,7 +90,7 @@ namespace Microsoft.NET.HostModel.Bundle return fileRelativePath.Equals(RuntimeConfigDevJson); } - bool ShouldExclude(FileType type, string relativePath) + bool ShouldExclude(FileType type) { switch (type) { @@ -100,7 +100,7 @@ namespace Microsoft.NET.HostModel.Bundle return false; case FileType.NativeBinary: - return !Options.HasFlag(BundleOptions.BundleNativeBinaries) || Target.ShouldExclude(relativePath); + return !Options.HasFlag(BundleOptions.BundleNativeBinaries); case FileType.Symbols: return !Options.HasFlag(BundleOptions.BundleSymbolFiles); @@ -229,24 +229,22 @@ namespace Microsoft.NET.HostModel.Bundle foreach (var fileSpec in fileSpecs) { - string relativePath = fileSpec.BundleRelativePath; - - if (IsHost(relativePath)) + if (IsHost(fileSpec.BundleRelativePath)) { continue; } - if (ShouldIgnore(relativePath)) + if (ShouldIgnore(fileSpec.BundleRelativePath)) { - Tracer.Log($"Ignore: {relativePath}"); + Tracer.Log($"Ignore: {fileSpec.BundleRelativePath}"); continue; } FileType type = InferType(fileSpec); - if (ShouldExclude(type, relativePath)) + if (ShouldExclude(type)) { - Tracer.Log($"Exclude [{type}]: {relativePath}"); + Tracer.Log($"Exclude [{type}]: {fileSpec.BundleRelativePath}"); fileSpec.Excluded = true; continue; } @@ -255,7 +253,7 @@ namespace Microsoft.NET.HostModel.Bundle { FileType targetType = Target.TargetSpecificFileType(type); long startOffset = AddToBundle(bundle, file, targetType); - FileEntry entry = BundleManifest.AddEntry(targetType, relativePath, startOffset, file.Length); + FileEntry entry = BundleManifest.AddEntry(targetType, fileSpec.BundleRelativePath, startOffset, file.Length); Tracer.Log($"Embed: {entry}"); } } diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Manifest.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Manifest.cs index 9c171ae2da7..bd2b340971e 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Manifest.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Manifest.cs @@ -59,7 +59,7 @@ namespace Microsoft.NET.HostModel.Bundle enum HeaderFlags : ulong { None = 0, - NetcoreApp3CompatMode = 1 + NetcoreApp3CompatMode = 2 } // Bundle ID is a string that is used to uniquely diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs index 87b1c65202e..1f6f61a7eee 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/TargetInfo.cs @@ -27,6 +27,8 @@ namespace Microsoft.NET.HostModel.Bundle public TargetInfo(OSPlatform? os, Version targetFrameworkVersion) { + Version net50 = new Version(5, 0); + OS = os ?? HostOS; FrameworkVersion = targetFrameworkVersion ?? net50; @@ -69,21 +71,6 @@ namespace Microsoft.NET.HostModel.Bundle // The .net core 3 apphost doesn't care about semantics of FileType -- all files are extracted at startup. // However, the apphost checks that the FileType value is within expected bounds, so set it to the first enumeration. public FileType TargetSpecificFileType(FileType fileType) => (BundleVersion == 1) ? FileType.Unknown : fileType; - - // In .net core 3.x, bundle processing happens within the AppHost. - // Therefore HostFxr and HostPolicy can be bundled within the single-file app. - // In .net 5, bundle processing happens in HostFxr and HostPolicy libraries. - // Therefore, these libraries themselves cannot be bundled into the single-file app. - // This problem is mitigated by statically linking these host components with the AppHost. - // https://github.com/dotnet/runtime/issues/32823 - public bool ShouldExclude(string relativePath) => - (FrameworkVersion.Major != 3) && (relativePath.Equals(HostFxr) || relativePath.Equals(HostPolicy)); - - readonly Version net50 = new Version(5, 0); - string HostFxr => IsWindows ? "hostfxr.dll" : IsLinux ? "libhostfxr.so" : "libhostfxr.dylib"; - string HostPolicy => IsWindows ? "hostpolicy.dll" : IsLinux ? "libhostpolicy.so" : "libhostpolicy.dylib"; - - } } |