Mickeys
asked on
GAC?
I have a assignment that is almost done. I miss this:
The library must be tested in the GAC before submitting.
What the heck is that?????? what is it that I should do???
The library must be tested in the GAC before submitting.
What the heck is that?????? what is it that I should do???
GAC stands for Global Assembly Cache. It is a cache of assemblies accessible to all .NET applications on a machine.
You can read more about it here
http://msdn.microsoft.com/en-us/library/yf1d93sz(VS.71).aspx
and here
http://en.wikipedia.org/wiki/Global_Assembly_Cache
As for your assignment, I think you have to register your assembly in the GAC then create another application to make use of the assembly you registered in the GAC and see if it works.
You can read more about it here
http://msdn.microsoft.com/en-us/library/yf1d93sz(VS.71).aspx
and here
http://en.wikipedia.org/wiki/Global_Assembly_Cache
As for your assignment, I think you have to register your assembly in the GAC then create another application to make use of the assembly you registered in the GAC and see if it works.
ASKER
Ok so let say I wanna use Gacutil.exe. Where do I find it? I have searched the computer but I dont seem to find it.
ASKER
I found GAC. How do I write the command?
C:\Programmer\Microsoft Visual Studio 8\SDK\v2.0 Bin>
gacutil.exe /i :\Temp\UtilitiesLibrary\Ut ilitiesLib rary\bin\D ebug "UtilitiesLibrary.dll"
C:\Programmer\Microsoft Visual Studio 8\SDK\v2.0 Bin>
gacutil.exe /i :\Temp\UtilitiesLibrary\Ut
I think it's more along the lines of
gacutil.exe /i C:\Temp\UtilitiesLibrary\U tilitiesLi brary\bin\ Debug\Util itiesLibra ry.dll
gacutil.exe /i C:\Temp\UtilitiesLibrary\U
ASKER
C:\Programmer\Microsoft Visual Studio 8\SDK\v2.0\Bin>gacutil.exe /i C:\Temp\UtilitiesLibrary\U tilitiesLi brary\bin\ Debug\
UtilitiesLibrary.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: Attempt to install an assembly without a strong name
UtilitiesLibrary.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Failure adding assembly to the cache: Attempt to install an assembly without a strong name
You have to sign your assembly with a strong name before adding it to the GAC.
To do so please refer to this MSDN article:
http://msdn.microsoft.com/en-us/library/xc31ft41(VS.71).aspx
To do so please refer to this MSDN article:
http://msdn.microsoft.com/en-us/library/xc31ft41(VS.71).aspx
ASKER
getting closer but:
module name is the name of the code module used to create the assembly
What the heck is that? Where do I find it?
My projects name is UtilitiesLibrary
al /out:UtilitiesLibrary.dll ?????? /keyfile:sgKey.snk
module name is the name of the code module used to create the assembly
What the heck is that? Where do I find it?
My projects name is UtilitiesLibrary
al /out:UtilitiesLibrary.dll ?????? /keyfile:sgKey.snk
Try using the root namespace of your project for the module name.
If it is the same as your project name you may want to consider changing either the root namespace or the project name.
ASKER
My name space is UtilitiesLibrary
My project is UtilitiesLib
C:\Programmer\Microsoft SDKs\Windows\v6.0A\bin>al /out:UtilitiesLibrary.dll C:\Temp\UtilitiesLibrary /keyfile:sgKey.snk
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: error AL1047: Error importing file 'c:\Temp\UtilitiesLibrary' -- Adgang nægtet.
My project is UtilitiesLib
C:\Programmer\Microsoft SDKs\Windows\v6.0A\bin>al /out:UtilitiesLibrary.dll C:\Temp\UtilitiesLibrary /keyfile:sgKey.snk
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: error AL1047: Error importing file 'c:\Temp\UtilitiesLibrary'
ASKER
Maybe you need to know this. :-)
Adgang Adgang nægtet= Access denied
So what to do? Why denied`?
Adgang Adgang nægtet= Access denied
So what to do? Why denied`?
Replace C:\Temp\UtilitiesLibrary with UtilitiesLibrary and see how that works out. At this point I am also unsure as to what is happening but the second parameter should be the namespace, to the best of my knowledge.
ASKER
C:\Programmer\Microsoft SDKs\Windows\v6.0A\bin>al /out:UtilitiesLibrary.dll UtilitiesLibrary /keyfile:sgKey.snk
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: error AL1047: Error importing file 'c:\Programmer\Microsoft SDKs\Windows\v6.0A\bin\Uti litiesLibr ary' -- The file was not fount
What should this GAC do? I dont understand.
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: error AL1047: Error importing file 'c:\Programmer\Microsoft SDKs\Windows\v6.0A\bin\Uti
What should this GAC do? I dont understand.
Looks like the second parameter is the path to your original DLL. Replace it with the path to your dll file.
ASKER
hehe. sorry.
C:\Programmer\Microsoft SDKs\Windows\v6.0A\bin>al /out:UtilitiesLibrary "C:\Documents and Settings\MFL\Dokumenter\Vi sual
Studio 2008\Projects\UtilitiesLib rary\Utili tiesLibrar y\bin\Debu g\Utilitie sLibrary.d ll" /keyfile:sgKey.snk
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: warning AL1020: Ignoring included assembly 'c:\Documents and Settings\MFL\Dokumenter\Vi sual Studio
2008\Projects\UtilitiesLib rary\Utili tiesLibrar y\bin\Debu g\Utilitie sLibrary.d ll'
ALINK: error AL1016: No valid input files were specified
C:\Programmer\Microsoft SDKs\Windows\v6.0A\bin>al /out:UtilitiesLibrary "C:\Documents and Settings\MFL\Dokumenter\Vi
Studio 2008\Projects\UtilitiesLib
Microsoft (R) Assembly Linker version 9.0.21022.8
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: warning AL1020: Ignoring included assembly 'c:\Documents and Settings\MFL\Dokumenter\Vi
2008\Projects\UtilitiesLib
ALINK: error AL1016: No valid input files were specified
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sn -k IGC.snk
//this creates a file called IGC.snk
I dont know which xxx.cs I should choose in my (I got two xxx.cs files in my project) So this is where I have stopped
C:\WINDOWS\Microsoft.NET\F ramework\v 1.1.4322\c sc -t:module ProjectDoxCrypto.cs
C:\WINDOWS\Microsoft.NET\F ramework\v 1.1.4322\a l ProjectDoxCrypto.netmodule /target:lib /keyfile:IGC.snk /out:ProjectDoxCrypto.dll
%windir%\Microsoft.NET\Fra mework\v1. 1.4322\Reg Asm.exe .\ProjectDoxCrypto.dll /tlb:ProjectDoxCrypto.tlb
%windir%\Microsoft.NET\Fra mework\v1. 1.4322\gac util /i .\ProjectDoxCrypto.dll
Open your AssemblyInfo.cs file and insert the following:
[assembly: AssemblyKeyFile(@"pathtosn kfile\IGC. snk")]
pathtosnkfile should be the absolute path to the snk file (ex. c:\project files\my project).
Build your project and go to the directory where the DLL is located (bin\release).
At the command prompt issue the command gacutil /i ProjecDoxCrypto.dll
The only think that you should be award of is that you might want to adjust your AssemblyVersion until you finallize your code. Otherwise the build number will continue to increment and you'll have to uninstall/install the assembly in the GAC.
This can be done by openning your AssemblyInfo.cs file and changing this line:
[assembly: AssemblyVersion("1.0.0")]
//this creates a file called IGC.snk
I dont know which xxx.cs I should choose in my (I got two xxx.cs files in my project) So this is where I have stopped
C:\WINDOWS\Microsoft.NET\F
C:\WINDOWS\Microsoft.NET\F
%windir%\Microsoft.NET\Fra
%windir%\Microsoft.NET\Fra
Open your AssemblyInfo.cs file and insert the following:
[assembly: AssemblyKeyFile(@"pathtosn
pathtosnkfile should be the absolute path to the snk file (ex. c:\project files\my project).
Build your project and go to the directory where the DLL is located (bin\release).
At the command prompt issue the command gacutil /i ProjecDoxCrypto.dll
The only think that you should be award of is that you might want to adjust your AssemblyVersion until you finallize your code. Otherwise the build number will continue to increment and you'll have to uninstall/install the assembly in the GAC.
This can be done by openning your AssemblyInfo.cs file and changing this line:
[assembly: AssemblyVersion("1.0.0")]
I'm not sure this will work but try using wildcards for the source files, e.g. *.cs or C:\Temp\UtilitiesLibrary\* .cs
This is new territory for me as well by now...
This is new territory for me as well by now...
It is the system-wide registry or cache for .NET assemblies (or libraries).
You can install / manage with gacutil