Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion integrationtests/Paket.IntegrationTests/ConvertFromNuGetSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,17 @@ let ``#1922 should remove references to moved analyzers``() =

StringAssert.Contains(@"<Analyzer Include=""..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\Newtonsoft.Json.dll"">", projectXml)
StringAssert.Contains(@"<Analyzer Include=""..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll"">", projectXml)
StringAssert.Contains(@"<Analyzer Include=""..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll"">", projectXml)
StringAssert.Contains(@"<Analyzer Include=""..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll"">", projectXml)

[<Test>]
let ``#2161 should put paket.dependencies inside the .paket folder when it's already present in the sln file``() =
let scenario = "i002161-convert-existing-paket-folder"
paket "convert-from-nuget" scenario |> ignore

let slnLines = File.ReadAllLines(Path.Combine(scenarioTempPath scenario, "2161.sln"))
let sectionOpenLine = slnLines |> Array.findIndex (fun line -> line.StartsWith "Project" && line.Contains "\".paket\"")
let sectionEndLine = sectionOpenLine + (slnLines |> Seq.skip sectionOpenLine |> Seq.findIndex (fun line -> line.StartsWith "EndProject"))
let depsFileLine = slnLines |> Array.findIndex (fun line -> line.Contains "paket.dependencies")

sectionOpenLine |> shouldBeSmallerThan depsFileLine
sectionEndLine |> shouldBeGreaterThan depsFileLine
14 changes: 4 additions & 10 deletions integrationtests/Paket.IntegrationTests/TestHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ let prepare scenario =
let scenarioPath = scenarioTempPath scenario
CleanDir scenarioPath
CopyDir scenarioPath originalScenarioPath (fun _ -> true)
Directory.GetFiles(scenarioPath, "*.fsprojtemplate", SearchOption.AllDirectories)
|> Seq.iter (fun f -> File.Move(f, Path.ChangeExtension(f, "fsproj")))
Directory.GetFiles(scenarioPath, "*.csprojtemplate", SearchOption.AllDirectories)
|> Seq.iter (fun f -> File.Move(f, Path.ChangeExtension(f, "csproj")))
Directory.GetFiles(scenarioPath, "*.vcxprojtemplate", SearchOption.AllDirectories)
|> Seq.iter (fun f -> File.Move(f, Path.ChangeExtension(f, "vcxproj")))
Directory.GetFiles(scenarioPath, "*.templatetemplate", SearchOption.AllDirectories)
|> Seq.iter (fun f -> File.Move(f, Path.ChangeExtension(f, "template")))
Directory.GetFiles(scenarioPath, "*.jsontemplate", SearchOption.AllDirectories)
|> Seq.iter (fun f -> File.Move(f, Path.ChangeExtension(f, "json")))

for ext in ["fsproj";"csproj";"vcxproj";"template";"json"] do
for file in Directory.GetFiles(scenarioPath, (sprintf "*.%stemplate" ext), SearchOption.AllDirectories) do
File.Move(file, Path.ChangeExtension(file, ext))

let directPaketInPath command scenarioPath =
#if INTERACTIVE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "2161", "2161.fsproj", "{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{75DC0F05-EDD7-4CAD-B88E-9BA4DFCDDAE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|x64.ActiveCfg = Debug|x64
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|x64.Build.0 = Debug|x64
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|x86.ActiveCfg = Debug|x86
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Debug|x86.Build.0 = Debug|x86
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|Any CPU.Build.0 = Release|Any CPU
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|x64.ActiveCfg = Release|x64
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|x64.Build.0 = Release|x64
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|x86.ActiveCfg = Release|x86
{5AB9014A-86E7-4A3C-8731-AC5220ABB7F8}.Release|x86.Build.0 = Release|x86
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Paket.Core/PaketConfigFiles/SolutionFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type SolutionFile(fileName: string) =

let add s =
if not <| Seq.exists (fun line -> line = s) projectLines
then content.Insert(paketProjectIndex + 2, s)
then content.Insert(paketProjectIndex + 1, s)

Option.iter (fun lockFile ->
add (sprintf" %s = %s" lockFile lockFile)) lockFile
Expand Down