dhughes
dhughes

Reputation: 735

Build fails when building Azure function with MSBuild version 15 from command line

I have created an Azure function application in Visual Studio 2017 (as detailed here) and the application builds without an issue from within Visual Studio. However when I try and build the application from the command line (simply running msbuild.exe mysolution.sln) with MSBuild version 15, I get errors such as:

error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) which is most likely because the application references Microsoft.Azure.WebJobs by default as mentioned here.

So I presume I need to restore the Microsoft.Azure.WebJobs package somehow but I am unsure on how to restore packages in an Azure function application manually. I created a project.json file and listed the package in there but that didn't work. I then created a packages.json nuget file and that didn't work either. Any ideas?

Upvotes: 0

Views: 718

Answers (1)

dhughes
dhughes

Reputation: 735

Worked this out - I need to run msbuild.exe mysolution.sln /t:restore first before I run msbuild.exe mysolution.sln which I found from the information here.

Upvotes: 1

Related Questions