-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathinconsistentNugetVersionsInDotNetProjects.fsx
More file actions
executable file
·57 lines (40 loc) · 1.65 KB
/
inconsistentNugetVersionsInDotNetProjects.fsx
File metadata and controls
executable file
·57 lines (40 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env -S dotnet fsi
open System
open System.IO
#r "System.Core.dll"
#r "System.Xml.Linq.dll"
#r "nuget: Fsdk, Version=0.6.1--date20260403-0728.git-c9a0eae"
open Fsdk
#r "nuget: Microsoft.Build, Version=16.11.0"
#load "../src/FileConventions/Helpers.fs"
#load "../src/FileConventions/NugetVersionsCheck.fs"
open NugetVersionsCheck
let args = Misc.FsxOnlyArguments()
let currentDirectory = Directory.GetCurrentDirectory()
if args.Length > 1 then
printf "Usage: %s [example.sln(optional)]" __SOURCE_FILE__
Environment.Exit 1
let target =
if args.IsEmpty then
currentDirectory |> DirectoryInfo |> ScriptTarget.Folder
else
let singleArg = args.[0]
if Directory.Exists singleArg then
failwithf "Use an .sln file insted of directory."
elif not(File.Exists singleArg) then
failwithf "'%s' does not exist." singleArg
elif singleArg.EndsWith ".sln" then
singleArg |> FileInfo |> ScriptTarget.Solution
else
failwithf
"'%s' argument is invalid. You should enter an .sln file or run this script on current directory"
singleArg
let nugetSolutionPackagesDir =
Path.Combine(currentDirectory, "packages") |> DirectoryInfo
let nugetPackageConfigDir =
Path.Combine(currentDirectory, "NuGet.config") |> FileInfo
if not nugetPackageConfigDir.Exists || not nugetSolutionPackagesDir.Exists then
failwithf
"NuGet.config not found in '%s', please create it with the `globalPackagesFolder` key as `packages`."
nugetPackageConfigDir.FullName
SanityCheckNugetPackages target currentDirectory nugetSolutionPackagesDir