I am somewhat new to using the Global Assembly Cache in .NET, and have a question regarding how it works since I haven't been able to find anything online.
My msi(created using Visual Studio Installer extension (using Visual Studio 2015)) installs a number of assemblies into the GAC and my application(the assemblies need to be in the GAC because 3rd party application need to access them too). After running the installer and starting the application, I noticed that when I start my application, copies of the dlls from the GAC are made in the application execution directory.
My question is, is this how using assemblies from GAC normally works? I assumed that the assemblies would just be loaded from the GAC without making local copies. Or is this some error on my part and how I built my application(CopyLocal is set to true but from what I understand, this only matters for Visual Studio and has no effect on actual execution after deployment).
Based on Hans' input, the issue is with my msi and is not GAC related. While msi installs the assemblies to GAC and not the execution directory, when the application is run it is msi "self-healing" that creates the files, they are not copied from GAC.
I am using Visual Studio and Windows environment.
The situation is like this:
On the first environment "A" I am building the application.
In bin directory of that project I have my own dll.
Same dll, but different version (old version with an error in code) I have in GAC of this environment.
So running this application on that environment would produce an error because my application would use this dll from GAC, so old dll, bugged version.
The question is what would be if I build this application on the first environment "A" (with wrong dll in GAC) and test this application on the second environment "B" where there is no dll in GAC.
Would Visual Studio take dll from GAC or from dll while building the project ?
If the question is not clear please ask the question.
Regards
I have this dll (Microsoft.web.Infrastructure.dll) in many project's package.config of my solution. There are no build errors and the dll is getting downloaded to Solution's packages folder.
I am getting runtime error on missing dll on each of the project the application hits. When I look at the individual project bin folder, I don't see this dll copied. However as I mentioned earlier the dll is downloaded to packages folder of solution.
Temporary Solution -
Manually copy this dll to all individual project bin
Place this dll in GAC
This problem is only on my machine and not on any other colleague's machine. Surprisingly some of them have this dll copied into project folder while some of them don't. It works for them without this dll in GAC and without any manual effort, a clean rebuild did everything for them.
I have a short term fix but I am more curious to know how it working on other machines and what I am missing.
Things that I have tried so far -
Clean Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root....
Clean solution and close reopen solution and finally Rebuild solution
Visual studio 2015 doesn't have clear nuget cache as compared to visual studio 2013.
FYI - I have Visual Studio 2015 and all other machines are on 2013, if not something else this is where I am looking at now.
Any help is appreciated.
Please check whether the Microsoft.web.Infrastructure.dll is exist in the Project References. If not, please try Win’s suggestion to reinstall your package in the Package Manager Console by following command:
Update-Package –reinstall Microsoft.Web.Infrastructure
Because the NuGet Restore only restores packages based on the package.config file to the packages directory, but does not add the reference to your project by default. So we need to force reinstall the package to add references and content files into project.
If the dll is already existed in your Project References, you need to check the property value of “Copy Local”. The Copy Local property determines whether a reference is copied to the local bin path. The CopyLocal=True should be set if the reference want to be copied to bin folder. See Set the Copy Local Property for more detail.
I found that my team used to have dll's in the bin folder but wasn't checked in, but the project file still had references pointing to those deleted dll's. What happened was I still had those dll's in my bin while nobody else did, and those dll's depended on microsoft.web.infrastructure existing, so I was the only one getting that error.
For me, those dll's (references) were:
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
So instead of modifying references in the the project file (It'll be on a different check in), I just deleted those dll's in my bin, and no more dependencies on microsoft.web.infrastructure.
I recently upgraded my n-tier solution from .NET 3.5 vs 2008 to 4.5 visual studio 2012. Every thing went fine apart from crystal reports and I had to install new runtime crystal reports for visual studio 2012 from the following link http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_5.exe.
After installing the above package I had to resolve some deprecated function and properties of
CrystalViewer and after that reports rendering properly in development environment (Windows 7 64 bit, SQL Server 2005, Visual Studio 2012). When I deployed the package in test environment windows server 2008 R2
the Application failed to load by throwing error
Could not load file or assembly Microsoft.ReportViewer.WebForms, Version=11
I managed to resolve ReportViewer.WebForms error by copying the DLL
from C:\Program Files (x86)\Microsoft Visual Studio 11.0\ReportViewer to bin folder of solution and set property copylocal = true and deployed the package. After that I received the error Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0 . I tried to search that DLL on my machine but couldn't. when project is running in visual studio, In Debug-> Windows->Module the file is not listed however in global assembly cache that file is installed but I don't know how its installed to global cache and from where . I found one solution that I had to install ReportViewer.msi from microsoft package but if i install this package it asks me to install SQL Server 2012 which I dont wan't. Could any one help me to resolve this issue. Thanks
Dont know if this is good to anyone, but search all these dlls:
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WinForms.dll
Microsoft.ReportViewer.DataVisualization.dll
You find them in C:\Windows\assembly\GAC_MSIL\..., and then put them in the references of your project.
For each of them say: local copy, and check for 32 or 64 bit solution.
You can install the Microsoft Report Viewer 2012 Runtime and change your references so they point to the ones installed by the runtime.
http://www.microsoft.com/en-gb/download/details.aspx?id=35747
I have installed the runtime without it asking for SQL Server 2012. Before installing try uninstalling any previous versions of report viewer.
As Microsoft.ReportViewer.2012.Runtime has Microsoft.ReportViewer.WebForms, Microsoft.ReportViewer.Common and Microsoft.ReportViewer.ProcessingObjectModel libraries, just run this command on PM Console:
Install-Package Microsoft.ReportViewer.2012.Runtime
Note : If you want to completely remove the old Microsoft.ReportViewer.xxx references, you can remove them from Manage NuGet Packages>Installed Packages menu and then remove the related lines from packages.config file in your project. After that it will not comeback again during building of the project.
Could not load file or assembly 'Microsoft.ReportViewer.Webforms'
or
Could not load file or assembly 'Microsoft.ReportViewer.Common'
This issue occured for me in Visual studio 2015.
Reason:
the reference for Microsoft.ReportViewer.Webforms dll is missing.
Possible Fix
Step1:
To add "Microsoft.ReportViewer.Webforms.dll" to the solution.
Navigate to Nuget Package Manager Console as
"Tools-->NugetPackageManager-->Package Manager Console".
Then enter the following command in console as below
PM>Install-Package Microsoft.ReportViewer.Runtime.WebForms
Then it will install the Reportviewer.webforms dll in "..\packages\Microsoft.ReportViewer.Runtime.WebForms.12.0.2402.15\lib" (Your project folder path)
and ReportViewer.Runtime.Common dll in "..\packages\Microsoft.ReportViewer.Runtime.Common.12.0.2402.15\lib". (Your project folder path)
Step2:-
Remove the existing reference of "Microsoft.ReportViewer.WebForms".
we need to refer these dll files in our Solution as "Right click Solution >References-->Add reference-->browse ".
Add both the dll files from the above paths.
Step3:
Change the web.Config File to point out to Visual Studio 2015.
comment out both the Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.Common version 11.0.0.0 and Uncomment both the Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.Common Version=12.0.0.0. as attached in screenshot.
Microsoft.ReportViewer.Webforms/Microsoft.ReportViewer.Common
Also refer the link below.
Could not load file or assembly 'Microsoft.ReportViewer.WebForms'
You can download the nuget package too.
I had the same problem for Winforms.
The solution for me is:
Install-Package Microsoft.ReportViewer.Runtime.Winforms
Simply install Microsot.ReportViewer.2012.Runtime nuget package as shown in this answer https://stackoverflow.com/a/33014040/2198830
Add Microsot.ReportViewer 2010 or 2012 in prerequisite of setup project then it first install Report Viewer if it's not present in "C:\Windows\assembly\GAC_MSIL..." and after installing, it installs set up project
In my case, the 'Microsoft.ReportViewer.Common.dll' assembly is not required for my project, so I simply removed all references (Project -> Add Reference... -> ...) (all requirements from Publish tab the VS2013 removed automatically) and all works properly.
I Had the same problem.
The solution for me is:
You must have the same version of: Microsoft.ReportViewer.ProcessingObjectModel registred in C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel,
like you have registraded in web.config in developer server:
In my case i was only registred the 13. version in my prodution server and i have the 12. version in developer server.
the solution is install the version 12. in the prodution server too
the version 12. :
https://download.microsoft.com/download/A/1/2/A129F694-233C-4C7C-860F-F73139CF2E01/ENU/x86/ReportViewer.msi
Then now i have the version 12. in the prodution and the report work fine.
*** Remember to reset your IIS after instalation
I resolved this problem, searching the dll's file in C:\Windows\assembly\GAC_MSIL\ and copied to bin directory of the proyect deployed. That work for me.
Although rather late, but you can manually download the required DLLs from nuget at the following link:
https://www.nuget.org/packages/Microsoft.ReportViewer.Runtime.Common/12.0.2402.15
Open the file .Rar Archive, extract the dlls and copy them manually to the bin folder of your publish.
This solution worked for me. Hope that helps !!
I solve it by download the reportviewer.exe and install it.
After the installation, all related assemblies will be available in C:\Windows\assembly\GAC_MSIL, then you can refer it in web config
This is my first time trying to use a dll file in visual studio (2012) so I am not sure what I am doing wrong. I am trying to get sqlite into my project following this tutorial
I right click on the project in the Solution Explorer and click Add References
I then click on the browse tab and find where I have the dll file,click ok then ok in visual studio and I get an error saying Reference to *dll path* could not be added. Please make sure the file is accessible and that is it a valid assembly or COM component.
did I miss a step here or something?
The file is located in my dropbox folder (where my whole project is) and the project is a windows store application is that matters
Not a direct answer but instead of referencing the dll directly, you should install the Visual Studio extension for SQLite. The extension includes the dlls for all platforms (x86, x64, ARM). It also makes sure that the right dll is used for the platform that you are building for.
After you install the extension, it will appear in the references dialog under Windows -> Extensions. Also, when you use the extension, you must change all your project build configurations to be x86 or x64 (on the desktop) or Arm (for Arm devices). It will fail to build if you use AnyCPU.