# Can't install dependencies with Paket

**URL:** <https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628>\
**Category:** General\
**Created:** [February 13, 2021, 8:38am UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628 "2021-02-13T08:38:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 8:38am UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/1 "2021-02-13T08:38:12Z")

</div>

Hi,

(`F#`, _.Net_ and _Windows_ newbie) …

I’m trying to create new project using the following commands:

```auto
dotnet new sln -n TestMe
dotnet new console -lang 'F#' -o SqlTP
dotnet sln add .\SqlTP\SqlTP.fsproj
dotnet new tool-manifest
dotnet tool install paket
dotnet tool restore
dotnet paket init
dotnet paket add FParsec --version 1.1.1 --interactive # I answer Y at the interactive prompt

```

These commands generates the `paket.references` in the project directory and all seems well except for the fact that the project does not see the dependency ☹ . It does not appear in the package references in VSCode and I can’t use the library.

I tried it using dotnet 5.0.x and 3.1.xxx and got the same result. The thing is that I think I created test project in the past following similar procedure and it worked. Not sure what’s wrong …

You can see the generated projects (both dotnet 3 and 5) of the procedure above (with different dependencies) in [this repository](https://github.com/babysnakes/fsharp-paket-sqlprovider-woes).

Please help

Thanks in advance

Haim

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 4:15pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/2 "2021-02-13T16:15:45Z")

</div>

Ok, there seems to be a combination of 2 problems:

- Paket does not support .Net 5.0? (according to the release-notes page).
- You have to build the project before using a dependency ☹

Thanks.

---

<div class="post-metadata">

**Author:** ![cartermp](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/cartermp/32/73_2.png) [@cartermp](https://forums.fsharp.org/u/cartermp)\
**Post date:** [February 13, 2021, 4:19pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/3 "2021-02-13T16:19:08Z")

</div>

You’ll have to use a preview of Paket for now.

---

<div class="post-metadata">

**Author:** ![chethusk](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/chethusk/32/11_2.png) [@chethusk](https://forums.fsharp.org/u/chethusk)\
**Post date:** [February 13, 2021, 4:26pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/4 "2021-02-13T16:26:52Z")

</div>

that’s not quite right: paket supports .net 5 since version [5.250.0](https://github.com/fsprojects/Paket/releases/tag/5.250.0), the releases page just shows all releases and the 6.0 prereleases have been more active lately. What’s probably happening is you have to _restore_ after you do the package add in order to trigger the refresh files that VSCode (specifically, ionide) is watching to determine that references have changed.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 4:45pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/5 "2021-02-13T16:45:19Z")

</div>

> [@chethusk](#):
>
> What’s probably happening is you have to _restore_ after you do the package add in order to trigger the refresh files that VSCode (specifically, ionide) is watching to determine that references have changed.

Sadly this does not help. I tried restoring and building (which should implicitly restore?) and closing/opening the project several times and it doesn’t help. Exactly the same steps with `global.json` file locking to sdk 3.1.xxx does work.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 4:47pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/6 "2021-02-13T16:47:51Z")

</div>

> [@cartermp](#):
>
> You’ll have to use a preview of Paket for now.

Thanks. Hope it won’t take long until it’s fully supported.

---

<div class="post-metadata">

**Author:** ![Scott](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/scott/32/57_2.png) [@Scott](https://forums.fsharp.org/u/Scott)\
**Post date:** [February 13, 2021, 5:44pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/7 "2021-02-13T17:44:34Z")

</div>

Paket and Fake are so often in flux and don’t work easily, so I avoid them when possible. In fact, at work, I have never used them. There are probably scenarios where they are worth the effort to learn and troubleshoot them, but so far I’ve been lucky not to have those scenarios.

---

<div class="post-metadata">

**Author:** ![cartermp](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/cartermp/32/73_2.png) [@cartermp](https://forums.fsharp.org/u/cartermp)\
**Post date:** [February 13, 2021, 5:46pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/8 "2021-02-13T17:46:25Z")

</div>

Hmm. I’ve never gotten it to work unless I’m on the 6.0.0 train.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 6:51pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/9 "2021-02-13T18:51:14Z")

</div>

> [@Scott](#):
>
> There are probably scenarios where they are worth the effort to learn and troubleshoot them, but so far I’ve been lucky not to have those scenarios.

mmmmm, so how do you handle transient dependencies? Do you just hard code everything? I have zero experience with _.Net_ but in other runtimes that does not support lock files I certainly had problems with the same code produces errors at runtime because of different transient dependencies between builds.

---

<div class="post-metadata">

**Author:** ![cartermp](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/cartermp/32/73_2.png) [@cartermp](https://forums.fsharp.org/u/cartermp)\
**Post date:** [February 13, 2021, 7:06pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/10 "2021-02-13T19:06:15Z")

</div>

If you’re using PackageReference with NuGet and don’t have wildcards specified, restore is deterministic and so you won’t get a magic package upgrade between builds. There is a lock file of sorts stored in the `obj` directory. However, it’s not an artifact intended to be checked in with source code. This is a big difference with Paket, since it makes all of that explicit and not just a build artifact. IMO at this point it’s really just a philosophical difference, since Paket makes it explicit and the lock file can only be updated when you explicitly choose to (updating a package version isn’t enough, you need to also update the lock file). In the case of NuGet, it’s still explicit at build time, but you can change a package version and the next build will change the graph,

---

<div class="post-metadata">

**Author:** ![Scott](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/scott/32/57_2.png) [@Scott](https://forums.fsharp.org/u/Scott)\
**Post date:** [February 13, 2021, 7:34pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/11 "2021-02-13T19:34:58Z")

</div>

Well, we have a local Nuget repository, so we control the version(s) in that repository for all our projects. And we don’t mind those packages being years old as long as they still work as expected. But in general I can’t remember ever having a run-time issue due to upgrading a nuget package. I’m sure I’ve had compile-time issues, but could deal with them or just decide not to upgrade the package if possible.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 7:46pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/12 "2021-02-13T19:46:57Z")

</div>

Still a lot to get used to in the Windows/.Net world 🙂.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 7:50pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/13 "2021-02-13T19:50:20Z")

</div>

> [@cartermp](#):
>
> If you’re using PackageReference with NuGet and don’t have wildcards specified

So if I run:

```auto
dotnet add package SQLProvider --version 1.1.101

```

I’ll get a stable versions of all transient dependencies or does it also depends on the versions the package itself specified?

---

<div class="post-metadata">

**Author:** ![cartermp](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/cartermp/32/73_2.png) [@cartermp](https://forums.fsharp.org/u/cartermp)\
**Post date:** [February 13, 2021, 7:57pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/14 "2021-02-13T19:57:47Z")

</div>

This is stable, yes. Unless you change the version. Older versions of NuGet _used_ to do bad stuff like notice there were updates in the graph of transitive graph of dependencies and update them. Paket was essential for anyone who care about anything to do with dependencies. But now it’s more of a “do what you prefer using” kind of thing, at least to me. I personally like to explicit nature of lock files and so I will often use Paket.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 8:00pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/15 "2021-02-13T20:00:03Z")

</div>

> [@cartermp](#):
>
> This is stable, yes. Unless you change the version.

Cool, thanks.

> [@cartermp](#):
>
> I personally like to explicit nature of lock files and so I will often use Paket.

Me too but it’s good to have options 🙂.

---

<div class="post-metadata">

**Author:** ![babysnakes](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@babysnakes](https://forums.fsharp.org/u/babysnakes)\
**Post date:** [February 13, 2021, 8:16pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/16 "2021-02-13T20:16:06Z")

</div>

@cartermp, I was looking into the nuget dependency resolution and found that it does have [explicit locking mechanism](https://docs.microsoft.com/en-us/nuget/concepts/dependency-resolution#dependency-resolution-with-packagereference).

---

<div class="post-metadata">

**Author:** ![Americore](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/americore/32/1031_2.png) [@Americore](https://forums.fsharp.org/u/Americore)\
**Post date:** [December 14, 2021, 5:53pm UTC](https://forums.fsharp.org/t/cant-install-dependencies-with-paket/1628/18 "2021-12-14T17:53:49Z")

</div>

What specific files are being referenced in a nuget package? My tendency when working with really short scripts is to #r reference merely the .dll file in a respective nuget package and then run an .fsx script using FSI.
