diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 00000000..6e47fc57
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,18 @@
+
+
+
+
+ <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" />
+ <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" />
+ <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'">
+ @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)')
+
+ <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'">
+ [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')]
+
+ <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" />
+ <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" />
+
+
+
diff --git a/source/AndroidXProject.cshtml b/source/AndroidXProject.cshtml
index 4607bab5..3b3f1dcc 100644
--- a/source/AndroidXProject.cshtml
+++ b/source/AndroidXProject.cshtml
@@ -173,8 +173,7 @@
@foreach (var dep in @Model.NuGetDependencies) {
if (dep.IsProjectReference) {
-
-
+
}
}
@@ -184,7 +183,7 @@
@foreach (var dep in @Model.NuGetDependencies) {
if (!dep.IsProjectReference) {
-
+
}
}
@@ -205,4 +204,53 @@
}
+@{
+ string GetProjectVersionString (string mavenVersion, string nugetVersion)
+ {
+ var adjusted_string = GetVersionString (mavenVersion, nugetVersion);
+
+ // If nothing changed, return empty string
+ if (adjusted_string == nugetVersion)
+ return null;
+
+ return adjusted_string;
+ }
+
+ string GetVersionString (string mavenVersion, string nugetVersion)
+ {
+ // If this isn't an exact version we don't use this code
+ if (!mavenVersion.StartsWith ('[') || !mavenVersion.EndsWith (']') || mavenVersion.Contains (','))
+ return nugetVersion;
+
+ // An exact version is requested like "1.2.0", however we want to let the revision (4th NuGet number) float,
+ // so that our updates that don't change the Java artifact can still be used.
+ // That is, if the POM specifies "1.2.0" and the dependency NuGet is already "1.2.0.4", we want to allow:
+ // 1.2.0.4 >= x < 1.2.1
+ // NuGet expresses that as "[1.2.0.4, 1.2.1)", so that's what we need to create.
+ var lower_bound = nugetVersion;
+
+ var nuget_first = 0;
+ var nuget_second = 0;
+ var nuget_third = 0;
+
+ var nuget_parts = nugetVersion.Split ('.');
+
+ if (nuget_parts.Length > 0 && int.TryParse (nuget_parts [0], out var p1))
+ nuget_first = p1;
+
+ if (nuget_parts.Length > 1 && int.TryParse (nuget_parts [1], out var p2))
+ nuget_second = p2;
+
+ if (nuget_parts.Length > 2 && int.TryParse (nuget_parts [2], out var p3))
+ nuget_third = p3;
+
+ // Bump the third number
+ nuget_third++;
+
+ var upper_bound = $"{nuget_first}.{nuget_second}.{nuget_third}";
+
+ // Put it all together
+ return $"[{lower_bound}, {upper_bound})";
+ }
+}
\ No newline at end of file