2
votes

I have updated our ASP.NET Web API solution to include the Microsoft.Azure.NotificationHubs Nuget package as I want to be able to send push notifications to our mobile clients. I have written a new controller that does this. Everything works fine.

When I check-in the code changes to our on-premise TFS build server I am getting the error:

Error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I have updated the build server to the latest VS2017 build tools but am still getting the error. I can't determine if this is an MSBUILD or VS error.

I am using Visual Studio 2017 15.9.4. The project uses .NET Framework 4.6.1.

UPDATE After some further investigation I can see that the TFS build server is NOT restoring the Nuget package for Microsoft.Azure.NotificationHubs but restores all the other Nuget packages. So the problem seems to be due to the Nuget package not being restored during the build

Here is a screenshot showing that the package.config correctly references the nuget package. But for some reason this nuget package is NOT getting restored during the build.

enter image description here

2
please provide your own answer and accept it so that you can close this threadJayendran
I don't have an answer. What makes you think I do?DomBurf
Oh, I see I misunderstood that from your update you got the solution. Actually your problem is NotificationHubs nuget alone not get restored? In such case can you look out the package.config is included with that reference ?Jayendran
I've checked the packages.config and it's correctly referenced there. I've updated the build server with the latest SDKs. Same error :(DomBurf

2 Answers

1
votes

I've eventually managed to fix this by adding a commandline nuget restore task to the build pipeline.

NuGet.exe restore MySolution.sln
0
votes

I resolved it by uninstalling and installing the nuget package back again.