简体   繁体   中英

VS2008 error trying to publish website

When I try to publish my website (publishing has been working perfectly well for ages), I am getting an error. The output window is no help; the last line of the Pre-compiling stage is:

Building directory '/myPath/'.: Publication (web): Object reference is not set to an instance of an object.

There is no code showing to debug.

How can I debug this and find out what is causing this error? The website runs just fine in debug mode locally.

In response to John Saunders' comment below: Version is VS2008 9.0.30729 (appears to be the latest version; I've checked for updates) and .Net 3.5 SP1.

I've tried publishing to both a remote website server and a local (my computer) server. Publishing a dummy website with only a 'default.aspx' file works fine.

When Visual Studio publishes a website it checks for errors in the code first. If it finds an error it won't publish. So it might be that you have an error somewhere in your C# code. That error:Object reference is not set to an instance of an object, will only be thrown when an attempt is made to reference that object. I suggest that you check your aspx.cs files.

Well I think you might have to go through the code and trigger the events that create new objects. Does your website have forms? Are you passing data between pages? What kind of events are triggered when a button is clicked? These are typically the kind of things that will create a new object in a webpage. I know it could be very annoying to go through all the pages but sometimes it happens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM