diff --git a/build/build.csx b/build/build.csx
index 83d4b1c..a7025bd 100644
--- a/build/build.csx
+++ b/build/build.csx
@@ -1,4 +1,4 @@
-#load "nuget:Dotnet.Build, 0.15.0"
+#load "nuget:Dotnet.Build, 0.16.1"
#load "nuget:dotnet-steps, 0.0.2"
BuildContext.CodeCoverageThreshold = 80;
diff --git a/src/Dotnet.Deps.Core/Dotnet.Deps.Core.csproj b/src/Dotnet.Deps.Core/Dotnet.Deps.Core.csproj
index 09b971b..0014321 100644
--- a/src/Dotnet.Deps.Core/Dotnet.Deps.Core.csproj
+++ b/src/Dotnet.Deps.Core/Dotnet.Deps.Core.csproj
@@ -10,13 +10,13 @@
https://github.com/seesharper/dotnet-deps.git
Bernhard Richter
A simple library that can be used to analyze and update NuGet dependencies.
- 2.1.0
+ 2.1.1
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Dotnet.Deps.Core/ProjectSystem/ScriptProjectLoader.cs b/src/Dotnet.Deps.Core/ProjectSystem/ScriptProjectLoader.cs
index e6748c7..45fd65a 100644
--- a/src/Dotnet.Deps.Core/ProjectSystem/ScriptProjectLoader.cs
+++ b/src/Dotnet.Deps.Core/ProjectSystem/ScriptProjectLoader.cs
@@ -8,8 +8,21 @@ namespace Dotnet.Deps.Core.ProjectSystem
{
public class ScriptProjectLoader : IProjectLoader
{
- const string ReferenceDirectivePattern = @"^(\s*#r\s*""nuget:\s*)(.*)(,\s*)(.*)(\s*""$)";
- const string LoadDirectivePattern = @"^(\s*#load\s*""nuget:\s*)(.*)(,\s*)(.*)(\s*""$)";
+ const string Hws = @"[\x20\t]*"; // hws = horizontal whitespace
+
+ const string NuGetPattern = @"nuget:"
+ // https://github.com/NuGet/docs.microsoft.com-nuget/issues/543#issue-270039223
+ + Hws + @"(\w+(?:[_.-]\w+)*)"
+ + @"(?:" + Hws + "," + Hws + @"(.+?))?";
+
+ const string WholeNuGetPattern = @"^" + NuGetPattern + @"$";
+
+ const string NuGetDirectivePatternSuffix = Hws + @"""" + NuGetPattern + @"""";
+
+ const string DirectivePatternPrefix = @"^" + Hws + @"#";
+
+ const string ReferenceDirectivePattern = DirectivePatternPrefix + "r" + NuGetDirectivePatternSuffix;
+ const string LoadDirectivePattern = DirectivePatternPrefix + "load" + NuGetDirectivePatternSuffix;
private readonly AppConsole console;
@@ -30,8 +43,8 @@ public IProjectFile Load(string path)
var packageReferences = new List();
foreach (var match in matches)
{
- var packageName = match.Groups[2].Value;
- var packageVersion = match.Groups[4].Value;
+ var packageName = match.Groups[1].Value;
+ var packageVersion = match.Groups[2].Value;
if (FloatRange.TryParse(packageVersion, out var floatRange))
{
diff --git a/src/Dotnet.Deps.Tests/dotnet.deps.tests.csproj b/src/Dotnet.Deps.Tests/dotnet.deps.tests.csproj
index f248815..89051a8 100644
--- a/src/Dotnet.Deps.Tests/dotnet.deps.tests.csproj
+++ b/src/Dotnet.Deps.Tests/dotnet.deps.tests.csproj
@@ -6,15 +6,15 @@
false
-
-
-
-
-
+
+
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/Dotnet.Deps/Dotnet.Deps.csproj b/src/Dotnet.Deps/Dotnet.Deps.csproj
index d468dce..c298213 100644
--- a/src/Dotnet.Deps/Dotnet.Deps.csproj
+++ b/src/Dotnet.Deps/Dotnet.Deps.csproj
@@ -15,13 +15,13 @@
MIT
git
https://github.com/seesharper/dotnet-deps.git
- 3.0.0
+ 3.0.1
-
-
-
-
+
+
+
+