diff --git a/integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs b/integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs index f2b31b49b2..42f2b39aa6 100644 --- a/integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs @@ -9,6 +9,7 @@ open System.IO open System.Diagnostics open Paket open Paket.Domain +open Paket.Requirements [] let ``#1217 should convert simple C# project``() = @@ -22,4 +23,31 @@ let ``#1217 should convert simple C# project``() = let depsFile = DependenciesFile.ReadFromFile(Path.Combine(scenarioTempPath "i001217-convert-simple-project","paket.dependencies")) let requirement = depsFile.GetGroup(Constants.MainDependencyGroup).Packages.Head requirement.Name |> shouldEqual (PackageName "Newtonsoft.Json") - requirement.VersionRequirement.ToString() |> shouldEqual "7.0.1" \ No newline at end of file + requirement.VersionRequirement.ToString() |> shouldEqual "7.0.1" + +[] +let ``#1225 should convert simple C# project with non-matching framework restrictions``() = + paket "convert-from-nuget" "i001225-convert-simple-project-non-matching-restrictions" |> ignore + let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001225-convert-simple-project-non-matching-restrictions","paket.lock")) + let v = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Newtonsoft.Json"].Version + v.Major |> shouldEqual 7u + v.Minor |> shouldEqual 0u + v.Patch |> shouldEqual 1u + + let v2 = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Core"].Version + v2.Major |> shouldEqual 3u + v2.Minor |> shouldEqual 3u + v2.Patch |> shouldEqual 3u + + let depsFile = DependenciesFile.ReadFromFile(Path.Combine(scenarioTempPath "i001225-convert-simple-project-non-matching-restrictions","paket.dependencies")) + let requirement = depsFile.GetGroup(Constants.MainDependencyGroup).Packages.Head + requirement.Name |> shouldEqual (PackageName "Castle.Core") + requirement.VersionRequirement.ToString() |> shouldEqual "3.3.3" + requirement.ResolverStrategy |> shouldEqual None + requirement.Settings.FrameworkRestrictions |> shouldEqual [FrameworkRestriction.AtLeast(FrameworkIdentifier.DotNetFramework(FrameworkVersion.V3_5))] + + let requirement2 = depsFile.GetGroup(Constants.MainDependencyGroup).Packages.Tail.Head + requirement2.Name |> shouldEqual (PackageName "Newtonsoft.Json") + requirement2.VersionRequirement.ToString() |> shouldEqual "7.0.1" + requirement2.ResolverStrategy |> shouldEqual None + requirement2.Settings.FrameworkRestrictions |> shouldEqual [FrameworkRestriction.AtLeast(FrameworkIdentifier.DotNetFramework(FrameworkVersion.V4_Client))] \ No newline at end of file diff --git a/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Class1.cs b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Class1.cs new file mode 100644 index 0000000000..4d41fc787e --- /dev/null +++ b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Class1.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ClassLibrary1 +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.csprojtemplate b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.csprojtemplate new file mode 100644 index 0000000000..a2273b23db --- /dev/null +++ b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.csprojtemplate @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {0A4F4639-6C3A-4245-98FD-02E676CA9BD9} + Library + Properties + ClassLibrary1 + ClassLibrary1 + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll + True + + + packages\Castle.Core.3.3.3\lib\net35\Castle.Core.dll + True + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.sln b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.sln new file mode 100644 index 0000000000..231c969ac6 --- /dev/null +++ b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/ClassLibrary1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1.csproj", "{0A4F4639-6C3A-4245-98FD-02E676CA9BD9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0A4F4639-6C3A-4245-98FD-02E676CA9BD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A4F4639-6C3A-4245-98FD-02E676CA9BD9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A4F4639-6C3A-4245-98FD-02E676CA9BD9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A4F4639-6C3A-4245-98FD-02E676CA9BD9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Properties/AssemblyInfo.cs b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..9ce9d445d8 --- /dev/null +++ b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ClassLibrary1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ClassLibrary1")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4aca4fc8-813d-4686-b15a-a6b4fbdd6f7d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/packages.config b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/packages.config new file mode 100644 index 0000000000..875b18be36 --- /dev/null +++ b/integrationtests/scenarios/i001225-convert-simple-project-non-matching-restrictions/before/ClassLibrary1/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Paket.Core/NugetConvert.fs b/src/Paket.Core/NugetConvert.fs index 8e3ca714b6..dc82fea821 100644 --- a/src/Paket.Core/NugetConvert.fs +++ b/src/Paket.Core/NugetConvert.fs @@ -214,7 +214,7 @@ let createPackageRequirement (packageName, version, restrictions) dependenciesFi VersionRequirement(VersionRange.Minimum <| SemVer.Parse "0", PreReleaseStatus.No) else VersionRequirement(VersionRange.Exactly version, PreReleaseStatus.No) - ResolverStrategy = Some ResolverStrategy.Max + ResolverStrategy = None Settings = { InstallSettings.Default with FrameworkRestrictions = restrictions } Parent = PackageRequirementSource.DependenciesFile dependenciesFileName Graph = [] }