Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,14 @@ let ``ignore assemblies that are not expected by the specified framework`` () =
[
"nlog.csx", ["Java.Interop"; "Mono.Android"; "System.Xml.Linq"; "System.Net"; "System.Windows"; "System.Windows.Browser"; "Xamarin.iOS" ]
"nlog.fsx", ["Java.Interop"; "Mono.Android"; "System.Xml.Linq"; "System.Net"; "System.Windows"; "System.Windows.Browser"; "Xamarin.iOS" ]
] |> assertExpectations scenario ExpectationType.ShouldNotContain
] |> assertExpectations scenario ExpectationType.ShouldNotContain

[<Test; Category("scriptgen")>]
let ``scripts should contain the paket namespace`` () =
let scenario = "add-namespace"
paket "install" scenario |> ignore

[
"nlog.csx", ["namespace PaketLoadScripts" ]
"nlog.fsx", ["namespace PaketLoadScripts" ]
] |> assertExpectations scenario ExpectationType.ShouldContain
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
generate_load_scripts: true
source https://www.nuget.org/api/v2
framework: net45
nuget NLog 4.5.10
4 changes: 3 additions & 1 deletion src/Paket.Core/Installation/ScriptGeneration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ module ScriptGeneration =
(Uri scriptFile.FullName).MakeRelativeUri(Uri libFile.FullName).ToString()
else libFile.FullName

let paketNamespace = "namespace PaketLoadScripts\n"

// create the approiate load string for the target resource
let refString (reference:ReferenceType) =
let escapeString (s:string) =
Expand All @@ -126,7 +128,7 @@ module ScriptGeneration =
| Framework name,_ ->
sprintf """#r "%s" """ (escapeString name)

self.Input |> Seq.map refString |> Seq.distinct |> String.concat "\n"
self.Input |> Seq.map refString |> Seq.append [paketNamespace] |> Seq.distinct |> String.concat "\n"

/// use the provided directory to compute the relative paths for the script's contents
/// and construct the
Expand Down