Assembly Reference - GAC

M

Mythran

We have more than one version of an assembly that contains web controls
installed in the GAC. In our application, we want to always reference the
most recent version of the assembly WITHOUT manually changing the version
numbers in the .aspx files (<% Register TagPrefix... lines). I can manually
remove the version information from the aspx files and all is well. It
seems to be using the most recent version just fine.

One problem is, if we add a new page and drag-n-drop a control that is in an
assembly in the GAC, it hardcodes the version number into the web form. We
have to manually remove it for each new page...is there an easier way?

Is there a better way to do this while keeping the assemblies in the GAC and
w/o setting CopyLocal to True?

Thanks,
Mythran
 
M

Michael Nemtsev

Hello Mythran,

You can use "publisher policy" where you can specify that your app need to
use the latest version of your assembly
http://msdn.microsoft.com/library/d...ide/html/cpconcreatingpublisherpolicyfile.asp

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

M> We have more than one version of an assembly that contains web
M> controls installed in the GAC. In our application, we want to always
M> reference the most recent version of the assembly WITHOUT manually
M> changing the version numbers in the .aspx files (<% Register
M> TagPrefix... lines). I can manually remove the version information
M> from the aspx files and all is well. It seems to be using the most
M> recent version just fine.
M>
M> One problem is, if we add a new page and drag-n-drop a control that
M> is in an assembly in the GAC, it hardcodes the version number into
M> the web form. We have to manually remove it for each new page...is
M> there an easier way?
M>
 
M

Mythran

Michael Nemtsev said:
Hello Mythran,

You can use "publisher policy" where you can specify that your app need to
use the latest version of your assembly
http://msdn.microsoft.com/library/d...ide/html/cpconcreatingpublisherpolicyfile.asp

---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

M> We have more than one version of an assembly that contains web
M> controls installed in the GAC. In our application, we want to always
M> reference the most recent version of the assembly WITHOUT manually
M> changing the version numbers in the .aspx files (<% Register
M> TagPrefix... lines). I can manually remove the version information
M> from the aspx files and all is well. It seems to be using the most
M> recent version just fine.
M> M> One problem is, if we add a new page and drag-n-drop a control that
M> is in an assembly in the GAC, it hardcodes the version number into
M> the web form. We have to manually remove it for each new page...is
M> there an easier way?
M>

Found a way to make the application use a specific version and only have to
update the web.config...which isn't too bad. The IDE still inserts the
version in the ASPX file automatically when I add a control from an assembly
that the form hasn't used yet...have to manually remove those version #'s
though....there a way around that?

Thanks,
Mythran
 
M

Michael Nemtsev

Hello Mythran,

For the GAC assemblies u need to specify the fully qualified name in web.config.
only if your assembly is not in gac (in bin directory) u can refer to by
without full-qualified name

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

M> Found a way to make the application use a specific version and only
M> have to update the web.config...which isn't too bad. The IDE still
M> inserts the version in the ASPX file automatically when I add a
M> control from an assembly that the form hasn't used yet...have to
M> manually remove those version #'s though....there a way around that?
M>
 
M

Mythran

Michael Nemtsev said:
Hello Mythran,

For the GAC assemblies u need to specify the fully qualified name in
web.config.
only if your assembly is not in gac (in bin directory) u can refer to by
without full-qualified name

When I create an aspx page and drop a control that is located in the
assembly in the GAC, regardless of what I have in my web.config, the IDE
still inserts the fully qualified assembly name in the page. I have to
manually remove the fully qualified name and replace it with the partial
name. Is there a way to have the IDE only insert the assembly's partial
name into the ASPX page for the assemblies located in the GAC?

Basically, what I have, just to make sure we are on the same page:

Created a web control in an assembly, gave it a strong name, and installed
it into the GAC.
Created a web project and referenced the assembly in the GAC.
Added the web control from the GAC'ed assembly to the toolbox.
Modified the web.config file and placed the <qualifyAssembly> element (and
proper parent/child elements).
Drag-n-dropped the web control from the toolbox onto the form.
Open the form in HTML view and at the top of the html, the @Register
directive shows the fully qualified assembly name.

I manually change this name to the partial name which matches the partial
name stored in the web.config file but I don't want to have to do this if
the IDE can see I don't need the fully qualified name. I doubt much can be
done to "force" the ide to listen to me but hey, worth a shot.

Thanks,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top