From 2e4593ac9b5fe8b0a68e3b785793ba918d687678 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 19 May 2015 17:56:55 +0200 Subject: [PATCH] Load assembly from path - fixes #827 --- src/Paket.Core/PackageMetaData.fs | 13 ++++++++----- src/Paket.Core/PackageProcess.fs | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Paket.Core/PackageMetaData.fs b/src/Paket.Core/PackageMetaData.fs index 727941d915..51680f9586 100644 --- a/src/Paket.Core/PackageMetaData.fs +++ b/src/Paket.Core/PackageMetaData.fs @@ -91,17 +91,20 @@ let loadAssemblyId buildConfig (projectFile : ProjectFile) = let bytes = File.ReadAllBytes fileName let assembly = Assembly.Load bytes - assembly,assembly.GetName().Name + assembly,assembly.GetName().Name,fileName -let loadAssemblyAttributes (assembly:Assembly) = +let loadAssemblyAttributes fileName (assembly:Assembly) = try assembly.GetCustomAttributes(true) with - | exn -> - traceWarnfn "Loading custom attributes failed for %s.%sMessage: %s" assembly.FullName Environment.NewLine exn.Message + | :? FileNotFoundException -> + // retrieving via path + let assembly = Assembly.LoadFrom fileName + assembly.GetCustomAttributes(true) + | exn -> + traceWarnfn "Loading custom attributes failed for %s.%sMessage: %s" fileName Environment.NewLine exn.Message assembly.GetCustomAttributes(false) - let (|Valid|Invalid|) md = match md with | { ProjectCoreInfo.Id = Some id'; Version = Some v; Authors = Some a; Description = Some d } -> diff --git a/src/Paket.Core/PackageProcess.fs b/src/Paket.Core/PackageProcess.fs index 9532fbcc0e..800f518b48 100644 --- a/src/Paket.Core/PackageProcess.fs +++ b/src/Paket.Core/PackageProcess.fs @@ -52,13 +52,13 @@ let Pack(dependencies : DependenciesFile, packageOutputPath, buildConfig, versio match md with | Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, opt) } | _ -> - let assembly,id = loadAssemblyId buildConfig projectFile + let assembly,id,assemblyFileName = loadAssemblyId buildConfig projectFile let md = { md with Id = md.Id ++ Some id } match md with | Valid completeCore -> { templateFile with Contents = CompleteInfo(completeCore, opt) } | _ -> - let attribs = loadAssemblyAttributes assembly + let attribs = loadAssemblyAttributes assemblyFileName assembly let merged = { Id = md.Id