Last post May 15, 2013 05:37 PM by peterafonin
May 14, 2013 03:43 PM|peterafonin|LINK
I have an ASP.NET application (created using VS 2012) that is creating Excel files. I've set a refernce to Microsoft.Office.Interop.Excel.dll and it works fine on my PC. However, when I publish it to the server, it doesn't work:
Could not load file or assembly 'office, Version=22.214.171.124, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
I've installed the
Visual Studio 2010 Tools for Office Runtime from here:
Yet it still giving me the same error. What could be the problem?
May 14, 2013 04:15 PM|Mark_F|LINK
Did you place the .dll in your bin folder on the publish server?
May 14, 2013 04:50 PM|Illeris|LINK
Similar topic here : http://forums.asp.net/t/1800156.aspx/1
Did you install Office on your server? If not, ...
May 14, 2013 05:13 PM|peterafonin|LINK
Yes, I put this dll to the bin folder on the server.
Yes, I saw this topic, thanks.
I didn't install office on the server, I've installed this runtime package instead.
May 15, 2013 08:51 AM|Illeris|LINK
Please check the system requirements for VSTO : http://www.microsoft.com/en-us/download/details.aspx?id=24263
It does require MS Office to be installed on a server in order to work. Just installing VSTO is insufficient.
May 15, 2013 09:14 AM|Mark_F|LINK
You say that you created the project in VS2012, but you installed the version for VS2010. You mentioned;
"I've installed the
Visual Studio 2010 Tools for Office Runtime from here:"
Matbe you should check for compatability, as well as installing Office on you server.
May 15, 2013 10:01 AM|peterafonin|LINK
Thank you. It's compatible with VS 2012:
"This download installs the Visual Studio 2010 Tools for Office Runtime, which is required to run Microsoft Office based solutions built using Microsoft Visual Studio 2010 and 2012."
I've never heard about installing Office on the server, it's a client product. Perhaps there is another runtime package I'm not aware of?
I have a feeling that perhaps I shouldn't install anything, all I need is appropriate DLL, and it was copied correctly, but for some reason doesn't work right. Maybe this assembly is not in GAC? But usually the error message says this.
May 15, 2013 10:08 AM|Mark_F|LINK
MS Office is desk top software, sometimes desk top software needs components to run that are not available in the dll only. Web applications and desk top applications are different. I found this out when I was using Map Point in one of my web apps. Since
I was using/referencing the desk top version of map point, I had to install it on my web server because there are some component that I needed to use.
May 15, 2013 11:31 AM|peterafonin|LINK
Office installation on the server is not recommended:
"Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation."
I wonder if this package is safe to install and can help:
Microsoft Office 2010: Primary Interop Assemblies Redistributable:
May 15, 2013 05:37 PM|peterafonin|LINK
OK, I gave up on this and used recommended method instead - OfficeOpenXml:
Turned out to be pretty simple, works well.