diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..fb9b49e
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,8 @@
+
+
+
+ 10.0
+ enable
+
+
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 0000000..dc58746
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,19 @@
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..512142d
--- /dev/null
+++ b/global.json
@@ -0,0 +1,6 @@
+{
+ "sdk": {
+ "version": "10.0.100",
+ "rollForward": "latestFeature"
+ }
+}
diff --git a/src/PSProxmoxVE.Core/PSProxmoxVE.Core.csproj b/src/PSProxmoxVE.Core/PSProxmoxVE.Core.csproj
index 8a5eb6f..cfe2021 100644
--- a/src/PSProxmoxVE.Core/PSProxmoxVE.Core.csproj
+++ b/src/PSProxmoxVE.Core/PSProxmoxVE.Core.csproj
@@ -2,12 +2,9 @@
netstandard2.0
- 10.0
- enable
PSProxmoxVE.Core
PSProxmoxVE.Core
true
- $(NoWarn)
@@ -17,8 +14,8 @@
-
-
+
+
diff --git a/src/PSProxmoxVE/PSProxmoxVE.csproj b/src/PSProxmoxVE/PSProxmoxVE.csproj
index c483096..253c15d 100644
--- a/src/PSProxmoxVE/PSProxmoxVE.csproj
+++ b/src/PSProxmoxVE/PSProxmoxVE.csproj
@@ -2,8 +2,6 @@
netstandard2.0
- 10.0
- enable
PSProxmoxVE
PSProxmoxVE
true
@@ -11,8 +9,8 @@
-
-
+
+
diff --git a/tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj b/tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj
index 8f1b6f7..d5d36e0 100644
--- a/tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj
+++ b/tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj
@@ -2,21 +2,19 @@
net10.0;net48
- 10.0
- enable
false
true
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -28,6 +26,7 @@
+
diff --git a/tests/PSProxmoxVE.Core.Tests/PackageVersionCentralizationTests.cs b/tests/PSProxmoxVE.Core.Tests/PackageVersionCentralizationTests.cs
new file mode 100644
index 0000000..2a7d70f
--- /dev/null
+++ b/tests/PSProxmoxVE.Core.Tests/PackageVersionCentralizationTests.cs
@@ -0,0 +1,53 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Xml.Linq;
+using Xunit;
+
+namespace PSProxmoxVE.Core.Tests
+{
+ public class PackageVersionCentralizationTests
+ {
+ private static readonly string[] ProjectPaths =
+ {
+ "src/PSProxmoxVE.Core/PSProxmoxVE.Core.csproj",
+ "src/PSProxmoxVE/PSProxmoxVE.csproj",
+ "tests/PSProxmoxVE.Core.Tests/PSProxmoxVE.Core.Tests.csproj",
+ };
+
+ [Fact]
+ public void PackageReferences_DoNotPinVersionsPerProject()
+ {
+ var repoRoot = FindRepoRoot();
+
+ foreach (var relativePath in ProjectPaths)
+ {
+ var doc = XDocument.Load(Path.Combine(repoRoot, relativePath));
+ var pinned = doc.Descendants("PackageReference")
+ .Where(e => e.Attribute("Version") != null)
+ .Select(e => e.Attribute("Include")?.Value)
+ .ToList();
+
+ Assert.True(pinned.Count == 0,
+ $"{relativePath} pins a version directly instead of going through Directory.Packages.props: {string.Join(", ", pinned)}");
+ }
+ }
+
+ private static string FindRepoRoot()
+ {
+ var dir = new DirectoryInfo(AppContext.BaseDirectory);
+ while (dir != null && !File.Exists(Path.Combine(dir.FullName, "PSProxmoxVE.sln")))
+ {
+ dir = dir.Parent;
+ }
+
+ if (dir == null)
+ {
+ throw new InvalidOperationException(
+ "Could not locate repository root (PSProxmoxVE.sln) from " + AppContext.BaseDirectory);
+ }
+
+ return dir.FullName;
+ }
+ }
+}