Visual Studio 2017: "Object reference not set to an instance of an object" while loading the project
Solution 1
For me on Visual Studio 2017, none of the suggestions worked. What worked was shutting down all Visual Studio instances and wiping away the .vs
folder in the solution root.
Solution 2
I've managed to get it fixed. Not sure that it's brilliant solution, but better than nothing.
I've removed the line below from the failed project's .csproj
file after dozens of random tests.
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Now it loads correctly and it seems to be working well.
Btw, honestly I have no idea what does this line mean and will appreciate someone who can explain why is getting rid of that line fixes the issue and basically why this line is needed.
Solution 3
My symptoms were that all the class libraries in my solution were loading correctly but the MVC project was failing to load with the error message in the question.
Running Visual Studio as administrator fixed the problem for me.
Artyom Pranovich
Passionate software developer and just a cool guy! :D http://www.linkedin.com/in/apranovich
Updated on July 05, 2022Comments
-
Artyom Pranovich almost 2 years
I have a project inside the VS solution that loads correctly in VS2015, but it seems to be corrupted in VS2017 (RC2).
In the solution explorer it shows that its "load failed" and when I try to reload it I receive an error popup with the message "Object reference not set to an instance of an object".
I thought that it might be because VS2017 changed somehow
.csproj
file automatically for their needs, but after compare it with the version within VS2015 solution I found out that they are not different.Have anyone experienced something like that? And how it's possibly can be fixed?
Thanks.
-
Jared Beach over 5 yearsI should have known
-
Chandan over 5 yearsSame issue , re install did not work . Still seeing other options
-
fr0ga over 3 yearsWorked for my project after conflicted merge