Configuring asp.net web site to work with any excel version - asp.net

I am using Visual Studio 2013 (asp.net, VB)
I have a created a website that creates and saves an excel document as part of a process started from a button click.
It works fine on my PC as I have excel 2013 installed and I added a reference to the office 15 object library. When I try to run it from the server I get the following error.
Could not load file or assembly 'office, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its
dependencies. The system cannot find the file specified.
This is because the server has excel 2007 installed I am guessing. The main user of the site will be using excel 2010 for the moment. Is there any clean way of making sure my site will work regardless of the version of excel the user has?

Related

how to combine vb.net project with vb.net website

I am actually a java/jsp programmer and I am newbie to vb.net. I wonder if I can combine a project made in vb.net 2008 with a vb.net website (like servlet in java)
I have a ready made project with assembly .dll file that is based on 2.0 .net framework.
This project (software) actually to connect it to a handkey 2 hardware. It register users to the handkey.
I want to deploy it to the internet as a website.
-----What I have try so far----
I have created a new website (in vb.net 2008) and add the dll as a reference but it send this error
Could not load file or assembly 'RsiDotNetDLL, Version=2.4.0.3, Culture=neutral, PublicKeyToken=11d948a84312b819' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I just want to share my solution
I have fixed this by open this website with visual studio 2015, select Debug---> Options---> Projects and Solutions---> Web Projects and tick the option "Use the 64 bit version of IIS Express for web sites and projects"
Thanks

how does vb.net handle multiple versions of the same dll

I am working on a website written 5 years ago in asp.net 2.0 and vb.net 2005 and visual studio 2005
The website uses a data access layer written using subsonic. The DAL is a class library which imports the subsonic dll. It also needs to import the mysql.data dll to connect to an underlying mysql database. Subsonic needs a specific version of the mysql.data connector (5.2.2) and so this is the version the class library imports.
The website also uses a custom membership provider for mysql. This is another class library which mysql.data dll version 6.5.4
The website uses both the DAL and the custom membership provider and so imports the dlls for both of these class files. I'm confused how it can handle the 2 different versions of the mysql data connector used by these class libraries
The web.config file has this line
<add assembly="MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/></assemblies>
If i delete this line and then rebuild the website the line appears again.
The website also has a copy of the mysql.data 5.2.2 dll in the bin directory. If i delete this file and then rebuild the website the file appears again. In other words the name of the dll appears in the bin directory in the explorer window of visual studio and the physical file appears in the bin directory of the website.
I would really like to know what is going on here and how vb.net can use 2 versions of the same dll. Everything seems to be working ok but the components in this website are so old that they are unsupported. I really don't want to break anything and then not be able to fix it.
Thanks a lot

MVC: Visual Studio Publish Web dialog cannot find my application's Views

I am using these steps to publish my ASP.NET MVC 4 application using Visual Studio 2010 on IIS 7.5 running on a 64-bit Windows 7 Professional machine.
When I click the Publish button on the wizard after entering the values, it reports a single error that reads:
Copying file Views\Shared\Error.cshtml
to obj\Debug\Package\PackageTmp\Views\Shared\Error.cshtml failed.
Could not find file 'Views\Shared\Error.cshtml'.
I looked into the target folder where the wizard dumps the necessary files that will be needed to deploy the application. It turns out that the folder had the Views folder which had only the _ViewStart.cshtml of the root Views folder, but no other View. My application has at least 20 views, perhaps more.
I realized that it was my fault. The local copy of my project had the file Error.cshtml in the Views\Shared folder. However, the TFS copy of the project file did not. Apparently, the file had been excluded from the project at some stage.
I excluded the file from my project locally and ran the build and it worked.
In my case the problem was that the file was in the solution but didn't actually exist on the local file system.
For me, this problem occurred when I moved a file (via explorer) from the shared folder to another folder.
I added the file in visual studio, but did not "delete" the file from the shared folder (as far as visual studio was concerned).
For some reason, visual studio did not put a little flag or warning sign to tell me the expected file was missing (even after a refresh), so I didn't notice (although trying to open the missing file revealed the problem).
The error message is clear, and self explanatory. I just couldn't understand it for some reason.

make a com reference local

I have a asp.net website with c# code behind and using visual studio 2010.
I added a reference to a com object "Microsoft Excel 14.0 Object Library" to manage excel files in my website. I works well in debug, on my computer where I have excel installed, but when I publish the website and deploy it on my server, it crashes because it does not find the reference (excel is not installed there). It crashes at the reference in the web.config file
<assemblies>
<add assembly="office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
<add assembly="Microsoft.Vbe.Interop, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
</assemblies>
Is there a way to make that reference local, like a dll, so that the website is able to use it even if excel is not installed?
There's a notion of PIA assemblies for Microsoft Office libraries. Basic idea is the following: to build solution you need to reference only PIA assemblies, that reference real office assemblies themselves. They may be distributed with the solution and be built correctly on different PCs even without office installed. I don't know though would it run (probably would, but any excel-related function will make it crash).
But you can't use office applications on PCs without office. It just doesn't deploy along. So one solution would be to check if office is installed and dynamically load the necessary assembly. Ideally, excel module should be isolated from the rest of the application.
There are several libraries using only a DLL file, like EPPlus

Crystal Reports Version Conflict

I developed a web app that creates crystal reports with VS Crystal report version 13.0.2000.0. I tried publishing it and putting it in the wwwroot folder (IIS7). When I run it, it give me this error:
Parse Error Message: Could not load file or assembly 'CrystalDescision.Web, Version 13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file.
Source Error:
<% Register Assembly="CrystalDecision.Web Version=13.0.2000.0, Culture=Neutral, PublicKeyToken=692fbea5521e1304"
When I run the command %windir%\assembly on the server, the version is 10.5.3700.
My questions is which crystal report should I download/buy to upgrade my server crystal reports? Because there was many links on the SAP website (ie. Crystal Report, Crystal Report Server, Crystal Report Viewer, and more).
Have you installed the Crystal Reports 2010 runtime (Redist Installation package) on the computer that you are having trouble? The 13.0 version is CR for VS 2010 and you can download the runtime here
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/22083
It is all about different version.
Remove the references to Crystal*.* and right click on References to add the correct ones
Assemblies, Extensions
You will see everything installed on you computer environment.
Select the ones with the same version that is on your web.config
Make sure the versions on web.config match the whole fu..ing s.it
This is a pain on the ass brought to you by Crystal Reports !

Resources