473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

still confused by @assembly directive

When I build a C# class and install it in the GAC, my code works as it
should, my .aspx code finds the DLL and can run a static method:

<%@ Assembly Name="AutoCoder, Culture=neutral,
Version=1.0.1922.22245, PublicKeyToken=0a4067d718757385" %>
<%@ Import Namespace="AutoCoder" %>
Trace.Write( "AutoCoder", AutoCoder.Common.GetConnectionString( )) ;

But I cant locate the assembly in its directory using the src=
property.
- in IIS I map a virtual directory
- use the following @Assembly directive to reference the DLL:

<%@ Assembly src="\src#\AutoCoder\AutoCoder\bin\release\AutoCod er.dll"
%>

Parser Error Message: There is no build provider registered for the
extension '.dll'. You can register one in the
<compilation><buildProviders> section in machine.config or web.config.
Make sure the appliesTo attribute includes the value 'Web' or 'All'.

Why do I have to provide a build provider when using src= to reference
the assembly, but dont have to the assembly is founc in the GAC?

-Steve

Nov 19 '05 #1
7 1702
@Assembly with src is used to have ASP.NET compile an additional source file
for you. You specify a .cs or .vb file in there, not a DLL (since a DLL is
already compiled). If you already have a DLL, the only places it can be depolyed
is the GAC or in ~/bin. If it's in the ~/bin then it's automatically referenced.
If it's in the GAC< you need the <@Assembly Name="" %> directive.

-Brock
DevelopMentor
http://staff.develop.com/ballen
When I build a C# class and install it in the GAC, my code works as it
should, my .aspx code finds the DLL and can run a static method:

<%@ Assembly Name="AutoCoder, Culture=neutral,
Version=1.0.1922.22245, PublicKeyToken=0a4067d718757385" %>
<%@ Import Namespace="AutoCoder" %>
Trace.Write( "AutoCoder", AutoCoder.Common.GetConnectionString( )) ;
But I cant locate the assembly in its directory using the src=
property.
- in IIS I map a virtual directory
- use the following @Assembly directive to reference the DLL:
<%@ Assembly src="\src#\AutoCoder\AutoCoder\bin\release\AutoCod er.dll"
%>

Parser Error Message: There is no build provider registered for the
extension '.dll'. You can register one in the
<compilation><buildProviders> section in machine.config or web.config.
Make sure the appliesTo attribute includes the value 'Web' or 'All'.

Why do I have to provide a build provider when using src= to reference
the assembly, but dont have to the assembly is founc in the GAC?

-Steve


Nov 19 '05 #2

Brock Allen wrote:
@Assembly with src is used to have ASP.NET compile an additional source file for you. You specify a .cs or .vb file in there, not a DLL (since a DLL is already compiled). If you already have a DLL, the only places it can be depolyed is the GAC or in ~/bin. If it's in the ~/bin then it's automatically

referenced.

what is the ~/bin directory? There is none within /inetpub on my
system.

so is this statement crap?

"...One popular misconception is that strongly-named assemblies must
always be installed in the GAC. Strongly-named assemblies can be put in
the GAC, but by no-means have to be put there. It is desirable to put
strongly-named assemblies under the application directory if you want
to ensure your application has no system-wide impact, and make sure
that it can be XCOPY deployed. ..."

http://www.codeproject.com/dotnet/De...&select=940022

thank you,

-Steve

Nov 19 '05 #3
Hi, Steve.

re:
what is the ~/bin directory?
The ~/bin directory is the /YourAppdirectory/bin directory.

The " ~ " is a shortcut for the root directory of any application.

re: so is this statement crap?
You *can* place strongly-named assembies in the /bin
directory. That doesn't mean you *should* do that.

Read this :
http://blogs.msdn.com/junfeng/archiv...05/208375.aspx

It will make the concepts clearer.

Chris Brumme's blog entry at :
http://blogs.msdn.com/cbrumme/archiv.../01/51466.aspx
will give you additional background info.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Steve Richter" <St************@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Brock Allen wrote:
@Assembly with src is used to have ASP.NET compile an additional

