ASP.NET DLL hell - asp.net

I have third-party workflow software (Captaris Teamplate) that's referencing an assembly from my project that's referencing other assemblies from our project solution all through the GAC.
When our application executes, it invokes a Captaris Teamplate method to create a workflow process which in turn uses project assemblies in the GAC to store data into
a database.
The problem is when I compile my project and remove assemblies from GAC replacing them with new versions, but when I run entire project, Captaris Teamplate throws an error:
Exception Type: System.IO.FileNotFoundException
Message: File or assembly name VBAssembly, or one of its dependencies, was not found.
FileName: VBAssembly
FusionLog: === Pre-bind state information ===
LOG: DisplayName = VBAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
That is, it wouldn't give me the name of the assembly DLL file. It's trying to find nor version it's looking for. Troubleshooting of such an issue is like shooting in the dark and it can kill days of deleting old assemblies that are kept in the ASP.NET temporary files folder, project folder and website folder (inetpub), rebooting, etc., testing for error, getting an error, searching for some other old assemblies, etc.
So my questions are:
Is there a technique that would allow me to extract more information on this exception such as the name of the assembly and version that is missing?
Is there an easy way to clean up all those old assembly versions from the system at compile time?
Any other suggestions in dealing with this DLL Hell and/or Captaris Teamplate?
We're using ASP.NET version 1.1 with Visual Studio 2003 with Captaris Workflow 5.0.

Another thing you can do is "forcibly" reference the version of the assembly you want through the web.config. Here's a sample of what I have in my web.config to make sure I'm accessing the proper version of Crystal Reports in my web app...
<assemblies>
<add assembly="CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Shared, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.Enterprise.Framework, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
</assemblies>
I'm sure you could do the same thing to reference your libraryies, you just need to make sure they have a strong naming key so that there is a PublicKeyToken to reference.

If at all possible, avoid the GAC. It lends itself to DLL Hell. The VBAssembly may actually be unmanaged, and may have been removed from the WINDOWS/system32 directory.

Maybe you can create a binding policy that will redirect any request for the assembly you removed from the XXX to the GAC to the new location. See Binding Policy.

Or you can use .NET Reflector.
However, you also may just want to call up the vendor and ask for help from them. Most of the time, these guys take a pretty good pride in their products so they will take the time to step you through your problem over email or chat. I just ran into a similar issue with a third-party spreadsheet component that I was using and even though the company was in Germany, I was able to resolve the issue pretty quickly by having them recompile the component on their end and when they sent me the new DLL it worked just fine.

Probably the most effective way is to run FusLogVW.exe (part of .NET Framework SDK, see Assembly Binding Log Viewer (Fuslogvw.exe)), which will log every bind failure that happens. That way, you can list failed binding attempts from your application.

Use Dependency Walker to find out what dependency is missing.

A starting point is to try to use the 'Clean Solution' option and then build the solution.

Related

Visual Studio 2013 can't find present DLLs

SCENARIO
I undo all my pending changes, and get latest version from TFS. I attempt to build my solution and I get errors to do with two assemblies, these are:
System.Web.Helpers
System.Web.WebPages
A different member of my team does the same as me and for her it all builds fine and the assemblies are found with zero issues.
Our web.config is the same since we both check that out of TFS.
WHAT I HAVE DONE
I asked her for the path to where the two troublesome DLLs sit on her machine, and checked the same path on my machine, they exist. I have those DLLs in the same folder and they are the same version as hers!
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\
I also compared our projname.csproj.user file to check and see if she had anything different in hers after I read this topic. But that too was the same as mine!
I then proceeded to remove the dlls, then adding them manually from the path above, and now all my errors are gone, but I then get told that my web.config has changed and needs to be checked in, and I know what has changed:
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.Helpers.dll</HintPath>
<Private>False</Private>
</Reference>
The above used to be a on line, without the HintPath stuff.
I don't want this to be checked in, and it is really tiring to have to remove this stuff each time I want to check-in my code into TFS.
PROBLEM
System.Web.Webpages and System.Web.Helpers are not being loaded on my machine, but are on my other team member's machine.
possible reason is dll was registered on your colleagues machine. So it didn't have any HINTPATH. As per MSDN "Assemblies registered in the GAC won't have a HintPath entry for those references". Make sure this referenced assembly is registered on the GAC on all computers that you are trying to build the project on.
Register your dll and then try again.

ASP DevExpress libraries undefined after server migration

