fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

Support of legacy project structure #965

Closed WebDucer closed 9 years ago

WebDucer commented 9 years ago

We have several legacy solutions with the following folder structure:

All solutions have some common projects with other solutions.

Now we use nuget as package manager. Is it possible to use paket instead with this folder structure? Is there any configuration that I can use to handle this? I tried the convert-from-nuget, but this doesn't work.

forki commented 9 years ago

What is the concrete issue?

/cc @theimowski

theimowski commented 9 years ago

yeah it'd be nice if you could share more details on how you're trying to run convert-from-nuget and what errors occur

WebDucer commented 9 years ago

I execute the .paket\paket convert-from-nuget on the solution level. In standard solutions this convert all nuget dependencies in all projects of the solution to paket.references. With the folder structure that we have, the conversion generates only the empty paket.dependencies and paket.lock in the solution folder. None of the projects was converted.

forki commented 9 years ago

Did you try to run it from the root folder? Paket is always looking down, never sideways or a up.

theimowski commented 9 years ago

yes, that's what I wanted to suggest, IIRC convert-from-nuget should deal with multiple solutions

WebDucer commented 9 years ago
Paket failed with:

Error in resolution.
  Resolved:
    - SDSDevXDeps 15.1.5
    - Newtonsoft.Json 7.0.1
    - EntityFramework 6.1.3
    - MvvmLightLibs 5.1.1.0
    - Moq 4.2.1507.0118
    - PostSharp 4.1.21
    - iTextSharp-LGPL 4.1.6
    - NLog 4.0.1
    - NLog.Config 4.0.1
    - NLog.Schema 4.0.1
    - FluentAssertions 3.5.0
    - NUnit 2.6.4
    - Extended.Wpf.Toolkit 2.5
    - Unity 2.1.505.2
    - CommonServiceLocator 1.3
    - Microsoft.Bcl 1.1.10
    - Prism.PubSubEvents 1.1.2
    - Microsoft.Bcl.Async 1.0.168
    - System.Data.SQLite 1.0.97.0
    - System.Data.SQLite.Core 1.0.97.0
    - System.Data.SQLite.EF6 1.0.97.0
    - System.Data.SQLite.Linq 1.0.97.0
    - TraceLogAspectLib 1.0.35
    - Microsoft.Bcl.Build 1.0.21
    - GT.TestBase 1.0.0.80
    - GT.WpfUtilities 1.0.0.18
    - GT.IoC.Contract 1.0.0.13
    - GT.IoC.UnityExtension 1.0.0.13
  Could not resolve:
    - Unity >= 3.5
       - from GT.IoC.UnityExtension 1.0.0.13
 Please try to relax some conditions.

Now the conversion failed with the message obove. The problem is the following: All our projects are .Net 4.0 projects. Unity exists in version 2.1.x for .Net 4.0 and with 3.5.x for .Net >= 4.5. Is it possible to constrain the convert to a specific .Net version?

forki commented 9 years ago

yes that is possible by editing the paket.dependencies file. see http://fsprojects.github.io/Paket/nuget-dependencies.html#Framework-restrictions

WebDucer commented 9 years ago

I mean before or during the conversion.

I constrained the frameword and run paket.exe update. Now all projects have messy references. On top of the project file are old (nuget) references and at the buttom are paket definitions.

  <ItemGroup>
    <Reference Include="ftspcnet, Version=2.1.6.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\Kommunikation\Serial Port Control\Microsoft.NET\Control\ftspcnet.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="GalaSoft.MvvmLight, Version=5.1.1.35051, Culture=neutral, PublicKeyToken=0e453835af4ee6ce, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\..\Solutions\SDS Full\packages\MvvmLightLibs.5.1.1.0\lib\net40\GalaSoft.MvvmLight.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.1.1.35049, Culture=neutral, PublicKeyToken=f46ff315b1088208, processorArchitecture=MSIL">
      <HintPath>..\..\..\..\..\..\..\Solutions\SDS Full\packages\MvvmLightLibs.5.1.1.0\lib\net40\GalaSoft.MvvmLight.Extras.dll</HintPath>
      <Private>False</Private>
    </Reference>
...
  </ItemGroup>
...
  <Import Project="..\..\..\..\..\..\..\.paket\paket.targets" />
  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
      <ItemGroup>
        <Reference Include="mscorlib">
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>
forki commented 9 years ago

I mean before or during the conversion

I don't think so. @theimowski ?

Now all projects have messy references

try to run paket install --hard

theimowski commented 9 years ago

No it's not possible in convert, it takes only the latest version and disregards target framework if there is more than one version : https://github.com/fsprojects/Paket/blob/master/src/Paket.Core/NugetConvert.fs#L246-L254

WebDucer commented 9 years ago

Yes. This solved the problem.

Thanks for the great tool and support.

forki commented 9 years ago

Cool