source file
for you. You specify a .cs or .vb file in there, not a DLL (since a

DLL is
already compiled). If you already have a DLL, the only places it can

be depolyed
is the GAC or in ~/bin. If it's in the ~/bin then it's automatically

referenced.

what is the ~/bin directory? There is none within /inetpub on my
system.

so is this statement crap?

"...One popular misconception is that strongly-named assemblies must
always be installed in the GAC. Strongly-named assemblies can be put in
the GAC, but by no-means have to be put there. It is desirable to put
strongly-named assemblies under the application directory if you want
to ensure your application has no system-wide impact, and make sure
that it can be XCOPY deployed. ..."

http://www.codeproject.com/dotnet/De...&select=940022

thank you,

-Steve

Nov 19 '05 #4
> what is the ~/bin directory? There is none within /inetpub on my
system.
If you have DLLs you want to use from your application they can either be
installed into the GAC 9as you've seen) or they can be installed into a well-known
directory called "bin" which must be in the root of your application directory.
When I say application directory I mean the directory that's configured in
IIS as a virtual directory.
so is this statement crap?

"...One popular misconception is that strongly-named assemblies must
always be installed in the GAC. Strongly-named assemblies can be put
in the GAC, but by no-means have to be put there. It is desirable to
put strongly-named assemblies under the application directory if you
want to ensure your application has no system-wide impact, and make
sure that it can be XCOPY deployed. ..."


This is correct but it's not written fore the ASP.NET audience. When they
say application direcotry, normally that's your application's directory,
but ASP.NET disables this particular load location, and instead only ever
looks in the bin directory. So you can put strongly named assembles in the
~/bin. Anything in the ~/bin will automatically be referenced (IOW, visible)
from your code. If it's not in ~/bin then it must be in the GAC but you need
to let ASP.NET know you need it via <%@Assembly Name= %> directive.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5

Juan T. Llibre wrote:
Hi, Steve.

re:
what is the ~/bin directory?
The ~/bin directory is the /YourAppdirectory/bin directory.

The " ~ " is a shortcut for the root directory of any application.


ok. so I am using Visual Web Developer to code my web pages and am not
using the "New Web Site" option. All my .aspx files are standalone
files, all in the same directory, all are compiled by IIS when the page
is first referenced. In this scenario, I dont have a /bin directory,
right?

re:
so is this statement crap?


You *can* place strongly-named assembies in the /bin
directory. That doesn't mean you *should* do that.

Read this :
http://blogs.msdn.com/junfeng/archiv...05/208375.aspx

It will make the concepts clearer.

Chris Brumme's blog entry at :
http://blogs.msdn.com/cbrumme/archiv.../01/51466.aspx
will give you additional background info.


note to Microsoft and the MVP people: I am a typical idiot who is
capable of getting a web page to work. What you all think is clear is
not very clear to me. ( I am not complaining, and I appreciate the high
quality answers I am getting to my questions. This is just feedback
from a beginner that maybe asp.net is being made more complicated than
it has to be. )

Just curious. Are the appdomain and shared assemblies concepts that
apply to high volume web server environments? The idea being that if
the separate processes and threads the web server runs to service all
the browser posts can be made to share the static objects in the
assemblies then overall performance will be improved?

thanks for all the help,

-Steve

