Skip to content

Commit

Permalink
Load assembly from path - fixes #827
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 19, 2015
1 parent 791c8cb commit 2e4593a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 } ->
Expand Down
4 changes: 2 additions & 2 deletions src/Paket.Core/PackageProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e4593a

Please sign in to comment.