azure-functions-templates icon indicating copy to clipboard operation
azure-functions-templates copied to clipboard

HttpTrigger-CSharp-Isolated displays 'Restore Failed and Post Action Failed' after successful creation

Open oneolddev opened this issue 2 years ago • 0 comments

This issue was uncovered originally in Azure Functions Core Tools when creating an isolated c# function. Please see the following: https://github.com/Azure/azure-functions-core-tools/issues/3217#issuecomment-1483750491.

Restoring C:\git\bug-free-sniffle\apitest\WeatherForecastFunction1.cs:
C:\git\bug-free-sniffle\apitest\WeatherForecastFunction1.cs(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. 
 Line 1, position 1.
Restore failed.
Post action failed.

It appears that it is the result of the template picking up the primaryOutputs path during Nuget restore according to lines 67-72 in the template.json.

        {
            "description": "Restore NuGet packages required by this project.",
            "manualInstructions": [],
            "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
            "continueOnError": true
        },

It should be picking up the project file. A quick scan of the other dotnet isolated templates show the same pattern of code.

The error messages appear to be superfluous when running from Azure Functions Core Tools but does raise concerns for newer users. According to Post Actions Registry, I believe it may be resovable by adding an args configuration.

oneolddev avatar Mar 25 '23 17:03 oneolddev