473,618 Members | 3,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

@Assembly Directive Question

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 something
that
looks like the following:

ASPX Files ASPX.VB Files
Page1.aspx Page1.aspx.vb
Page2.aspx Page2.aspx.vb
Page3.aspx Page3.aspx.vb

Now all of these three pages have a common program, let's call it
"Common.vb"
which is called from Page1.aspx.vb, Page2.aspx.vb, Page2.aspx.vb.

When I run using the @Page src="Pag1.aspx. vb" inherits="Page1 ", when
Page1.aspx.vb instatiates the "Common.vb" I get a compile error
indicating
that the class can not be found.

If I copy "Common.vb" and append it to "Page1.aspx.vb" ... then no
problem, it
works just fine.

I am trying to find a way to enable these pages to find "Common.vb"
without me
having to copy the source into each of these pages.

I have taken to "Common.vb" and created a seperate project, and compiled
it
and placed the code in the "bin" folder, but still not luck.

Looking at the @Assembly option, it would appear to me that this may
allow the
assembly to be found, but no matter what I put into this directive, even
garbage, it has not effect. It has a "src=" option which indicates that
the
specified program will be compiled on the fly.

So any ideas as to what I need to do to enable the program to be found
and
compiled on the fly? Or for that matter, found in the "bin" folder?
Although
I believe it will look in the "Bin" folder for the "folder" which is
identified as an "applicatio n folder" and unfortuneatly the folder that
I am
executing from is not an application folder and nor do I have access to
the
folder which is the application folder to place my compiled program
into.

Your assistance would be greatly appreciated!!!! !!!!!!!

Nov 18 '05 #1
1 1636
If you are using the src option, you are indicating that your class should
be dynamically compiled. As such, you should be aware of where this is
taking place - it is placing compiled versions of the pages you want into a
web cache, where it can not locate other source files that you may intend to
rely on.

A better approach would be to pre-compile the codebehind pages and use the
CodeBehind attribute. Now, during dynamic compilation, it will search for
this code in compiled form in the bin directory, and all of your references
to another class will be compiled into the same assembly and accessible from
your code behind pages. If you need to get at this from your declarative
page (inside of a code declaration/code render block) then you may want to
consider creating wrappers from your code behind, or else using inheritance.
(For example, creating a new SpecialPage that derives from
System.Web.UI.P age, and then having each of your pages derive from this
class.)

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Jim Heavey" <Ji*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.16...
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 something
that
looks like the following:

ASPX Files ASPX.VB Files
Page1.aspx Page1.aspx.vb
Page2.aspx Page2.aspx.vb
Page3.aspx Page3.aspx.vb

Now all of these three pages have a common program, let's call it
"Common.vb"
which is called from Page1.aspx.vb, Page2.aspx.vb, Page2.aspx.vb.

When I run using the @Page src="Pag1.aspx. vb" inherits="Page1 ", when
Page1.aspx.vb instatiates the "Common.vb" I get a compile error
indicating
that the class can not be found.

If I copy "Common.vb" and append it to "Page1.aspx.vb" ... then no
problem, it
works just fine.

I am trying to find a way to enable these pages to find "Common.vb"
without me
having to copy the source into each of these pages.

I have taken to "Common.vb" and created a seperate project, and compiled
it
and placed the code in the "bin" folder, but still not luck.

Looking at the @Assembly option, it would appear to me that this may
allow the
assembly to be found, but no matter what I put into this directive, even
garbage, it has not effect. It has a "src=" option which indicates that
the
specified program will be compiled on the fly.

So any ideas as to what I need to do to enable the program to be found
and
compiled on the fly? Or for that matter, found in the "bin" folder?
Although
I believe it will look in the "Bin" folder for the "folder" which is
identified as an "applicatio n folder" and unfortuneatly the folder that
I am
executing from is not an application folder and nor do I have access to
the
folder which is the application folder to place my compiled program
into.

Your assistance would be greatly appreciated!!!! !!!!!!!

Nov 18 '05 #2

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

Similar topics

2
3166
by: George Durzi | last post by:
I'm trying to put an assembly into the GAC. The assembly is called Common.Mail. I've done the following: - Create a strong name for Common.Mail: - From command prompt: cd Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin sn -k Common.Mail.snk - Link Assembly at command line using Assembly Linker tool. - From command prompt:
1
991
by: Jason MacKenzie | last post by:
We are clearly going about this the wrong way so before we get too far I would like some advice. We have all common assemblies like our page base class etc located on our Dev server. We reference them in all our applications with Copy Local set to trued We then publish them to the production server for example so each asp.net app has a copy of the common assembly in the bin directory.
0
871
by: murphy | last post by:
During my use of vs.net for a web project I sometimes get the following error. ****** Server Error in '/HD' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error
2
1371
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" Assembly="GP" %> The docs and books I have say that this should be enough for the page to find the assembly in the GAC at run time but it does not find it. I am having to put a copy of my GP.dll in the ASP.NET application Bin directory for it to work....
7
3124
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 how to open a project! so I am trying to use the @assembly directive to point directly to the assembly .DLL that contains the DB2 namespace:
7
1718
by: Steve Richter | last post by:
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.
3
1246
by: Lee | last post by:
If Assembly A references Assembly B and I include Assembly A in my project, does it implicitly import Assembly B? -- Warm Regards, Lee "Upon further investigation it appears that your software is missing just one thing. It definitely needs more cow bell..."
6
2079
by: Andrew Neillans | last post by:
Hi all, First off, I apologise if this is mentioned in a MSDN document somewhere, but I've searched both MSDN and Google and can't find anything - so thought I'd post. Ok, now the problem. I have an application which is dynamically loading a series of Assemblies (as plugins to extend the main application). This works
6
2741
by: Piotrekk | last post by:
Hi In my solution I have two projects. First is Library project. The second project uses this library ( dll ). I am registering this assembly in global assembly cache ( by .net configuration tool ). Key pair is generated for the assembly using VS2005 ( I also use VS to sign my assembly using this keypair ) Everything works fine. I am adding reference to created dll, on the second project.
0
8150
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8650
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7124
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4064
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2582
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
1760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1455
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.