1
votes

I am trying to run a program that is using Azure Functions. I am using Visual Studio 2017. This is the program:

https://github.com/Azure-Samples/blockchain/tree/master/blockchain-workbench/rest-api-samples/dotnet

I downloaded everything that is related to Azure Functions.

When I press debug I get the following error:

A project with an Output type of Class Library cannot be started directly In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.

Am I running this example correctly or did I miss something that is related to Azure functions?

Thanks

2
Forgive my ignorance, I don't see any Azure Function alike code in the linked project. Did you create a sample trigger and refactor it accordingly? Follow the tutorial to validate your steps.Jerry Liu
Oh my bad, I accidentally pasted the wrong URL. Fixed now. There is a HttpTrigger there which baffles me (new to Azure functions). Thanks!Contentop
Could you verify you work with latest Azure function and Web Jobs Tools? check this, see 15.10.2046 now. Also could you delete the package Microsoft.NET.Sdk.Functions and add it using nuget again?Jerry Liu
Ok, I am using the most updated tools. deleteing the package and adding it again did help. Now I get a weird error where I press F5 and it prompts the CLI and it simply says "Unable to find function project root. Expecting to have host.json in function project root." As you can see in the github of the project, there is a folder called "functionSource" that has a host.json file there. Do I need to define this folder as the root? if so, how? Thanks for your helpContentop
You are right, the functionSource folder is function project folder, other content seems not useful for Azure Function. In VS, open new project, select Functions.csproj should work.Jerry Liu

2 Answers

2
votes

The package Microsoft.NET.Sdk.Functions(used to build Function project) seems broken, try to delete the reference and re-install package using nuget.

As for the error

Unable to find function project root. Expecting to have host.json in function project root

In VS, open new project and select Functions.csproj to locate the project.

0
votes

Solution

Try to degrade Microsoft.Net.SDK.Functions, I degraded it from 1.0.29 to 1.0.28 and it started working.

There seems to be some problem with the Nuget Package.