Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 28th, 2008, 03:11 PM
Registered User
 
Join Date: May 2008
Location: Hoover, AL, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 'Direction' type declared in two DLL's

I've spent a lot of time today trying to figure out a problem where, I receive a compilation error telling me that 'Direction' type was declared in Site.dll and another temporary DLL. The problem only occurred if I included the DisplayDirection attribute on the aspx markup. I never got it fixed, only to remove the attribute and use the codebehind to set the DisplayDirection on the form_load. There seem to be a lot of posts in a lot of places about how to fix this 'bug', but none of the ones I saw worked. So I hope this helps someone.

 
Old May 28th, 2008, 04:16 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Eric,

You are referring to Site.dll. Did you create the PlanetWrox project as a Web Application Project rather than a Web Site Project?

If so, did you rename the project at some stage? What DLLs do you have in the Bin folder?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 28th, 2008, 07:29 PM
Registered User
 
Join Date: May 2008
Location: Hoover, AL, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I created it with VS2008 Standard. I did not rename the project. The only option I have is ASP.NET Web Application. The only DLL I have in my bin folder is the Site.dll. Here's an example of the error:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'Direction' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET Files\root\cb99f8ec\ab842c32\App_Code.7wlviuka.dll ' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET Files\root\cb99f8ec\ab842c32\assembly\dl3\db1e14b0 \06fc1653_13c1c801\Site.DLL'

 
Old May 29th, 2008, 12:32 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Eric,.

That's what I thought. The book assumes you have created a Web Site Project, not a WAP. Take a look at chapter 2; both types are discussed in that chapter. You shouldn't use choose File | New Project and then select a WAP, but you should choose File | New Web Site directly (or File | New | Web Site).

I need to check if and why the property behaves differently when using a WAP. However, I can't do that right now (I am in Denmark for work) so it may take some time before I can give you an answer. Stay tuned...

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 29th, 2008, 12:43 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

BTW, you could also try clearing the :\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tempo rary ASP.NET Files folder...

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old May 29th, 2008, 05:00 PM
Registered User
 
Join Date: May 2008
Location: Hoover, AL, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

I tried removing the temporary files. I also moved the project files to another machine. Neither of those attempts succeeded. I finally decided to create a "Web Site" and copy over code from the wrox site up to Chapter 7. That was a big help. I'm not getting the error anymore. I just would not have thought that there could be that much difference.

Thanks,
Eric

 
Old May 30th, 2008, 09:26 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

There are some significant differences between a "web site" and a "web application project" (WAP).

- Project structure
A web site has no project file. The "site" is simply the collection of files in the site's directory. Project/binary references and other configuration settings are stored in the web.config file (poor form in my opinion).

A web application project does have a project file, it's treated as a class library project. However, the visual studio template for a WAP provides some additional things such as what types of items are visible in the "Add new item" dialog (i.e. web form, master page, user control, web.config, etc) and configuration of debugging such as the settings for the development web server or IIS.

- Codebehind/Codefile attribute
In a WAP, the markup directive (@Page, @Control, etc.) contains the "Codebehind" attribute. This is actually meaningless to the ASP.NET runtime, it's a linking attribute used by visual studio to indicate what the code-behind file is for the markup file.
In a site, the "Codefile" attribute is used. This is similar to the "Src" attribute. (I've experimented with the two and can't find a significant difference between them.) It tells the ASP.NET runtime what source code file should be compiled together with the markup. This is what links a markup file to a code behind file in the dynamic architecture of web sites.

- Compilation
In both a site and WAP, the markup (AS?X files) are dynamically compiled. There is an exception but it's an advanced topic. All code files (including page code-behind) for a WAP are always pre-compiled. In a site, nothing is pre compiled. The ASP.NET runtime will compile everything in the App_Code directory into one DLL and each page will get compiled into its own DLL. This affects the class scope.

- Class scope
Only code in App_Code is available to all classes in a site (that's where you HAVE to put shared code). In the WAP - because it's pre-compiled - all page classes live together in the same assembly and can thus see each other.

- Namespaces
Perhaps the largest difference between the two is with the namespaces are constructed.
In a WAP all classes are created by default as members of the root namespace defined in the project (typically the project name). For example, in a project named "MyProject" the new page "MyPage" will have a fully qualified class name of "MyProject.MyPage". When you create sub directories in the project, visual studio creates another namespace level for pages created in those directories by default. So if I create a folder "Admin" and another page "MyPage" I will get a class name of "MyProject.Admin.MyPage".

In a site, all pages are part of the default root namespace for dynamically compiled pages: "ASP". Class names are created with underscore separation of their location when they live in sub directories. In a web site, instead of "MyProject.Admin.MyPage" the page class would actually be "Admin_MyPage". When it's dynamically compiled it will become "ASP.Admin_MyPage".

I did a recent blog post about this if you are interested in a more polished explanation.

-Peter
compiledthoughts.com
 
Old May 30th, 2008, 10:56 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Peter,

Many thanks for this post, and the blog entry. Great explanation of the two models....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging DLL's amd2003 Beginning VB 6 6 April 23rd, 2008 03:09 PM
Chapter 3 : type changing frjacquemin BOOK: Beginning Mac OS X Programming 3 November 14th, 2005 10:02 PM
probelms with dll's gabriel_ro BOOK: Beginning ASP 3.0 0 February 25th, 2005 07:30 AM
DLL's snowy0 VB.NET 1 October 1st, 2004 09:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.