I dont have gacutil on the computer I have to install this assembly so can it be done instead of using gacutil?
If yes, whats the difference?
Its a .net 2.0 assembly
You can drag and drop assemblies onto the \Windows\Assembly folder in Explorer, and the assemblies will be deployed there automatically. There is no difference between the result of this method and using gacutil.
To verify before the act, a shell extension must have been installed with the .NET Framework that displays a different view of this folder when you navigate there, so you should actually see assemblies with version data etc. instead of the standard columns (in detail view).
If you dont want to use gacutil then you should create your own utility and use install the assembly by using Publish.GacInstall Method.
public void GacInstall(string AssemblyPath)
Drage and drop dll ... it might not work if gacutil isn't there as a special Windows Explorer plugin calls gacutil to install your assembly into GAC. For details please have a look on GAC - To add an assembly to the GAC, drag and drop works, but copy and paste doesn't? Why?
Related
I would like to have a smooth and efficient installation of the solution, but what I "inherited" is very far from that, and the guy who programmed most of it has left the company.
At present I am trying to install it on a test-server, and not all the dll's land in the correct places after the installation.
Firstly, if I use log4net in a project, then I need the log4net.dll in the folder after the installation (I guess). How do I get the log4net.dll to be copied with the project dll?
Secondly, Project A expects Project C's dll to be in the GAC or so it seems when I debug in Visual Studio and check where the modules are loaded from.
I also see that this is entered in the post build event commandline of Project A:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\GacUtil.exe" -i "$(TargetPath)"
copy "$(TargetPath)" "C:\Program Files\MySolution\bin"
So how do I get Project C's dll into the GAC by way of the installation? I get an error on the Test Server because it can't load C.dll.
UPDATE WITH MORE DETAIL
After the solution has been installed with Windows Installer, a few folders are created in the parent folder such as Apps, bin, Engines, Service etc.
In the Apps folder, I have A.exe, which is looking for C.dll. However, C.dll lands up in the bin folder. As mentioned above, during execution of A.exe, it actually loads the modules of C.dll from the GAC (and on my laptop, those files are in the GAC because of the post-build event command line specified in the properties of Project C, but not in the GAC of the Test Server to which I am trying to install this solution).
So yes, I assume I could run something like this:
gacutil -i C.dll
after the installation, but it doesn't seem right.
There are two parts to your question relating to the GAC, and ensuring DLLs are copied.
GAC
Check out this link (https://msdn.microsoft.com/en-us/library/dkkx7f79%28v=vs.110%29.aspx) from MSDN on how to install into the GAC. The key thing is it must be strongly named or it will fail.
DDLs
Depending on how you are referencing Log4Net, there are a few ways to do this.
If you can add a reference in your project, make sure the property CopyLocal is set to true
If you just have the file locally, you can add it to a sub folder of your project with a symbolic link (https://support.microsoft.com/en-us/kb/306234), and then set the CopyToOutputDirectory property.
Hopefully these help you along.
I found what I was looking for!
Select the Setup project, then go to the menu "View" -> Editor -> File System.
It seems you can specify where the dlls must go, and what should be copied to the GAC during installation.
Say I have a Visual Studio Project that references a libary XYZ.dll. I am not able to distribute that dll but I know that many people have a license for it.
What can I do to connect my project to XYZ.dll on the target computer? To be more precise, I want to do the following things:
Reference XYZ.dll in a project in Visual Studio.
Distribute a compiled version of the solution/project without XYZ.dll
Let the customer, who installs my program, link the program to his copy of XYZ.dll so that the program can use it.
(This may be an easy question, but I was not able to find the answer, maybe due to wrong search terms).
If the XYZ.dll is installed with a third-party product, you may check whether it is registered in GAC.
If so, then you - in your VS project - reference the XYZ.dll pointing to it in GAC and then setting the copy local to false, so that it will not be copied to your program's bin directory and used from there.
It becomes more problematic in case the dll is not in GAC - in such case you would need to ask user for the assebly's location (or read it from registry if you know what product to search for) and then resolve this assembly dynamiccaly using that path with the use of AssemblyResolve event (https://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve%28v=vs.110%29.aspx)
There is also a way in which you create a "proxy" class in your project that loads the third-party assembly dynamiccaly from the path on the customer's computer, and then create a set of proxy methods that would call loaded third -party assembly using reflection.
I have a bit of a conundrum with MEF.
I have an installer and configuration application shell which uses MEF to load individual installer components. This gives an end user the ability to select from whatever components have been placed into the install distributable.
The first install components which were written to use this used version 11 of SQLServer SMO libraries. Installing against either 2008R2 or 2012 works fine. (lets call this component A)
I have another team migrating code to a new component but that code uses version 10 of the SQLServer SMO, RMO, and SSIS (DTS) libraries. (lets call this component B)
When MEF goes to load component B I get a LoaderExceptionFailure for one of the SQLServer DLLs (Microsoft.SqlServer.Replication). It actually gives a FileNotFoundException (listing the DLL). The DLL exists in the component's directory. It is the correct version 10.
The shell application already has version 11 files in it.
Is there a way I can tell the application context what to do? Is there a way I can tell the component to load any specific libraries it needs?
I want to assume that each component can specify something "Associated.Library, Version=1.0.0.0, publickey=abcdef123456789, culture=none".
The reason the CLR (not MEF) cannot find the assembly is because it is neither in the GAC, not in the places were the current AppDomain is setup to probe for assemblies.
One way to deal with this kind of problem is to add the missing assembly to the GAC.
Another approach is to add the folder containing the missing assembly to the probing paths of your application. If you don't mind deploying these assemblies in the application base folder (the one containing your executable) then do so. Otherwise you can add deploy it in a sub folder of your application base folder and add the folder to the privatePath element of your app.config.
You will find more information on the article: How the Runtime Locates Assemblies.
I'm using Visual Studio's standard setup. During my solution build process, a DLL is modified and re-signed. I want the modified DLL to be copied to a setup that is also in the same solution so that it is installed on the target machine. The DLL should end up in the target machine's GAC.
Is there any way to do this in one build process? The DLL is modified each build.
To deploy an assembly to the target computer GAC with Web Setup project, we can drag the assemblies to Global Assembly Cache Folder(Right-click File System on Target Machine, click Add Special Folder, and then click Global Assembly Cache Folder). For more information, see http://support.microsoft.com/kb/324168
We also can try to run some scripts to register assemblies through the Gacutil Tool (http://support.microsoft.com/kb/315682) on target machine in Custom Action of Setup Project.
For the Custom Action example, see http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx
Make the install do two components using the same file.
One as a global assembly, and one as a private assembly.
These links should be helpful:
http://blogs.msdn.com/b/astebner/archive/2005/06/24/432521.aspx
And
http://msitekkie.wordpress.com/2011/02/03/installing-net-assemblies/
Hope that helps
I've registered a dll in my local GAC using the GACUtil which comes with VS2010 (version 4ish)
I can perform gacutil /l xxx and it finds the dll
I am aware from various other posts that Framework 4 has it's own GAC and sure enough the file can be located in the directories within C:\WINDOWS\Microsoft.NET\assembly
The problem for me, is that the .NET tab on the Add Reference dialogbox does not show my "GAC'ed" assembly.
I've made sure that the projects properties are using the same version of the 4.0 framework, but I am currently at a loss.
Has anyone else had this problem?
Cheers in advance
The "Add Reference" window does not list assemblies in the GAC. Visual Studio keeps it's own list of paths to search for assemblies to list in that window. See here for instructions on how to make your assembly show up in that list, specifically under the heading "To display an assembly in the Add Reference dialog box"
Just as an alternative...
A more manual way of adding the dlls via the web.config is possible.
using the assemblies node
http://msdn.microsoft.com/en-us/library/bfyb45k1.aspx
any information you may need can be found by using the gacutil /l <name of assembly>