Nov 19 '05 #6
> ok. so I am using Visual Web Developer to code my web pages and am
not using the "New Web Site" option. All my .aspx files are standalone
files, all in the same directory, all are compiled by IIS when the
page is first referenced. In this scenario, I dont have a /bin
directory, right?
So sounds like you're using ASP.NET 2.0. It's optional to have a ~/bin. If
you have assemblies (DLLs) that you'd like to use then you can have a bin.
If you don't have any other DLLs then you don't have a ~/bin. BTW, VS.NET
adds the ~/bin when you select "Add Reference" for your project (unless it's
a GAC assembly though, since that's already deployed in the GAC).
note to Microsoft and the MVP people: I am a typical idiot who is
capable of getting a web page to work. What you all think is clear is
not very clear to me. ( I am not complaining, and I appreciate the
high quality answers I am getting to my questions. This is just
feedback from a beginner that maybe asp.net is being made more
complicated than it has to be. )
Well, I'm not a MVP, but I'd say it's not a problem -- that's the point of
these newsgroups. Ask questions. All of the questions you've asked have been
compelling questions that we've all had while learning this stuff. So, no
it's not a problem.
Just curious. Are the appdomain and shared assemblies concepts that
apply to high volume web server environments? The idea being that if
the separate processes and threads the web server runs to service all
the browser posts can be made to share the static objects in the
assemblies then overall performance will be improved?
AppDomains are like processes and in the context of ASP.NET they're used
to isolate applications and application's data from one another. You get
a distinct copy of all static variables per AppDomain, so that each ASP.NET
application is isolated and thus won't inadvenently affect another. Assemblies
are also loaded per-AppDomain so just because you have an assembly loaded
in your web app doesn't mean I can see it or use it from my web app. So,
at the end of the day AppDomains serve the same role as processes in Win32
-- it's an isolation boundary.

Now, you might ask why we have them at all? Win32 processes already do this
for us. Well, AppDomains are much lighter weight that Win32 processes. Releatively
speaking Win32 processes are very expensive, so a web server with 100 distinct
processes, one for each application is usually unnecessary and wasteful.
AppDomains serve to mitigate this.
thanks for all the help,


np :)

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #7
> So sounds like you're using ASP.NET 2.0. It's optional to have a
~/bin. If you have assemblies (DLLs) that you'd like to use then you
can have a bin.
Oops, another sloppy post. Juan's gonna have a field day with me :P

These two statements:
So sounds like you're using ASP.NET 2.0.
and
It's optional to have a ~/bin. If you have assemblies (DLLs) that
you'd like to use then you can have a bin.


Are unrelated. I was just making an observation with the first one (re: 2.0).
Just for the record :)

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #8

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

Similar topics

1
by: Neil Greenough | last post by:
I'm still confused as to how the language used in .asp looks up certain information. In my case, I have a Access Database, and I want .asp to give me an estimation online, using the information...
1
by: Jim Heavey | last post by:
I am trying to figure out the @Assembly directive. I have an application which uses "codebehind" and only uses source code, so I am using the "src=" option of the @Page directive. So I have...
9
by: JohnSmith | last post by:
I suspect this is easy, but I have been stumped for a day trying to solve this.. I want to be able to have an unlimited number of aspx pages that all use the code in one class file. I want code...
6
by: darrel | last post by:
I've asked this a few times and gotten answers, but I'm still missing a piece of the puzzle. Here's what I have: - page.aspx - title tag - usercontrol.aspx - usercontrol.aspx.vb
2
by: G Dean Blake | last post by:
I wrote and deployed a control with the assembly name of GP to the GAC of another dev box via drag and drop. a web page using this control has: <%@ Register TagPrefix="cc1" Namespace="GP"...
7
by: Steve Richter | last post by:
I am attempting to use the IBM DB2Connection class in my .aspx web page. Using Visual Web Developer 2005 express, I cant figure out how to add a reference to a project. heck, I cant figure out...
6
by: pookiebearbottom | last post by:
Let's say I have headers Sal.h with this class class Sal { public: int doit() { return 1;} }; now I know that the compilier can choose NOT to inline this function. So if I include this in...
1
by: Coaster | last post by:
orig ref here http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ff29cc370678911d/c0db5b7e3da283b9?lnk=st&q=gac+assembly+new+version&rnum=7#c0db5b7e3da283b9...
0
by: George2 | last post by:
Hello everyone, Sorry that this question is related to another question I posted some time before because I have some new findings and self-analysis. My question is why sometimes from perfmon...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.