0

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?

3
  • Have you tried simply doing a nuget restore, just like with any other msbuild based project? Commented Jun 17, 2017 at 18:57
  • I just tried this using nuget restore mysolution.sln and get the message Nothing to do. None of the projects in this solution specify any packages for NuGet to restore. If I knew how Visual Studio was restoring the packages, I could just copy that. Commented Jun 17, 2017 at 22:42
  • I just tried on my test app (github.com/davidebbo-test/FunctionAppVS2017_3Preview), and nuget restore followed by msbuild works great. Make sure you do this from a dev prompt for VS 2017 preview. Commented Jun 19, 2017 at 23:41

1 Answer 1

1

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.

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

Comments

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.