I'm having trouble migrating the DevExpress elements of an ASP web application from one server to another. I basically copied the files and database over into a new server location and made some adjustments to the web.config file to get it connected to the new database. That got most of the site working and pulling data correctly, but the DevExpress pieces are coming up as undefined.
As far as I can tell, the references in the web.config file and on the respective pages is correct and the dll files themselves are listed in the bin directory so I'm rather stumped as to why they aren't working.
Web.config sample
<compilation debug="true" strict="false" explicit="true">
<assemblies>
...
<add assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
... and so on
Dashboard.aspx sample
...at top of page...
<%# Register Assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
This was an inherited project, so I haven't tried rebuilding the application in case my machine imports my settings into the project (example: it was made in VS 2008, and I'm running VS Community 2015).
Are there any quirks to making a transfer like this that I just don't know about or has anyone else experienced this issue? Any help would be appreciated.
Thanks
The first thing that comes to mind is that version 10.1 of DevExpress is a very old version, released in Aug '10. It does not support .Net 4, so you'll need to make sure the application pool for IIS running this web app is .NET CLR Version 2.0.
Note that if you are running in Windows Server 2012, it's actually tricky to install .Net 3.5. Google how to do it if you need to.
The next to check of course if all of the dll's referenced are in the Bin folder.
Could you write the error message you are getting? If it does not have any extra information, perhaps the event viewer of the server (under windows logs/applications) has a more detailed description.

How do references work in ASP.NET WebForms websites (not web applications)?

I have taken over an old ASP.NET website (as opposed to a web application) and I am having problems getting it to build in our CI environment due to an unresolved reference to the Ajax Control Toolkit.
I see the same error on my local development machine, and can fix it by manually adding a reference to AjaxControlToolkit.dll (the project's NuGet packages.config file references the Ajax Control Toolkit).
However, ASP.NET websites do not have a .csproj file (unlike web applications), so making this change doesn't seems to update any file in the source code tree.
When I build the website in Visual Studio I can see it copying a large number of other dlls into the website's Bin folder. All apart from AjaxControlToolkit.dll...
So my question is basic: How do ASP.NET WebForm websites manage their references?
Asp.Net website has a folder Bin. In this folder all references are placed you just need to copy and paste dll files into Bin folder.
My understanding of the system is that ASP.Net handles references in several different ways:
Referenced projects are stored in the "solution" file typically in the main directory, if you edit the file in notepad you should see references in the following format:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveDirectoryHelper", "..\..\DataAccess\ActiveDirectoryHelper\ActiveDirectoryHelper.csproj", "{D1DDF7A2-6F69-4400-92A7-FD7F4CD87FE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XXX.Library", "..\..\DataAccess\XXXLibrary\XXX.Library.csproj", "{F0A396FA-4588-41E8-B072-7121501689FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\..\DataAccess\Common\Common.csproj", "{F80C48D8-F6AD-43A2-8AB0-7E4A8461D372}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAccess", "..\..\DataAccess\DataAccess\DataAccess.csproj", "{F9AEC8CE-6E04-4848-8168-1436EBA4E734}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAccess.Tests", "..\..\DataAccess\DataAccessTests\DataAccess.Tests.csproj", "{472C68E1-66AA-486D-9B76-BC72254BB0F9}"
Third party "DLL's", these are stored by including a "refresh" file in the "Bin" directory. If your using source control of any type don't forget to check these files in:
(TFS Example)
If you open the "refresh" file you will see something like the following:
Library\AjaxControlToolkit.dll
NuGet I think is a bit more compiled see the details listed here for a strategy on how to approach this.
Standard and third party library's, are also mentioned in the "web.config" file, I assume this is how they are referenced:
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="CustomMarshalers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.VisualC, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
None of this I've ever seen official documentation on, all of it I've derived from my struggles with TFS or Visual Studio over the years, I wish there was something official written up on this that people could reference. Microsoft's official documentation has a tendency to glaze over important details such as these, and when stuff breaks your left playing detective with undocumented low level implementation details...

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

Converting VS2008 Solution to VS2010 Creates compile errors in ASP.NET 3.5 SP1

I am converting a large solution from Visual Studio 2008 to Visual Studio 2010. The conversion completes without errors. When I go to build the solution one particular section of the application throws error but it didn't when the solution was 2008.
Error 1 Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. C:\MyProject\Results\Result.ascx 3
And
C:\CMyProject\Results\Result.ascx(3): Build (web): Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The dll is in the bin and it is not in the GAC. The .refresh file is pointing to the correct location. And all sections in the Web.Config are there, if you need to see them let me know.
I have gone over the fixes I found online and nothing seems to help. I would really appreciate if someone could help me or point me in the right direction?
Thank You.
Try to install Microsoft Chart Controls for Microsoft .NET Framework 3.5. You can find it on http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&DisplayLang=en
That is the charting control, you probably need to get the latest that works with .net 4.0
Some information about it is at:
http://msdn.microsoft.com/en-us/library/ee410579(VS.100).aspx

Resources