Skip to content

Paket support for vnext project files #736

Closed

Description

@Stift

With VS2015 and ASP.NET 5 a new project format for asp.net projects is introduced. This has the new extension .kproj and beside of that exists a project.json (https://github.com/aspnet/Home/wiki/Project.json-file) which describes the dependencies of that project.
The problem here is, that vNext comes with its own package manager (kpm), that downloads all dependencies by default in the folder user profile (subfolder: ".k"). I think that should keep global dependencies locally (per profile). KPM seems just to be enabled to operate with the nuget API.
This leads to the situation that in one solution we can have nuget and KPM side-by-side.

I don't see currently any solution how I can enable Paket with vNext when I switch some projects to vNext. I only see currently that you can specifiy which kre (K runtime) where maybe paket could be triggered from to resolve the references.

Has anyone else already investigated that issue or some ideas that we can try out?

Side note: the documentation of kpm is very basic and a lot of its commands are not documented.

Activity

  1. forki commented on Mar 29, 2015

    @forki
    Member

    yep. that thing is pretty bad and we don' know how to get into this stuff, yet.

  2. changed the title [-]Paket support for oncoming project files[/-] [+]Paket support for vnext project files[/+] on Mar 29, 2015
  3. Stift commented on Mar 29, 2015

    @Stift
    ContributorAuthor

    I currently try to find out how something can be hooked up in the KRE.

  4. forki commented on Oct 22, 2015

    @forki
    Member

    OK, let's discuss what would be needed.

    • So far I see a project.json file per WebApplication project. This file is json and could be easily edited from paket. We would need to write package name and resolved version (from our lock file) into this file.

        "dependencies": {
          "EntityFramework.Commands": "7.0.0-beta8",
          "EntityFramework.SqlServer": "7.0.0-beta8",
          "Microsoft.ApplicationInsights.AspNet": "1.0.0-beta8",
          "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
          "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta8",
          "Microsoft.AspNet.Authentication.Google": "1.0.0-beta8",
          "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta8",
          "Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta8",
          "Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
          "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta8",
          "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8",
          "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
          "Microsoft.AspNet.Mvc": "6.0.0-beta8",
          "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
          "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
          "Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
          "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
          "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
          "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
          "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8",
          "Microsoft.Framework.Logging": "1.0.0-beta8",
          "Microsoft.Framework.Logging.Console": "1.0.0-beta8",
          "Microsoft.Framework.Logging.Debug" : "1.0.0-beta8",
          "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
          "FAKE": "4.3.0"
        },
      

    But this would reintroduce mergeconflicts outside of paket.lock ;-(
    Ideally we would let this block empty and just use references file.

    • There is a global.json file which doesn't contain a dependencies block
    • there is no packages folder anymore ;-(
    • If you save project.json then VS restores automatically. How can we disable that or make it use paket restore?
  5. forki commented on Oct 22, 2015

    @forki
    Member
  6. keichinger commented on Oct 23, 2015

    @keichinger

    @forki I'm not sure how easy and good it is to leave the dependencies block empty as it's not just only required for Visual Studio and tools such as OmniSharp to know about specifiy dependencies, it is also required by the build tools to resolve build dependencies. Keep in mind that the .kproj files are a combination of packages.config and .csproj files. Additionally you can not only specify global dependencies for your project through the root dependencies block, but you can also do this per architecture for scenarios where a specific package is not (yet) ported to make it work cross-plat. This makes it necessary to reflect this kind of feature in paket.references files.

    Another thing about dependencies: You're able to override NuGet packages with a local version by simply specifiying a path to the source code

    Furthermore building the actual project would also require Paket to pre-process project.json before it can actually build. Though this could be done through the prebuild event, which could execute Paket which then modifies the project.json etc.

    Maybe this one here helps clarify a few things: https://github.com/aspnet/Home/wiki/Project.json-file

  7. forki commented on Oct 23, 2015

    @forki
    Member

    Thanks. I get the feeling that from a dependency "management" standpoint things even got worse. Bit hopefully it's just my lack of understanding right now.

  8. forki commented on Oct 23, 2015

    @forki
    Member

    Keep in mind that the .kproj files are a combination of packages.config and .csproj files.

    Exactly. Now things are even more coupled.

  9. Mpdreamz commented on Oct 23, 2015

    @Mpdreamz
    Contributor

    Related. I would love some to get some more voices on this issue aspnet/dnx#2332

  10. forki commented on Nov 5, 2015

    @forki
    Member

    just to clarify my "merge conflic" comment in #736 (comment)

    the issue is: project.json is basically a merge of packages.config and csproj (maybe with better format).
    But since paket would need to generate the dependencies block (and the block contains version numbers) every package update needs to touch the project.json. So if two persons in the team update at the same time you will get a merge conflict there. At the worst part is: you can't gitignore that file since it also contains the rest of the csproj information.

  11. forki commented on Nov 6, 2015

    @forki
    Member

    /cc @nosami @davidfowl @yishaigalatzer @csharpfritz do you see a solution for us to make this work?

  12. yishaigalatzer commented on Nov 9, 2015

    @yishaigalatzer

    Not sure why you need paket un this world (not to say you need or not), I would start with describing the scenarios paket improves in this world and understand the value proposition, then dicuss how to fit it in

  13. isaacabraham commented on Nov 9, 2015

    @isaacabraham
    Contributor

    @yishaigalatzer I think that some of the problems that paket is trying to solve is to remove project-level versioned dependencies, which are still present in project.json, as well as (apparently?) having to store all dependencies, not just top-level dependencies, at the project level. Have a quick read of the Paket FAQ - the first section answers this question pretty succinctly (http://fsprojects.github.io/Paket/faq.html#I-don-t-understand-why-I-need-Paket-to-manage-my-packages-Why-can-t-I-just-use-NuGet).

  14. Mpdreamz commented on Nov 9, 2015

    @Mpdreamz
    Contributor

    @yishaigalatzer I tried doing that on the previously linked DNX ticket:

    • repeatable builds (something still not solved with dnu/project.json)
    • greenfield project developer experience (by separating the act of specifying the dependencies and their resolved versions)
    • mature command line tooling
    • managing the dependencies of many projects at once
    • better dependency resolution algorithms
    • .... insert all the other reasons why you generally pick paket over nuget
  15. yishaigalatzer commented on Nov 9, 2015

    @yishaigalatzer

    Most of these reasons above do not apply.

    With project.json you

    1. Only specify top level dependencies
    2. Have a stable and fast resolution (and much better defined than nuget 2.x)
    3. Ability to float versions without any changes to the project files
    4. decoupling of the project system from the package manager, allowing for command line tools to work equivalently as in visual studio tooling

    So although some things are not available (like solution level dependencies), I would challenge to define the needs and then how to deal with them.

  16. 18 remaining items

  17. yishaigalatzer commented on Nov 10, 2015

    @yishaigalatzer

    You don't need to touch the msbuild script. Just create the lock file

    Sent from my Windows Phone


    From: Steffen Forkmannmailto:[email protected]
    Sent: ‎11/‎9/‎2015 11:38 PM
    To: fsprojects/Paketmailto:[email protected]
    Cc: Yishai Galatzermailto:[email protected]
    Subject: Re: [Paket] Paket support for vnext project files (#736)

    @davidfowlhttps://github.com/davidfowl thanks. That's the answer I was hoping to get. Last questions: in things like VS would it be enough to have the project.lock.json and a project.json without dependencies? Or is VS looking for that block? and do we need to replace the whole MSBuild import or is there a smaller part that handles dependencies and where we can hook into?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/736#issuecomment-155345902.

  18. forki commented on Nov 10, 2015

    @forki
    Member

    @yishaigalatzer but I assume there are events in the IDE that trigger an overwrite of the project.lock.json. Maybe something like adiing a file? Or is it only generated when someone touches the dependencies?

  19. davidfowl commented on Nov 10, 2015

    @davidfowl

    That's the answer I was hoping to get. Last questions: in things like VS would it be enough to have the project.lock.json and a project.json without dependencies?

    Untested. There are a few things that would make the experience a bit rocky today. Automated package restore on save is one of them. You could imagine making that pluggable so we can run specific tools when restore is kicked off. We also put projects in the lock file today and we need a way to work that out as well.

    Or is VS looking for that block? and do we need to replace the whole MSBuild import or is there a smaller part that handles dependencies and where we can hook into?

    Like @yishaigalatzer said, the lock file is all you need.

  20. Mpdreamz commented on Nov 10, 2015

    @Mpdreamz
    Contributor

    Would something like:

     "dependencies": "external"

    and e.g this in global.json

    {
        "projects": [ "src" ],
        "restore" : "/.paket/paket.exe $file",
    }

    Be a quick win here? Existing tooling (vs/omnisharp) can keep calling dnu restore and the intend that an external tool is managing the deps is clearly communicated.

  21. nosami commented on Nov 10, 2015

    @nosami
    Member

    I haven't tested the latest bits, but at least with beta4, removing the dependencies out of project.json causes the following error on application start up.

    10:59 $ ./scripts/Omnisharp
    System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
       ICSharpCode.NRefactory 6.0.0-alpha3
       Microsoft.CodeAnalysis 1.0.0-rc2
       Microsoft.CodeAnalysis.CSharp 1.0.0-rc2
       Microsoft.CodeAnalysis.CSharp.Features 1.0.0-rc2
       Microsoft.CodeAnalysis.CSharp.Workspaces 1.0.0-rc2
       Microsoft.Composition 1.0.30
       Microsoft.Framework.Caching.Memory 1.0.0-beta4
       Microsoft.Framework.ConfigurationModel 1.0.0-beta4
       Microsoft.Framework.FileSystemGlobbing 1.0.0-beta4
       Microsoft.Framework.Logging.Console 1.0.0-beta4
       Microsoft.Framework.Runtime.Interfaces 1.0.0-beta4
       Newtonsoft.Json 7.0.1
       http://ScriptCs.Hosting  0.14.1
    
    Searched Locations:
      /Users/jason/src/omnisharp-roslyn/src/{name}/project.json
      /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/{name}.dll
      /Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/Facades/{name}.dll
    
    Try running 'dnu restore'.
    

    I don't know if it's feasible, but it would be nice if DNX could just use project.lock.json on start up for resolving dependencies. That way any tool that can write that file could be used with something like @Mpdreamz's syntax

  22. davidfowl commented on Nov 10, 2015

    @davidfowl

    @nosami beta4 is old. We're at RC1 now 😄 and the behavior is very different.

    @Mpdreamz Sure the idea is fine but I'm not a fan of like that syntax. We'll look at something that is more natural. I'm not going to hack something in just to make paket work. It needs to gel with the rest of the system.

    My suggestion would be to try it out and file issues for individual thing as you encounter them. The system is optimized for having dependencies all in a single file, not split across files. Also project references need to be taken care of which is another can of worms 😄.

  23. forki commented on Nov 11, 2015

    @forki
    Member

    just tried to upgrade an new/empty beta8 project to rc2. Generated project.json.lock is 19705 lines.
    I don't think that's scope of Paket.

  24. forki commented on Nov 11, 2015

    @forki
    Member

    I mean I must be clearly doing something wrong here. 19k lines in a generated file. that cannot be correct, right? @Mpdreamz if you really want to lock versions (in paket's sense of a lock file) then you would have to commit that file, right? I mean project.json doesn't contain version numbers for transitive dependencies. What am I missing?

  25. Mpdreamz commented on Nov 11, 2015

    @Mpdreamz
    Contributor

    @forki thats what aspnet/dnx#2332 is about, to split the two responsibilities that project.lock.json currently has (caching of compilation info for DNX and resolved deps) in to two separate files.

  26. forki commented on Nov 11, 2015

    @forki
    Member

    yes I was wondering if this is still the case.

    mhm

  27. ctaggart commented on Nov 11, 2015

    @ctaggart
    Contributor

    Here is my understanding so far. MSBuild based projects have moved the dependencies out of the .proj files to a project.lock.json. The project.lock.json should not be committed to the repository and should be in .gitignore. A dnu or nuget restore uses a project.json and creates a project.lock.json. paket should support creating a project.lock.json instead of modifying the dependencies in the .proj files to support this new MSBuild world. Let me know where I am wrong. :)

  28. forki commented on Nov 11, 2015

    @forki
    Member

    @ctaggart yes in principle we'd like to do that, but the rest of the infrastructure needs to understand that the top-level dependencies are not in maintained in project.json. And project.lock.json must only contain package specific information and not "project system" information. Otherwise Paket needs to do things that are out of scope.

  29. forki commented on Nov 18, 2015

    @forki
    Member

    closed as "won't fix" see #1230 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions