Azure-functions-core-tools: CLI and using nuget packages via project.json

Created on 16 Apr 2017  路  2Comments  路  Source: Azure/azure-functions-core-tools

When I use functions from the portal, if I edit project.json to add/remove nuget packages as dependencies, they become available and ready to use immediately after I change and save that file.

What is the intended behavior from the CLI tools? As far as I can tell, if I create a function via CLI, and edit the project.json file, nothing happens. I presume that in the future, the CLI behavior will be similar to the portal behavior, is that correct?

As a somewhat related question: in the local version, if I add a nuget package via project.json, where on the local machine would I expect to find it?

The reason I am asking is, I am trying to use F# functions completely locally in VsCode, using #if INTERACTIVE directives to load dependencies and get intellisense, but I would need to know where to look for non default nuget packages to make that work.

question

All 2 comments

The CLI does restore NuGet packages using project.json, but the host has to be running (via func host start or func run). In the portal, the host is always running, unless you stop the site.

The NuGet packages on the local machine will be restored to %USERPROFILE%\data\Functions\packages\nuget. Tip: you can see the location by inspecting project.lock.json.

Is this still applicable? I have a project.json in my function app root, but nothing I do creates a lockfile or seems to restore dependencies. dotnet restore no longer works with project.json. I'm fairly new to the whole Microsoft stack, so maybe the answer is obvious to someone more seasoned, but this issue is one of the first results I found when searching for a solution. The official docs only mention project.json, so as a newbie I have no idea whether I should use that or .csproj files, and if the former, how I'm supposed to restore dependencies if the official restore command no longer supports this format.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackmusick picture jackmusick  路  4Comments

frozenbubble picture frozenbubble  路  4Comments

nebosite picture nebosite  路  3Comments

AssassinTee picture AssassinTee  路  3Comments

brandonh-msft picture brandonh-msft  路  4Comments