1

I have created Azure Function (Version 2.0) in Azure Portal, project got created with some initial files including run.csx. I have developed my Azure Function in C# Script.

Now I want to develop same Azure Function in Visual Studio using C# Script. But whenever I tried to create and develop, I get everytime C# project.

Can anyone help me to develop and run Azure Function in C# Script?

3 Answers 3

2

The VS doesn't generate c# script Function project, if you want to generate .csx project you need use Azure Functions Core Tools to generate Azure Function.

There is an option --csx when you use func init you could use to initialize a C# script (.csx) project.

Further more information, you could refer to this doc:Create a local Functions project.

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks. I am currently using command line to develop and deploy azure function in C# Script. But not able to run locally the same function using func host start command for C# Script.
@vivek patel, what's the error? I test with csx function local, it works well.
[7/12/18 18:02:37] Starting JobHost [7/12/18 18:02:37] Starting Host [7/12/18 18:02:37] Loading functions metadata [7/12/18 18:02:37] 0 functions loaded [7/12/18 18:02:37] Generating 0 job function(s) [7/12/18 18:02:37] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
@vivek patel, what function you test? HTTP, timer or others? And in your situation the function is already running but could not detect the function. And if you test the storage Function , did your use the right package and configure it right.
I am trying to test HTTP Trigger Function. As well my folder structure is like HTTPFunctionApp/host.json and HTTPFunctionApp/HTTPFunction/run.csx. I am running func host in HTTPFunctionApp directory. Can you please share what's your folder structure and using which command you are running your function in local?
|
1

You need to create a Project for your function. Then you will have a .cs file and a host.json file.

You can develop everything in VS and run the function locally. When it's running you can publish to azure.

Once you start making functions on VS the deployed code will be compiled meaning that you can only make changes using VS which is desirable. Much more stable than the portal...

Start by making a simple function just to test and, although it will take a couple hours, soon you'll get the grasp of it.

2 Comments

Thanks for answering. You are right but what I am trying to do is I want to develop Azure Function in C# script (.csx files, not .cs). VS does not allow me to develop C# Script files for Azure Function. Is there any way of implementing C# Script project in VS?
I see... I don't think there is... But I'm not 100% sure
1

Visual studio does not support .csx file, refer here.

You can use command line tool or visual studio code for .csx as in link mentioned above.

But there is a workaround, you can use command line tool to create .csx azure function, and then include the project to visual studio. More details follow this link.

1 Comment

Thanks. I am currently using command line to develop and deploy azure function in C# Script. But not able to run locally the same function using func host start command for C# Script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.