ASP.NET C#: "object reference not set to an instance of an object" in ASPNETCOMPILER

Hi

I have a website made in VS 2012. The site builds, complies and runs without problem on my localhost. However, when I try and publish the website I get this error:

"Oject reference not set to an instance of an object" in the file ASPNETCOMPILER.

I have searched the net for a solution, and I have found various solutions, but non of them have worked.

Here are some of the things I have tried so far:

- Deleting all dll files in the Bin folder with the extension .Compiled
- Deleting all dll files in the Bin folder with the extension .Refresh
- Disabling my anti virus
- Trying to compile the website from another computer
- Moving the website from the development server to my local computer and publish it from there

Anyone else how have had this problem and found a solution not mentioned above?

Thanks in advance.
LVL 1
poultarpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
>>Oject reference not set to an instance of an object

If you looked within ExpertsExchange for this error you will find hundreds if not thousands of hits.
Basically it is the following where X is for example a class type.

X x;  //x has a default value of null - it does not exist
x.DoSomething();  //error

and the solution is simple
X x = new X();  //create an instance of X
x.DoSomething();  //is OK because x has been created
0
Carl TawnSystems and Integration DeveloperCommented:
Does your project use any third-party libraries that may be missing from your production server?
0
poultarpAuthor Commented:
@AndyAinscow

The problem is not when I build, complie or run the website, the error comes when I publish the website.

I can even copy the entire website to the server and the site runs as it should. I just need to be able to publish it so I don't have to copy every single file to the webserver.

@Carl Tawn

I don't think so, but I will check up on it as soon as I get the chance.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

AndyAinscowFreelance programmer / ConsultantCommented:
>>the error comes when I publish the website.

Yes, that is what puzzles me a bit.  It sounds like something is missing or the publishing tool has a bug.
0
käµfm³d 👽Commented:
Just to confirm: your project type is a web site or a web application?
0
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
There is some setting for publishing of website. The setting say to include files that are required by this website.

So I'm assuming that the compiler is not publishing some dll or the file that might be required for your website. I faced such issue when I published website with MySql.

The MySql.Web.dll depends on MySql.Data.dll file. But compiler wasn't publishing it for any reason. Therefore as hint to detect -

1. Build your project in release mode. As that is the by default mode for publishing too.
2. Cross-match files in Release folder with the published files.
3. I suspect that there might be some of files missing in published folder.
4. Copy those missing files in published folder.
5. Test your website. Should work fine if steps 1 to 4 matched.
0
poultarpAuthor Commented:
@kaufmed

Im 99% sure the type is a Web site. Anywhere I can confirm this?

@Vikram

No files are put in my publish folder - the error comes before any files are created.
0
Carl TawnSystems and Integration DeveloperCommented:
Can you post the full build log from when you try and publish? i.e. the contents of the "Output" window.
0
AndyAinscowFreelance programmer / ConsultantCommented:
Please supply what options/settings you are using.  Is this just one application or do you have nested applications?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
I do agree with @AndyAinscow for his statement for nested applications.

Might be you are using multiple projects in a single solution. For e.g. projects named as A and B.

The project A might be referencing dlls from project B. However the build order would be opposite. Might you are building project A first instead of project B. So project A is not able to find respective dlls or references.

And so could be one of the reason for issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.