diff --git a/src/NuGet.Clients/NuGet.CommandLine/Commands/Pack/AssemblyMetadataExtractor.cs b/src/NuGet.Clients/NuGet.CommandLine/Commands/Pack/AssemblyMetadataExtractor.cs index b13015f0f82..b916d622ca1 100644 --- a/src/NuGet.Clients/NuGet.CommandLine/Commands/Pack/AssemblyMetadataExtractor.cs +++ b/src/NuGet.Clients/NuGet.CommandLine/Commands/Pack/AssemblyMetadataExtractor.cs @@ -23,11 +23,13 @@ internal sealed class AssemblyMetadataExtractor private static T CreateInstance(AppDomain domain) { + string assemblyLocation = Assembly.GetExecutingAssembly().Location; + try { - return (T)domain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(T).FullName); + return (T)domain.CreateInstanceFromAndUnwrap(assemblyLocation, typeof(T).FullName); } - catch (FileLoadException flex) when (flex.FileName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)) + catch (FileLoadException flex) when (UriUtility.GetLocalPath(flex.FileName).Equals(assemblyLocation, StringComparison.Ordinal)) { // Reflection loading error for sandboxed assembly var exceptionMessage = string.Format( diff --git a/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs b/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs index c297b396b99..09ded2d3b62 100644 --- a/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs +++ b/src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs @@ -244,7 +244,7 @@ public PackageBuilder CreateBuilder(string basePath, NuGetVersion version, strin } catch (PackagingException packex) when (packex.AsLogMessage().Code.Equals(NuGetLogCode.NU5133)) { - Logger.Log(PackagingLogMessage.CreateError(packex.Message, NuGetLogCode.NU5133)); + ExceptionUtilities.LogException(packex, Logger); return null; } catch (Exception ex) diff --git a/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsRestoreProgressEvents.cs b/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsRestoreProgressEvents.cs index 6d4e61dfb4c..bbd6558903f 100644 --- a/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsRestoreProgressEvents.cs +++ b/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsRestoreProgressEvents.cs @@ -5,9 +5,9 @@ using System.Collections.Generic; using System.ComponentModel.Composition; using System.Globalization; +using NuGet.Commands; using NuGet.VisualStudio; using NuGet.VisualStudio.Etw; -using NuGet.Commands; namespace NuGet.SolutionRestoreManager { diff --git a/src/NuGet.Core/NuGet.Common/PublicAPI/net45/PublicAPI.Unshipped.txt b/src/NuGet.Core/NuGet.Common/PublicAPI/net45/PublicAPI.Unshipped.txt index 87efe6a5999..9d7de562ba3 100644 --- a/src/NuGet.Core/NuGet.Common/PublicAPI/net45/PublicAPI.Unshipped.txt +++ b/src/NuGet.Core/NuGet.Common/PublicAPI/net45/PublicAPI.Unshipped.txt @@ -2,7 +2,6 @@ NuGet.Common.IPackLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.IPackLogMessage.Framework.set -> void NuGet.Common.IPackLogMessage.LibraryId.get -> string NuGet.Common.IPackLogMessage.LibraryId.set -> void -NuGet.Common.NuGetLogCode.NU5042 = 5042 -> NuGet.Common.NuGetLogCode NuGet.Common.NuGetLogCode.NU5133 = 5133 -> NuGet.Common.NuGetLogCode NuGet.Common.PackagingLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.PackagingLogMessage.Framework.set -> void diff --git a/src/NuGet.Core/NuGet.Common/PublicAPI/net472/PublicAPI.Unshipped.txt b/src/NuGet.Core/NuGet.Common/PublicAPI/net472/PublicAPI.Unshipped.txt index 87efe6a5999..9d7de562ba3 100644 --- a/src/NuGet.Core/NuGet.Common/PublicAPI/net472/PublicAPI.Unshipped.txt +++ b/src/NuGet.Core/NuGet.Common/PublicAPI/net472/PublicAPI.Unshipped.txt @@ -2,7 +2,6 @@ NuGet.Common.IPackLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.IPackLogMessage.Framework.set -> void NuGet.Common.IPackLogMessage.LibraryId.get -> string NuGet.Common.IPackLogMessage.LibraryId.set -> void -NuGet.Common.NuGetLogCode.NU5042 = 5042 -> NuGet.Common.NuGetLogCode NuGet.Common.NuGetLogCode.NU5133 = 5133 -> NuGet.Common.NuGetLogCode NuGet.Common.PackagingLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.PackagingLogMessage.Framework.set -> void diff --git a/src/NuGet.Core/NuGet.Common/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/NuGet.Core/NuGet.Common/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 87efe6a5999..9d7de562ba3 100644 --- a/src/NuGet.Core/NuGet.Common/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/NuGet.Core/NuGet.Common/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -2,7 +2,6 @@ NuGet.Common.IPackLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.IPackLogMessage.Framework.set -> void NuGet.Common.IPackLogMessage.LibraryId.get -> string NuGet.Common.IPackLogMessage.LibraryId.set -> void -NuGet.Common.NuGetLogCode.NU5042 = 5042 -> NuGet.Common.NuGetLogCode NuGet.Common.NuGetLogCode.NU5133 = 5133 -> NuGet.Common.NuGetLogCode NuGet.Common.PackagingLogMessage.Framework.get -> NuGet.Frameworks.NuGetFramework NuGet.Common.PackagingLogMessage.Framework.set -> void