Re: Adding @Assembly references programmaticall y
Hi Praveen,
Well, I think you're right. For those dynamically compiled components
(aspx, ascx ....), the referenced assembly are specified by the @Register
@Assembly directives in template or the predefined references in
web.config(or machine.config) 's <assembies> configuration element. And by
default the machine.conifig 's <assemblies> settting contains the
<assemblies>
....
<add assembly="*" />
</assemblies>
So all the assemblies in the private bin path will be automatically
refereced. That's why if using copylocal, that'll work.
Currently I think we have the following options when developing our custom
control which may meet such problem:
1. Programmaticall y add the <@assembly > directive into aspx page. Though
we can get the path of the editing
aspx page in VS.NET at design-time , but I didn't suggest this approach
since VS.NET didn't provide buidlin DOM structure or interface to let us
programly editing it.
2. Since we can specify the assembly reference in
web.config/machine.config' s <compilation><a ssemblies>.. like below:
<compilation
defaultLanguage ="c#"
debug="true"[color=blue]
>[/color]
<assemblies>
<add
assembly="Inter faceLib,Version =1.0.0.0,Cultur e=Neutral,Publi cKeyToken=2bfe0 2
78943847bf"/>
</assemblies>
</compilation>
We can consider adding the reference of our assembly into web.config at
design-time. Since web.config is a xml file we can using the buildin DOM
api to manipulate it. That'll be much more convenient.
How do you think of this?
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Praveen,
Well, I think you're right. For those dynamically compiled components
(aspx, ascx ....), the referenced assembly are specified by the @Register
@Assembly directives in template or the predefined references in
web.config(or machine.config) 's <assembies> configuration element. And by
default the machine.conifig 's <assemblies> settting contains the
<assemblies>
....
<add assembly="*" />
</assemblies>
So all the assemblies in the private bin path will be automatically
refereced. That's why if using copylocal, that'll work.
Currently I think we have the following options when developing our custom
control which may meet such problem:
1. Programmaticall y add the <@assembly > directive into aspx page. Though
we can get the path of the editing
aspx page in VS.NET at design-time , but I didn't suggest this approach
since VS.NET didn't provide buidlin DOM structure or interface to let us
programly editing it.
2. Since we can specify the assembly reference in
web.config/machine.config' s <compilation><a ssemblies>.. like below:
<compilation
defaultLanguage ="c#"
debug="true"[color=blue]
>[/color]
<assemblies>
<add
assembly="Inter faceLib,Version =1.0.0.0,Cultur e=Neutral,Publi cKeyToken=2bfe0 2
78943847bf"/>
</assemblies>
</compilation>
We can consider adding the reference of our assembly into web.config at
design-time. Since web.config is a xml file we can using the buildin DOM
api to manipulate it. That'll be much more convenient.
How do you think of this?
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Comment