473,582 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET and shared assemblies

Hi,
We developed some assemblies which use EnterpriseServi ces queued components.
In order to use EnterpriseServi ces, these assemblies need to be installed
into GAC. I used the pre-build and post-build events to automate GAC
installation processes and the asp.net application has "copy to local" set
to false for the references of these shared assemblies.

However, every time we made the changes to the shared assemblies, we had to
restart the IIS in order to force the asp.net to use the new version of the
shared assemblies. If we did not restart the IIS, the asp.net will continue
to use the older version of the shared assemblies. I believe the reason of
recycling the IIS is actually to recycle the AppDomain so the ASP.NET will
bind to the most recent version of the shared assemblies. I know by changing
the web.config will recycle the AppDomain too, but since the web.config is
bound to the SourceSafe, by default it is read-only, and we don't want to
modify it for every changes made to the shared assemblies.

I believe this is a very common issue for ASP.NET development using shared
assemblies. There must be a better setup for this kind of the development.
Any helps will be appreciated

ILN
Nov 18 '05 #1
9 4170
Hello,

How did you add the reference to the web application? Based on my test, the
web application will try to find the latest version of the referenced
assembly. (I added the reference by browsing to the classlibrary file and
set "copy local" to false.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
Luke,
The referenced projects, shared assemblies, are in the same solution as
asp.net project. The references were added from Add Reference dialog box >
Projects tab. The "copy local" was set to "false" for the references to the
shared assemblies and to "true" for the references to private assemblies.

the followings are the project file fragment of the shared assembly
(Xyz.Common)
<VisualStudioPr oject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Xyz.Common "
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Grid"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = '"C:\Program Files\Microsoft Visual Studio
..NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /uf "$(TargetPath)" '
PostBuildEvent = '"C:\Program Files\Microsoft Visual Studio
..NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /if "$(TargetPath)" '
RootNamespace = "Xyz.Common "
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = "" <Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\ "
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Releas e\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l
"
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.XML.dll "
/>
<Reference
Name = "Microsoft.Appl icationBlocks.E xceptionManagem ent"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Web.dll "
/>
<Reference
Name = "System.Securit y"
AssemblyName = "System.Securit y"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Securit y
..dll"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Web.Ser v
ices.dll"
/>
</References>
</Build>

The followings are the project file fragment of the asp.net web application

<VisualStudioPr oject>
<CSHARP
ProjectType = "Web"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{B92F596B-4F30-4FC2-9F84-5AD62B56C0DA}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK" <Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Subscriber s"
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Flow"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Xyz.Web.Subscr ibers"
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = "" <Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.dll"
/>
<Reference
Name = "System.Drawing "
AssemblyName = "System.Drawing "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Drawing.dl l
"
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Data.dll"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.dll"
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.XML.dll"
/>
<Reference
Name = "Xyz.Common "
Project = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.E xceptionManagem ent"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.Servic e
s.dll"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Xyz.DAL"
Project = "{6559D88E-6265-4424-AC2D-8E4BC4462361}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Accoun ts"
Project = "{FAE55257-8189-49CC-8421-AE34C85300BF}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Async"
Project = "{E6D51F3B-F4A7-4A25-BAC1-6013EF66C4B4}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
</References>
</Build>

We used queued components for asynchronous processes. If the

ILN

"MSFT" <lu******@onlin e.microsoft.com > wrote in message
news:0C******** ******@cpmsftng xa06.phx.gbl... Hello,

How did you add the reference to the web application? Based on my test, the web application will try to find the latest version of the referenced
assembly. (I added the reference by browsing to the classlibrary file and
set "copy local" to false.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3
BTW
from this article
http://www.aspalliance.com/226
the asp.net will not look for the latest version from GAC, and this is what
I have experienced.

ILN

"Invalidlastnam e" <in************ *@toomanyvalida tions.page> wrote in message
news:ut******** ******@tk2msftn gp13.phx.gbl...
Luke,
The referenced projects, shared assemblies, are in the same solution as
asp.net project. The references were added from Add Reference dialog box >
Projects tab. The "copy local" was set to "false" for the references to the shared assemblies and to "true" for the references to private assemblies.

the followings are the project file fragment of the shared assembly
(Xyz.Common)
<VisualStudioPr oject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
> <Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Xyz.Common "
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Grid"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = '"C:\Program Files\Microsoft Visual Studio
.NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /uf "$(TargetPath)" '
PostBuildEvent = '"C:\Program Files\Microsoft Visual

Studio .NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /if "$(TargetPath)" '
RootNamespace = "Xyz.Common "
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
> <Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\ "
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Releas e\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =

"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l "
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.XML.dll " />
<Reference
Name = "Microsoft.Appl icationBlocks.E xceptionManagem ent" Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Web.dll " />
<Reference
Name = "System.Securit y"
AssemblyName = "System.Securit y"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Securit y .dll"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Web.Ser v ices.dll"
/>
</References>
</Build>

The followings are the project file fragment of the asp.net web application
<VisualStudioPr oject>
<CSHARP
ProjectType = "Web"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{B92F596B-4F30-4FC2-9F84-5AD62B56C0DA}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
> <Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Subscriber s"
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Flow"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Xyz.Web.Subscr ibers"
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
>

<Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.dll"
/>
<Reference
Name = "System.Drawing "
AssemblyName = "System.Drawing "
HintPath =

"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Drawing.dl l "
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Data.dll"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.dll"
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.XML.dll"
/>
<Reference
Name = "Xyz.Common "
Project = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.E xceptionManagem ent" Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.Servic e s.dll"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Xyz.DAL"
Project = "{6559D88E-6265-4424-AC2D-8E4BC4462361}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Accoun ts"
Project = "{FAE55257-8189-49CC-8421-AE34C85300BF}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Async"
Project = "{E6D51F3B-F4A7-4A25-BAC1-6013EF66C4B4}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
</References>
</Build>

We used queued components for asynchronous processes. If the

ILN

"MSFT" <lu******@onlin e.microsoft.com > wrote in message
news:0C******** ******@cpmsftng xa06.phx.gbl...
Hello,

How did you add the reference to the web application? Based on my test,

the
web application will try to find the latest version of the referenced
assembly. (I added the reference by browsing to the classlibrary file and set "copy local" to false.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 18 '05 #4
ILN,

That article is not entirely accurate. As long as you don't make a change
that causes the assembly hash value to change, you can update a new version
of the assembly in the GAC and the ASP.NET application will automatically
use the new version without changing anything. (It should be noted that
you do still have to reload the app domain.)

What changes the hash value? If you change the assembly name, the major or
minor version, the public key token, or the culture, the hash value will
change. As long as you don't modify any one of these, you would use the
following procedure to update the assembly in the GAC.

1. Run sn to create a new verification entry for the new version. Do that
as
follows:

sn -Vr <assembly>

2. Run Gacutil to reinstall the assembly as follows:

gacutil /nologo /if <assembly>

Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your
application will use the new assembly.

If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases where
you can't redirect the assembly binding in a configuration file is to use a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.

Here is an example of doing this. In this example, my assembly is called
jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.

1. Change code in version 1.0.0.0 of the assembly.

2. Change version number in assemblyinfo.cs to reflect new version.

3. Rebuild assembly.

4. Create publisher policy file in any text editor. You will need to
replace "<public_ke y>" with the public key for your version 1.0 assembly.

<configuratio n>
<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<dependentAssem bly>
<assemblyIdenti ty name="jcGAC"
publicKeyToken= "<public_ke y>"
culture="neutra l" />
<bindingRedirec t oldVersion="1.0 .0.0"
newVersion="2.0 .0.0"/>
</dependentAssemb ly>
</assemblyBinding >
</runtime>
</configuration>

5. Use al to create the publisher policy assembly. The publisher policy
assembly MUST have the following file format:
policy.major_ve r.minor_ver.ass embly.dll

The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is
an example of the command entered to create the publisher policy assembly
for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.

al /link:pub.config /out:policy.1.0. jcGAC.dll /keyfile:jcgac.s nk
6. Install publisher policy assembly into the GAC.

gacutil /i policy.2.0.jcGA C.dll

7. Install version 2.0.0.0 of your assembly into the GAC.

gacutil /i jcGAC.dll

8. Restart the app domains by either saving a change to the machine.config
or by resetting IIS.

9. Run the ASP.NET app.

After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps
explain a bit.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>Subject: Re: ASP.NET and shared assemblies
Date: Tue, 2 Dec 2003 11:09:34 -0500
Lines: 349
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <ec************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path: cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 .
phx.gblXref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1944 84
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

BTW
from this article
http://www.aspalliance.com/226
the asp.net will not look for the latest version from GAC, and this is what
I have experienced.

ILN

"Invalidlastna me" <in************ *@toomanyvalida tions.page> wrote in messagenews:ut******* *******@tk2msft ngp13.phx.gbl.. .
Luke,
The referenced projects, shared assemblies, are in the same solution as
asp.net project. The references were added from Add Reference dialog box

Projects tab. The "copy local" was set to "false" for the references to

the
shared assemblies and to "true" for the references to private assemblies.

the followings are the project file fragment of the shared assembly
(Xyz.Common)
<VisualStudioPr oject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>

<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Xyz.Common "
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Grid"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = '"C:\Program Files\Microsoft Visual Studio
.NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /uf "$(TargetPath)" '
PostBuildEvent = '"C:\Program Files\Microsoft Visual

Studio
.NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /if "$(TargetPath)" '
RootNamespace = "Xyz.Common "
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
>

<Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\ "
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Releas e\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll"
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Data.d l

l
"
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.XML.dl l

"
/>
<Reference
Name =

"Microsoft.App licationBlocks. ExceptionManage ment"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Web.dl l

"
/>
<Reference
Name = "System.Securit y"
AssemblyName = "System.Securit y"
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Securi t

y
.dll"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Web.Se r

v
ices.dll"
/>
</References>
</Build>

The followings are the project file fragment of the asp.net web

application

<VisualStudioPr oject>
<CSHARP
ProjectType = "Web"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{B92F596B-4F30-4FC2-9F84-5AD62B56C0DA}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>

<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Subscriber s"
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Flow"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Xyz.Web.Subscr ibers"
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
>

<Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.dll"
/>
<Reference
Name = "System.Drawing "
AssemblyName = "System.Drawing "
HintPath =

"..\..\..\..\. .\WINDOWS\Micro soft.NET\Framew ork\v1.1.4322\S ystem.Drawing.d l

l
"
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Data.dll" />
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.dll"
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.XML.dll"
/>
<Reference
Name = "Xyz.Common "
Project = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =

"Microsoft.App licationBlocks. ExceptionManage ment"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =

"..\..\..\..\. .\WINDOWS\Micro soft.NET\Framew ork\v1.1.4322\S ystem.Web.Servi c

e
s.dll"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Xyz.DAL"
Project = "{6559D88E-6265-4424-AC2D-8E4BC4462361}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Accoun ts"
Project = "{FAE55257-8189-49CC-8421-AE34C85300BF}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Async"
Project = "{E6D51F3B-F4A7-4A25-BAC1-6013EF66C4B4}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
</References>
</Build>

We used queued components for asynchronous processes. If the

ILN

"MSFT" <lu******@onlin e.microsoft.com > wrote in message
news:0C******** ******@cpmsftng xa06.phx.gbl...
> Hello,
>
> How did you add the reference to the web application? Based on my test,

the
> web application will try to find the latest version of the referenced
> assembly. (I added the reference by browsing to the classlibrary file

and > set "copy local" to false.
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>




Nov 18 '05 #5
Hi Jim,
Greatly thanks for the excellent details you provided. However, back to my
original question about how to setup the ASP.NET development environment for
using shared assemblies. Please correct me if I am wrong, it seems to me
that we need to add a post-build event to restart the IIS, or "touch" the
web.config for every changes made to the shared assembly projects ( in order
to reload the AppDomain).

I believe developers would appreciate if Microsoft can provide some
guidelines for developing ASP.NET applications with shared assemblies
scenarios. Actually the only reason we need to have shared assemblies is we
are using queued components from EnterpriseServi ce namespace.

ILN

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:Z$******** ******@cpmsftng xa06.phx.gbl...
ILN,

That article is not entirely accurate. As long as you don't make a change
that causes the assembly hash value to change, you can update a new version of the assembly in the GAC and the ASP.NET application will automatically
use the new version without changing anything. (It should be noted that
you do still have to reload the app domain.)

What changes the hash value? If you change the assembly name, the major or minor version, the public key token, or the culture, the hash value will
change. As long as you don't modify any one of these, you would use the
following procedure to update the assembly in the GAC.

1. Run sn to create a new verification entry for the new version. Do that as
follows:

sn -Vr <assembly>

2. Run Gacutil to reinstall the assembly as follows:

gacutil /nologo /if <assembly>

Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your
application will use the new assembly.

If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases where you can't redirect the assembly binding in a configuration file is to use a publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.

Here is an example of doing this. In this example, my assembly is called
jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.

1. Change code in version 1.0.0.0 of the assembly.

2. Change version number in assemblyinfo.cs to reflect new version.

3. Rebuild assembly.

4. Create publisher policy file in any text editor. You will need to
replace "<public_ke y>" with the public key for your version 1.0 assembly.

<configuratio n>
<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<dependentAssem bly>
<assemblyIdenti ty name="jcGAC"
publicKeyToken= "<public_ke y>"
culture="neutra l" />
<bindingRedirec t oldVersion="1.0 .0.0"
newVersion="2.0 .0.0"/>
</dependentAssemb ly>
</assemblyBinding >
</runtime>
</configuration>

5. Use al to create the publisher policy assembly. The publisher policy
assembly MUST have the following file format:
policy.major_ve r.minor_ver.ass embly.dll

The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is
an example of the command entered to create the publisher policy assembly
for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.

al /link:pub.config /out:policy.1.0. jcGAC.dll /keyfile:jcgac.s nk
6. Install publisher policy assembly into the GAC.

gacutil /i policy.2.0.jcGA C.dll

7. Install version 2.0.0.0 of your assembly into the GAC.

gacutil /i jcGAC.dll

8. Restart the app domains by either saving a change to the machine.config or by resetting IIS.

9. Run the ASP.NET app.

After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps
explain a bit.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
Subject: Re: ASP.NET and shared assemblies
Date: Tue, 2 Dec 2003 11:09:34 -0500
Lines: 349
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <ec************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path:

cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 . phx.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1944 84
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

BTW
from this article
http://www.aspalliance.com/226
the asp.net will not look for the latest version from GAC, and this is whatI have experienced.

ILN

"Invalidlastna me" <in************ *@toomanyvalida tions.page> wrote in

message
news:ut******* *******@tk2msft ngp13.phx.gbl.. .
Luke,
The referenced projects, shared assemblies, are in the same solution as
asp.net project. The references were added from Add Reference dialog box
Projects tab. The "copy local" was set to "false" for the references to

the
shared assemblies and to "true" for the references to private

assemblies.
the followings are the project file fragment of the shared assembly
(Xyz.Common)
<VisualStudioPr oject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Xyz.Common "
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Grid"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = '"C:\Program Files\Microsoft Visual

Studio .NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /uf "$(TargetPath)" '
PostBuildEvent = '"C:\Program Files\Microsoft Visual

Studio
.NET 2003\SDK\v1.1\B in\gacutil.exe" /nologo /if "$(TargetPath)" '
RootNamespace = "Xyz.Common "
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\ "
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Releas e\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \..\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll" />
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =

"..\..\..\..\. .\.\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl
l "
/>
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.XML.dl l
" />
<Reference
Name =

"Microsoft.App licationBlocks. ExceptionManage ment"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Web.dl l
" />
<Reference
Name = "System.Securit y"
AssemblyName = "System.Securit y"
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Securi t
y .dll"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =

"..\..\..\..\. .\..\WINDOWS\Mi crosoft.NET\Fra mework\v1.1.432 2\System.Web.Se r
v ices.dll"
/>
</References>
</Build>

The followings are the project file fragment of the asp.net web

application

<VisualStudioPr oject>
<CSHARP
ProjectType = "Web"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{B92F596B-4F30-4FC2-9F84-5AD62B56C0DA}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyCont ainerName = ""
AssemblyName = "Subscriber s"
AssemblyOrigina torKeyFile = ""
DefaultClientSc ript = "JScript"
DefaultHTMLPage Layout = "Flow"
DefaultTargetSc hema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Xyz.Web.Subscr ibers"
RunPostBuildEve nt = "OnBuildSuccess "
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "DEBUG;TRAC E"
DocumentationFi le = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBloc ks = "false"
BaseAddress = "285212672"
CheckForOverflo wUnderflow = "false"
ConfigurationOv errideFile = ""
DefineConstants = "TRACE"
DocumentationFi le = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuil d = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\"
RegisterForComI nterop = "false"
RemoveIntegerCh ecks = "false"
TreatWarningsAs Errors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.dll"
/>
<Reference
Name = "System.Drawing "
AssemblyName = "System.Drawing "
HintPath =

"..\..\..\..\. .\WINDOWS\Micro soft.NET\Framew ork\v1.1.4322\S ystem.Drawing.d l
l "
/>
<Reference
Name = "System.Dat a"
AssemblyName = "System.Dat a"
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Data.dll" />
<Reference
Name = "System.Web "
AssemblyName = "System.Web "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.Web.dll" />
<Reference
Name = "System.XML "
AssemblyName = "System.Xml "
HintPath =
"..\..\..\..\.. \WINDOWS\Micros oft.NET\Framewo rk\v1.1.4322\Sy stem.XML.dll" />
<Reference
Name = "Xyz.Common "
Project = "{90AB26A7-505B-4E2F-9B80-0B910AFD215F}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =

"Microsoft.App licationBlocks. ExceptionManage ment"
Project = "{386CBF50-F4A9-4F05-98CB-B387D2D8F357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name =
"Microsoft.Appl icationBlocks.E xceptionManagem ent.Interfaces"
Project = "{5F25F8C2-DA02-46C6-A6CA-01E719EAD35D}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "System.Web.Ser vices"
AssemblyName = "System.Web.Ser vices"
HintPath =

"..\..\..\..\. .\WINDOWS\Micro soft.NET\Framew ork\v1.1.4322\S ystem.Web.Servi c
e s.dll"
/>
<Reference
Name = "Microsoft.Appl icationBlocks.D ata"
Project = "{30933672-466E-4F67-A111-ABF267539146}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
<Reference
Name = "Xyz.DAL"
Project = "{6559D88E-6265-4424-AC2D-8E4BC4462361}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Accoun ts"
Project = "{FAE55257-8189-49CC-8421-AE34C85300BF}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Xyz.Async"
Project = "{E6D51F3B-F4A7-4A25-BAC1-6013EF66C4B4}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
Private = "False"
/>
</References>
</Build>

We used queued components for asynchronous processes. If the

ILN

"MSFT" <lu******@onlin e.microsoft.com > wrote in message
news:0C******** ******@cpmsftng xa06.phx.gbl...
> Hello,
>
> How did you add the reference to the web application? Based on my test, the
> web application will try to find the latest version of the referenced
> assembly. (I added the reference by browsing to the classlibrary file

and
> set "copy local" to false.
>
> Luke
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>


Nov 18 '05 #6
ILN,

Yes, you would have to reload the app domain. ASP.NET is written
explicitly so that it doesn't rebind to assemblies directly on each need.
If it had to do that, it would cause a critical bottleneck.

The first thing that happens in the binding order is that the CLR says,
"Have I bound to this assembly already?" If the answer is Yes, it simply
uses the previous binding.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
<ec************ **@TK2MSFTNGP10 .phx.gbl>
<Z$************ **@cpmsftngxa06 .phx.gbl>Subject: Re: ASP.NET and shared assemblies
Date: Wed, 3 Dec 2003 11:26:10 -0500
Lines: 527
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <eS************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path: cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 .
phx.gblXref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1947 54
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi Jim,
Greatly thanks for the excellent details you provided. However, back to my
original question about how to setup the ASP.NET development environment forusing shared assemblies. Please correct me if I am wrong, it seems to me
that we need to add a post-build event to restart the IIS, or "touch" the
web.config for every changes made to the shared assembly projects ( in orderto reload the AppDomain).

I believe developers would appreciate if Microsoft can provide some
guidelines for developing ASP.NET applications with shared assemblies
scenarios. Actually the only reason we need to have shared assemblies is we
are using queued components from EnterpriseServi ce namespace.

ILN

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:Z$******* *******@cpmsftn gxa06.phx.gbl.. .
ILN,

That article is not entirely accurate. As long as you don't make a change that causes the assembly hash value to change, you can update a new

version
of the assembly in the GAC and the ASP.NET application will automatically
use the new version without changing anything. (It should be noted that
you do still have to reload the app domain.)

What changes the hash value? If you change the assembly name, the major

or
minor version, the public key token, or the culture, the hash value will
change. As long as you don't modify any one of these, you would use the
following procedure to update the assembly in the GAC.

1. Run sn to create a new verification entry for the new version. Do

that
as
follows:

sn -Vr <assembly>

2. Run Gacutil to reinstall the assembly as follows:

gacutil /nologo /if <assembly>

Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your
application will use the new assembly.

If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases

where
you can't redirect the assembly binding in a configuration file is to use

a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.

Here is an example of doing this. In this example, my assembly is called
jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.

1. Change code in version 1.0.0.0 of the assembly.

2. Change version number in assemblyinfo.cs to reflect new version.

3. Rebuild assembly.

4. Create publisher policy file in any text editor. You will need to
replace "<public_ke y>" with the public key for your version 1.0 assembly.

<configuratio n>
<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<dependentAssem bly>
<assemblyIdenti ty name="jcGAC"
publicKeyToken= "<public_ke y>"
culture="neutra l" />
<bindingRedirec t oldVersion="1.0 .0.0"
newVersion="2.0 .0.0"/>
</dependentAssemb ly>
</assemblyBinding >
</runtime>
</configuration>

5. Use al to create the publisher policy assembly. The publisher policy assembly MUST have the following file format:
policy.major_ve r.minor_ver.ass embly.dll

The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is an example of the command entered to create the publisher policy assembly
for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.

al /link:pub.config /out:policy.1.0. jcGAC.dll /keyfile:jcgac.s nk
6. Install publisher policy assembly into the GAC.

gacutil /i policy.2.0.jcGA C.dll

7. Install version 2.0.0.0 of your assembly into the GAC.

gacutil /i jcGAC.dll

8. Restart the app domains by either saving a change to the

machine.conf ig
or by resetting IIS.

9. Run the ASP.NET app.

After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps
explain a bit.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
>From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
>References: <um************ *@tk2msftngp13. phx.gbl>

<0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
>Subject: Re: ASP.NET and shared assemblies
>Date: Tue, 2 Dec 2003 11:09:34 -0500
>Lines: 349
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.3790.0
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Message-ID: <ec************ **@TK2MSFTNGP10 .phx.gbl>
>Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
>NNTP-Posting-Host: dc.cvent.com 65.117.187.221
>Path:

cpmsftngxa06.p hx.gbl!cpmsftng xa09.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 0

Nov 18 '05 #7
Jim,
Again, thank you for giving me such detailed explanations. It is really
helpful.

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:iF******** ******@cpmsftng xa06.phx.gbl...
ILN,

Yes, you would have to reload the app domain. ASP.NET is written
explicitly so that it doesn't rebind to assemblies directly on each need.
If it had to do that, it would cause a critical bottleneck.

The first thing that happens in the binding order is that the CLR says,
"Have I bound to this assembly already?" If the answer is Yes, it simply
uses the previous binding.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
<ec************ **@TK2MSFTNGP10 .phx.gbl>
<Z$************ **@cpmsftngxa06 .phx.gbl>
Subject: Re: ASP.NET and shared assemblies
Date: Wed, 3 Dec 2003 11:26:10 -0500
Lines: 527
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <eS************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path:

cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 . phx.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1947 54
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi Jim,
Greatly thanks for the excellent details you provided. However, back to myoriginal question about how to setup the ASP.NET development environment

for
using shared assemblies. Please correct me if I am wrong, it seems to me
that we need to add a post-build event to restart the IIS, or "touch" the
web.config for every changes made to the shared assembly projects ( in

order
to reload the AppDomain).

I believe developers would appreciate if Microsoft can provide some
guidelines for developing ASP.NET applications with shared assemblies
scenarios. Actually the only reason we need to have shared assemblies is weare using queued components from EnterpriseServi ce namespace.

ILN

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:Z$******* *******@cpmsftn gxa06.phx.gbl.. .
ILN,

That article is not entirely accurate. As long as you don't make a change that causes the assembly hash value to change, you can update a new

version
of the assembly in the GAC and the ASP.NET application will automatically use the new version without changing anything. (It should be noted that you do still have to reload the app domain.)

What changes the hash value? If you change the assembly name, the majoror
minor version, the public key token, or the culture, the hash value
will change. As long as you don't modify any one of these, you would use the following procedure to update the assembly in the GAC.

1. Run sn to create a new verification entry for the new version. Do

that
as
follows:

sn -Vr <assembly>

2. Run Gacutil to reinstall the assembly as follows:

gacutil /nologo /if <assembly>

Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your application will use the new assembly.

If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases

where
you can't redirect the assembly binding in a configuration file is to use
a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.

Here is an example of doing this. In this example, my assembly is

called jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.

1. Change code in version 1.0.0.0 of the assembly.

2. Change version number in assemblyinfo.cs to reflect new version.

3. Rebuild assembly.

4. Create publisher policy file in any text editor. You will need to replace "<public_ke y>" with the public key for your version 1.0 assembly.
<configuratio n>
<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<dependentAssem bly>
<assemblyIdenti ty name="jcGAC"
publicKeyToken= "<public_ke y>"
culture="neutra l" />
<bindingRedirec t oldVersion="1.0 .0.0"
newVersion="2.0 .0.0"/>
</dependentAssemb ly>
</assemblyBinding >
</runtime>
</configuration>

5. Use al to create the publisher policy assembly. The publisher

policy assembly MUST have the following file format:
policy.major_ve r.minor_ver.ass embly.dll

The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is an example of the command entered to create the publisher policy assembly for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.

al /link:pub.config /out:policy.1.0. jcGAC.dll /keyfile:jcgac.s nk
6. Install publisher policy assembly into the GAC.

gacutil /i policy.2.0.jcGA C.dll

7. Install version 2.0.0.0 of your assembly into the GAC.

gacutil /i jcGAC.dll

8. Restart the app domains by either saving a change to the

machine.conf ig
or by resetting IIS.

9. Run the ASP.NET app.

After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps explain a bit.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
>From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
>References: <um************ *@tk2msftngp13. phx.gbl>
<0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
>Subject: Re: ASP.NET and shared assemblies
>Date: Tue, 2 Dec 2003 11:09:34 -0500
>Lines: 349
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.3790.0
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Message-ID: <ec************ **@TK2MSFTNGP10 .phx.gbl>
>Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
>NNTP-Posting-Host: dc.cvent.com 65.117.187.221
>Path:


cpmsftngxa06.p hx.gbl!cpmsftng xa09.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 0

Nov 18 '05 #8
Jim,
Again, thank you for giving me such detailed explanations. It is really
helpful.

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:iF******** ******@cpmsftng xa06.phx.gbl...
ILN,

Yes, you would have to reload the app domain. ASP.NET is written
explicitly so that it doesn't rebind to assemblies directly on each need.
If it had to do that, it would cause a critical bottleneck.

The first thing that happens in the binding order is that the CLR says,
"Have I bound to this assembly already?" If the answer is Yes, it simply
uses the previous binding.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
<ec************ **@TK2MSFTNGP10 .phx.gbl>
<Z$************ **@cpmsftngxa06 .phx.gbl>
Subject: Re: ASP.NET and shared assemblies
Date: Wed, 3 Dec 2003 11:26:10 -0500
Lines: 527
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <eS************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path:

cpmsftngxa06.ph x.gbl!cpmsftngx a09.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP10 . phx.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1947 54
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Hi Jim,
Greatly thanks for the excellent details you provided. However, back to myoriginal question about how to setup the ASP.NET development environment

for
using shared assemblies. Please correct me if I am wrong, it seems to me
that we need to add a post-build event to restart the IIS, or "touch" the
web.config for every changes made to the shared assembly projects ( in

order
to reload the AppDomain).

I believe developers would appreciate if Microsoft can provide some
guidelines for developing ASP.NET applications with shared assemblies
scenarios. Actually the only reason we need to have shared assemblies is weare using queued components from EnterpriseServi ce namespace.

ILN

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:Z$******* *******@cpmsftn gxa06.phx.gbl.. .
ILN,

That article is not entirely accurate. As long as you don't make a change that causes the assembly hash value to change, you can update a new

version
of the assembly in the GAC and the ASP.NET application will automatically use the new version without changing anything. (It should be noted that you do still have to reload the app domain.)

What changes the hash value? If you change the assembly name, the majoror
minor version, the public key token, or the culture, the hash value
will change. As long as you don't modify any one of these, you would use the following procedure to update the assembly in the GAC.

1. Run sn to create a new verification entry for the new version. Do

that
as
follows:

sn -Vr <assembly>

2. Run Gacutil to reinstall the assembly as follows:

gacutil /nologo /if <assembly>

Once you do that, simply open the web.config, add a new blank line, and
save the web.config. That will force a reload of the app domain and your application will use the new assembly.

If you have changed the hash value by changing one of the above, the
easiest way to force your application to use the new version in cases

where
you can't redirect the assembly binding in a configuration file is to use
a
publisher policy assembly. Most people will say that you should use a
publisher policy file, but that's not entirely accurate. The publisher
policy file is used to create the publisher policy assembly, and it's
actually the publisher policy assembly that redirects the binding.

Here is an example of doing this. In this example, my assembly is

called jcGAC.dll and I am changing the version number from 1.0.0.0 to 2.0.0.0.

1. Change code in version 1.0.0.0 of the assembly.

2. Change version number in assemblyinfo.cs to reflect new version.

3. Rebuild assembly.

4. Create publisher policy file in any text editor. You will need to replace "<public_ke y>" with the public key for your version 1.0 assembly.
<configuratio n>
<runtime>
<assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
<dependentAssem bly>
<assemblyIdenti ty name="jcGAC"
publicKeyToken= "<public_ke y>"
culture="neutra l" />
<bindingRedirec t oldVersion="1.0 .0.0"
newVersion="2.0 .0.0"/>
</dependentAssemb ly>
</assemblyBinding >
</runtime>
</configuration>

5. Use al to create the publisher policy assembly. The publisher

policy assembly MUST have the following file format:
policy.major_ve r.minor_ver.ass embly.dll

The major and minor version shown here would be the major and minor
versions for your original version, not the updated new version. Below is an example of the command entered to create the publisher policy assembly for my assembly jcGAC.dll using the keyfile jcgac.snk. Note that the
publisher policy file in created in step 4 was saved as pub.config.

al /link:pub.config /out:policy.1.0. jcGAC.dll /keyfile:jcgac.s nk
6. Install publisher policy assembly into the GAC.

gacutil /i policy.2.0.jcGA C.dll

7. Install version 2.0.0.0 of your assembly into the GAC.

gacutil /i jcGAC.dll

8. Restart the app domains by either saving a change to the

machine.conf ig
or by resetting IIS.

9. Run the ASP.NET app.

After taking these steps, any ASP.NET application that originally
referenced version 1.0.0.0 will now bind to version 2.0.0.0.
Assembly binding is a fairly complex subject, but I hope that this helps explain a bit.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
>From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
>References: <um************ *@tk2msftngp13. phx.gbl>
<0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
>Subject: Re: ASP.NET and shared assemblies
>Date: Tue, 2 Dec 2003 11:09:34 -0500
>Lines: 349
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.3790.0
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Message-ID: <ec************ **@TK2MSFTNGP10 .phx.gbl>
>Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
>NNTP-Posting-Host: dc.cvent.com 65.117.187.221
>Path:


cpmsftngxa06.p hx.gbl!cpmsftng xa09.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 0

Nov 18 '05 #9
ILN,

You are very welcome. That's my day job. :) I'm glad the info helped.
We want developers to understand as much as possible about the internal
implementation of ASP.NET.

Here's a good article that might help as well:

http://msdn.microsoft.com/library/de...us/dnvbdev01/h
tml/vb01g10.asp

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
References: <um************ *@tk2msftngp13. phx.gbl> <0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
<ec************ **@TK2MSFTNGP10 .phx.gbl>
<Z$************ **@cpmsftngxa06 .phx.gbl>
<eS************ **@TK2MSFTNGP10 .phx.gbl>
<iF************ **@cpmsftngxa06 .phx.gbl>Subject: Re: ASP.NET and shared assemblies
Date: Thu, 4 Dec 2003 09:06:49 -0500
Lines: 216
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <#D************ **@TK2MSFTNGP11 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: dc.cvent.com 65.117.187.221
Path: cpmsftngxa07.ph x.gbl!cpmsftngx a06.phx.gbl!TK2 MSFTNGP08.phx.g bl!TK2MSFTNGP11 .
phx.gblXref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1943 72
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Jim,
Again, thank you for giving me such detailed explanations. It is really
helpful.

"Jim Cheshire [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:iF******* *******@cpmsftn gxa06.phx.gbl.. .
ILN,

Yes, you would have to reload the app domain. ASP.NET is written
explicitly so that it doesn't rebind to assemblies directly on each need.
If it had to do that, it would cause a critical bottleneck.

The first thing that happens in the binding order is that the CLR says,
"Have I bound to this assembly already?" If the answer is Yes, it simply
uses the previous binding.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online .microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
>From: "Invalidlastnam e" <in************ *@toomanyvalida tions.page>
>References: <um************ *@tk2msftngp13. phx.gbl>

<0C************ **@cpmsftngxa06 .phx.gbl>
<ut************ **@tk2msftngp13 .phx.gbl>
<ec************ **@TK2MSFTNGP10 .phx.gbl>
<Z$************ **@cpmsftngxa06 .phx.gbl>
>Subject: Re: ASP.NET and shared assemblies
>Date: Wed, 3 Dec 2003 11:26:10 -0500
>Lines: 527
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.3790.0
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Message-ID: <eS************ **@TK2MSFTNGP10 .phx.gbl>
>Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
>NNTP-Posting-Host: dc.cvent.com 65.117.187.221
>Path:

cpmsftngxa06.p hx.gbl!cpmsftng xa09.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 0

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1520
by: Gary Varga | last post by:
I have an application which runs on both CE.NET and the full framework. To allow for a shared code base the following describes the assembly structure: 1) There is an executable binary for each of CE.NET and .NET (Forms). 2) These Forms binaries reference and use classes defined in a business logic library (BLL) class assembly. 3) The...
1
1655
by: Dan | last post by:
Here's a scenario I'd like to discuss in order to setup my VS.NET IDE properly and be able to prepare a distribution: a) I have a windows forms C# app using 3 shared assemblies I developed to include various functions. The 3 shared assemblies are strongly named, and some of them are also used by others of them. Let's call them A, B, and C:...
1
1282
by: Tim Kohler | last post by:
I'm having a problem with shared assemblies > 2^16 bytes in size. My assembly is in a solution along with a console app that references the assembly. The app is set up to reference the assembly (the reference path is pointed to the assemblies output directory). When I do a build, the assembly is failing to build because the .dll is loaded....
0
1896
by: RadekP | last post by:
Hi Gurus .. I would really appreciate some insights for the problem that bugs me for quite some time. I keep my custom controls in their own shared (private/public key signed) assembly. I need to have it shared. Usually I work with a Web application project that has a reference to my shared, custom controls assembly. Web project is a...
0
1803
by: Raffi Basmajian | last post by:
I am trying to understand the difference between signing ClickOnce manifests and signing shared assemblies. My company is building .Net 2005 WinForm applications for internal company use only. Currently, the ClickOnce security settings on the applications is set for "Full Trust". We are using shared assemblies across development groups, but...
7
3599
by: tony | last post by:
Hello! Can somebody tell me exactly when do I use GAC where shared assembly dll is stored. //Tony
0
945
by: Tony Johansson | last post by:
Hello! Can somebody give me a hint when to use private assemblies and when to use shared assemblies ? One mode thing will shared assemblies alwayse be put in the GAC(global assembly cach) ? //Tony
3
185
by: Tony Johansson | last post by:
Hello! I just want to check with you if .NET assemblies consist of only shared assemblies ? It must be shared assemblies because you never copies these assemblies to the folder where your application is located. //Tony
16
3377
by: MA | last post by:
Hi, We have added a shared assembly in GAC so that our multiple solutions can use use it. We use the publisher policy to controls the different versions of the assembly. This shared assembly also has dependencies (some are .NET assembly with strong name and some non .NET without strong name). How we will manage the dependent assemblies?...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6569
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.