This article is one of those that is going to help remind me how to do this deployment, as it can be a bit tricky. If you are working with F# for web jobs, like I have started doing, there are a few steps.
- Create a new console application
- Add proper nuget packages
- Manually add a .dll reference and copy said .dll to output
- Zip up and deploy entire output folder.
Create new Console Application
This is easy. See picture.
Add Proper Nuget Packages
These packages contain the framework for Azure Web Jobs.
Add Proper References
So I discovered that I needed FSharp.Core in my solution. I got the craziest errors that seemed to have nothing to do with this, until I added a printf statement to see what my connection string was. Anyways, you need to manually add a reference to FSharp.Core v4.3.1 . You also need to copy this to the output directory of your solution, as setting the properties to copy currently does not actually copy this library as expected.
Zip Up Entire Folder and Deploy
This should be straight forward. Using any other article out there in the world, you can deploy, but I will walk through here as well.
- Go to your Azure Portal http://azure.microsoft.com/en-us/
- Navigate to the website you wish to deploy this webjob with
- Click on the WebJobs section
- Click the Add button
- Name your web job
- Select your zipped up output folder
- Set your job per type you want (I use continuously as I link to queues mostly)
- Click the check mark
- If it stays on “Running” everything went well.
You can bypass manually adding FSharp.Core and manually copying it to the output directory by installing the FSharp.Core nuget package. It appears that there is something going on with the GAC that allows the web job to work locally without the .dll in the output folder, but when you deploy it will not work. Therefor it must be there. I prefer to add the FSharp.Core nuget package.
That’s it! If you want, you can navigate to this repository, which has a functional web job you can try out: https://github.com/drcrook1/Nerds4Hire Note that you will need to go through all of these steps with this same project.