Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Object reference not set to an instance of an object" when building my cloud project

When I build my solution with a bunch of cloud projects, I see one or more "Error: Object reference not set to an instance of an object" messages in the output. When I try to run one of the cloud projects, I get the popup "There were build errors. Do you want to continue and run the last successful build", but there are no errors in the Error List and the same "Error: Object ref..." errors in the output.

When I click package on my cloud project I get a messagebox with "Object reference not set to an instance of an object", also when I right click -> properties on the project reference under "Roles" in the cloud project.

If I use the command line to build my solution with msbuild, I don't get the error.

I tried restarting Visual Studio as well as my PC. I also tried reinstalling Azure Tools (2.1) and then Visual Studio.

My colleague is now getting the same problem on Visual Studio 2013 RC.

Has anyone had the same problem?

I've searched, but only found people with problems when publishing, where the solution is to package manually.

like image 617
Matthijs Wessels Avatar asked Oct 03 '13 15:10

Matthijs Wessels


People also ask

How do I fix object reference not set to an instance?

To fix "Object reference not set to an instance of an object," you should try running Microsoft Visual Studio as an administrator. You can also try resetting the user data associated with your account or updating Microsoft Visual Studio to the latest version.

Why does it say object reference not set to an instance of an object?

The message "object reference not set to an instance of an object" means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs.

How do I fix NullReferenceException in C#?

You can eliminate the exception by declaring the number of elements in the array before initializing it, as the following example does. For more information on declaring and initializing arrays, see Arrays and Arrays. You get a null return value from a method, and then call a method on the returned type.


2 Answers

I had the same problem. Right click on the cloud service project, unload the project. Reload it again.

like image 186
Siva Avatar answered Oct 03 '22 09:10

Siva


Try removing the role from the cloud project, re-build solution (if there are errors please post them), then add the role back into the cloud project and re-build.

like image 21
8 revs, 8 users 48% Avatar answered Oct 03 '22 08:10

8 revs, 8 users 48%