I know that I can use #r <pkg> but without a directory to hold a project where should I install /keep the dependencies?
I mean, if I'm using F# I can dotnet add package <pkg> from the project folder but with .fsx I was expecting to not have a "project folder", how to install packages then?
You don't have to worry about downloading and storing the packages somewhere, you can make the interpreter take care of that for you by referencing Nuget packages, not files on your local system. This would look something like this:
#r "nuget: <pkg>"
open Package.Whatever
...
Related
This issue is driving me crazy. I'm trying to compile and install The QR Designer from QuickReports 6. I have an issue just with the one package. When I right the package in the IDE > Install the IDE gives me:
Can't load package C:\xe10_3\QRDesign\Win32\Debug\dclqrd_DXE10_3.bpl.
The specified module could not be found.
But the exact file is there.
I've also tried installing it via the menu under Components > Install Packages and then choosing the BPL from there, with the same issue.
I've tried to use Process Monitor as on this post here to find the issue:
Delphi Can't load package the specified module cannot be found
I couldn't fix the issue, but what I did pick up from Process Monitor was that some process was looking for the package here:
Computer\HKEY_CURRENT_USER\Software\Embarcadero\BDS\21.0\Package Cache\dclqrd_DXE10_3.bpl
That key didn't exists. I tried manually creating the key, but that didn't do a thing.
Any ideas?
UPDATE
Here is the list of packages:
As you can see, dclqrd_DXE10_3 is dependant on two others. Which I already built and installed. I removed its references and re-added them again now, to make sure the references are sound. I guess its like Remy said, the Specified module not found is probably not referring to dclqrd_DXE10_3 although I don't know what other module it could be referring to.
To install a package successfully in IDE, follow the steps:
Open the dpk/dproj/groupproj file in IDE
Build the package(s) for Windows 32-bit platform.
IDE itself is a 32-bit applicaton, so it should match.
Normally, it will build all dependent/required packages
Check if all chain of BPL & DCP files are generated in package Output directory.
It defaults to $(BDSCOMMONDIR)\Bpl & Dcp folders, but can be changed individually for each Package in Settings.
PBL packages are like DLL files. In order to load them, it requires all dependent BPLs.
If you have custom package output paths:
Check if your DCP output path is included in Tools\Options\Language\Delphi\Library Library Path for Windows 32-bit platform
Check if no duplicates of outdated compiled packages in default $(BDSCOMMONDIR)\Bpl & Dcp directories
Add the paths to library source pas files in Tools\Options\Language\Delphi\Library Browsing path or Library path
In some specific cases, if the package requires some extra dll-s like DB Client libraries, check if these dlls are 32-bit and are loadable, like included in %path% environement variable.
Note, some libraries offers package installer tools, that automagically do all mentioned things for you.
Also, there are universal package installer tools for quick working environement setup in one click.
I don't know why this fixed my issue, but it did.
The output directories for the bpl and dcp was set to be $(Platform)\$(Config)
The project files for the different packages exists in the same folder so the above config was supposed to be the debug folder or the release folder. Why only this package was thrown off I still don't know, but since changing the above packages to have a fixed path suddenly I could now install dclqrd_DXE10_3.bpl.
Thank you all for helping.
I'm trying to install some nuget packages using vs code in F# interactive (fsx script). It has worked before because I have successfully installed FSharp.Data, but it seems to not work (anymore).
Following error
No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org (vs code)
Code
open System.IO
open System
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
#r "nuget:System.Data.Linq.dll"
#r "nuget:FSharp.Data.SqlClient.dll"
A related issue says to list the nuget sources through commandline:
Visual Studio 2019 F# NU1101 Unable to find package FSharp.core
When I do this I get a correct response:
So what is going on here?
When You use nuget prefix in the #r directive, you don't have to add ".dll" extension at the end of package name. It is required only when you are referencing local dlls.
https://learn.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/
I installed Akka.Cluster with dotnet add package Akka.Cluster and I'm trying to add the reference to an F# Script file.
After a long search I found: The default package location is ~/.nuget/packages on macOS and Linux
I use :
#r #"/Users/{myusername}/.nuget/packages/akka.cluster/1.4.10/lib/netstandard2.0/Akka.Cluster.dll"
In all tutorials I see people use #r #"../packages/ instead of #r #"/Users/{myusername}/.nuget/packages/"
Another alternative I found is using #r #"bin/Debug/netcoreapp3.1/Akkling.Cluster.dll", but I'm not sure this is a good practice.
Is there a shorter version than #r #"/Users/{myusername}/.nuget/packages/... to add packages?
(I know .NET 5 will bring #r "nuget:...")
I'm trying to find a simple solution that isn't so much manual work to reference packages. inside a .fsx file.
LinqPad 4 lets me simply add nuget packages
no intellisense or autocompletion
deletes package after download for certain types of packages (templatus for example)
LinqPad 5 beta lets me add nuget packages
deletes package after download for certain types of packages (templatus for example)
with frequent failures (intellisense and compilation)
VS2015 doesn't let you download/install packages for an fsx file (only into projects)
VSCode doesn't let you download/install nuget or paket packages for an fsx file.
So I wind up having to use .fsx in VS2015, while using linqpad to get packages downloaded (which still fails for packages like templatus where it downloads an exe not a dll). Then I have I can reference them as
#I #"..\LINQPad\NuGet.FW46\FParsec\FParsec.1.0.2\lib\net40-client\" // references AppData\local\ ... since . is %localappdata%\TEMP
doesn't match up with the relative pathing for intellisense/autocompletion engine in VSCode so I can't remove VS from the equation.
doesn't work outside of a machine that already has that package in that location
wind up doing a bunch of code that doesn't span .fsx files very well and has to be worked out per package reference
I don't want to create a project. I have a ton of individual scripts that are to be individually maintained and usable by others on-demand.
Is there an IDE (or fix/extension for one of these mentioned) that will give me intellisense, autocomplete, and package management for F# .fsx files that can work easily from user to user, machine to machine?
The Ionide plugins for VsCode and Atom have the functionality you're looking for
VsCode Instructions
Use the command palette to install the Ionide extensions ionide-fsharp and ionide-paket
You'll need to add your F# installation to your PATH
(on windows Rapid Enivornment Editor is my goto for PATH editing)
For F# 4.0 add C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0
Open the work folder that will hold your .fsx files
Executing paket commands through the command palette will be your primary interface for working with nuget packages
make a new .fsx file, (I recommend using the Advanced New File extension over the standard VsCode method)
The first step is to run paket init which is necessary to use paket to manage your packages
If you click the open button on the notification popups you can view the the output from paket in a side panel
After using the add nuget package command and entering extcorefor the package you should see the work tree
updated to
Then all you need to do is reference the package in the script and you'll get the auto-completion you're looking for
As of F# 5.0 you can now use the #r "nuget: Package" (ref):
#r "nuget: Newtonsoft.Json"
// Optionally, specify a version explicitly
// #r "nuget: Newtonsoft.Json,11.0.1"
open Newtonsoft.Json
let o = {| X = 2; Y = "Hello" |}
printfn "%s" (JsonConvert.SerializeObject o)
I have a mvc 5 web project with a number of NuGet packages installed (like email, log, pagedlist etc).
In a new similar project I would like to install the same NuGet packages. How can I in the old project list all installed NuGet packages?
You can find a packages.config file in the old project's root directory.
You can copy it to the new project.
If you go to Tools -> NuGet Packet Manager -> Packet manager settings and check Allow NuGet to download missing packages and the other check box that states Automatically check for missing packages during build in Visual Studio it will download it for you next time you build.
If you want to list all installed nuget packages for the project take a look at this one.
http://blogs.msdn.com/b/david_kidder/archive/2014/08/19/micro-blog-how-to-list-installed-nuget-packages-from-package-manager-console-and-be-able-to-read-them.aspx
You might also want to enable nuget package restore to restore the packages when rebuilding your project/s.
Here's another link for you - http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
In the root folder of your original project find a packages.config file. Copy its contents to your new project, same file name.
Go to Visual Studio > Tools > Package Manager Settings > General
Enable "Allow Nuget to download..." and "Automatically check for missing..."
Now build your new project
Most of the answers here are partially correct.
The first part is true. The packages.config file lists all packages that are used by the project.
However, all the answers about using Package Restore are incorrect. Package Restore will download any missing packages, however it is NOT the same as installing a package into a project. It will not add references, run any install.ps1 scripts, or add files, modify .config, etc. Package Restore simply downloads missing packages. It is assumed that the packages were already installed to the project.
In order for the packages to be correctly installed in your new project, open the Package Manager console, then type:
Update-Package -ProjectName MyProjectName -Reinstall
This will force NuGet to run through the install process and correctly install the package into your project.