Last post Aug 28, 2012 10:31 AM by gsk
Aug 16, 2012 11:19 AM|gsk|LINK
I just can't figure this out so I'm hoping someone can help. Site builds fine.
Site was publishing fine until I made a few changes. Now can't publish the site (to my local machine) and get 'Object reference not set to an instance of an object' - No file, no line number, no direction as to what is causing the error. I should add I am
selecting updateable and single page assemblies. If I deselect single page assemblies it will publish. Could also no longer publish two other different sites.
BUT, I copy the same sites to my laptop and they publish fine with single page assemblies.
After trying everything - renaming classes, directories, deleting temp files, reverting back to previous versions, etc. finally wiped my OS, re-formatted and re-setup my dev machine.
Built the site up from scratch, page by page, publishing after each page. Worked fine until I'm now at the point where
any new WebForm I add using simply 'Add New Item' (Web Form), results in the publish error. Doesn't matter where I add it, what the name is, etc. Doesn't matter if it is using a master page, not using a master page - as I said, just add a blank
Web Form called Test.aspx and I can't publish using named assemblies.
I don't have a clue anyomore where I should be looking. Can anyone suggest what could be causing a publish issue simply by adding a blank WebForm to the site?
Aug 27, 2012 10:34 AM|DavidGerrard|LINK
I'm having almost exactly the same issue... When I Publish a website with just a single webform and "Updateable" selected, it's fine. But as soon as I add a second web form
in a subdirectory it fails with exactly the same "Object Reference not set" with no line number or any indication of where the error is occuring.
Aug 27, 2012 05:19 PM|gsk|LINK
I had a bit of success that maybe will help you. I had tried this before and it didn't work, so I'm not sure what changed, but here are my exact steps:
I looked in the .sln file that was auto-created for each of my web sites/projects and noticed the GUID was the same for each. I manually edited one of them and tried opening the project at which point VS said it couldn't load. I proceeded to delete the .sln
file and open as web site. At this point I was able to publish.
Again, I had tried deleting these .sln files before but still encountered publishing issues. I re-created the same steps for each of my other projects that wouldn't publish, and had the same success after deleting the .sln files.
If this were to happen to me again, I think I would start with 'Add a New Project', then copy in my web files and refresh. I suspect there was some conflict between certain files I copied between sites and I was simply opening these as web sites within VS.
Maybe some sort of conflict when it auto-generated the .sln or named them as projects?
Again, pure speculation but where there's smoke there's fire. Let me know if this works for you.
Aug 28, 2012 10:02 AM|DavidGerrard|LINK
It seems that lots of people seem to be having this problem, and it also appears to come and go intermittently. As a result, there's lots of conflicting advice as things start working again on their own but people attribute them to the last thing they tried.
It seems one recurring piece of advice is to delete the entire Bin directory in your solution. Not just the references in it, but the entire folder. Then re-add all your references.
That just worked for me, this time. But then again I've tried other things (e.g., deleting temp files, rebooting VS2010 etc) and it's started working again, too.
Let's hope this issue has gone in VS2012. But then that reads like another victory for Microsoft's Marketing Dept., doesn't it?
Aug 28, 2012 10:10 AM|DavidGerrard|LINK
Indeed - it's stopped working again just now and deleting the Bin folder makes no difference at all this time.
Aug 28, 2012 10:31 AM|gsk|LINK
In my case I am certain what caused it as I went through 3 projects: Can't publish; modify .sln; can't load, delete .sln; load web site - can finally publish.
Knock on wood things are still working.
I hope you get it sorted out as it was the most frustrating issue I'd come across in a dozen years. I'm still paranoid each time I publish now.