C# Compiler Error Message: CS0246

I am recently trying Open XML SDK 2.0

Everything compile just fine and when I run my solution, this error comes up.

Compiler Error Message: CS0246: The type or namespace name ‘DocumentFormat’ could not be found (are you missing a using directive or an assembly reference?)

After a little struggle, I think it is caused by my runtime setting.

Because I am newbie to VS 2008 IDE and never setup my own server before, I make many stupid mistakes. I havn’t setup an IIS, just using my IDE. When I reference to an external .dll, I don’t know that beside add the reference, I also need to set its property ‘Copy Local’ to ‘True’, so that the .dll can be reference at runtime.

6 thoughts on “C# Compiler Error Message: CS0246

  1. I have same problem, my application work correctly on my local computer but when i upload to server i receive the error, i dont understand this part … also need to set its property ‘Copy Local’ to ‘True’, so that the .dll can be reference at runtime. where you set this property??? i neet do start this aplication anny suggestion….

  2. click your reference item in the project tree, then you can see that property in the property window. But I don’t think this will solve your problem.
    you said you upload to server, If I understand correctly, your development machine is not the server, so, the problem depends on how you deploy your solution to your server. your problem should be. the .dll you use is not found on the server. Have you put the .dll in your server and reference to it correctly?

  3. It’ actually simple web application that working normally on my local computeer, i’m uploading exactly same working code and all files from my local folder to the server, so im searching the reason why it work on my computer but not on server? I have searched the net and it says misspelled the name, but if i have misspelled the name then should be misspaled on my local computer to, i have all files and still searching the reason…

  4. hi, prvut
    I think your opinion is probably right.
    I am sure you can solve your problem with the help from the administrator.
    I think you can do some configuration to you application web.config or assembly to try solving your problem too.
    but I myself is a newbie to server setting, so, good luck

  5. The problem is solved, one of the reason for CS0246 error code is that if your files are not registered on IIS like aplication and your instanced objects can’t be used.
    So thanx again. i hope this blog conversation will help to someone with same problem.. see ya..

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s