473,387 Members | 1,456 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,387 software developers and data experts.

How does ASP.NET find code-behind DLLs

I've got an ASP.NET website on my local box, set to compile to
bin\Debug and bin\Release in debug and release modes. Both directories
are populated with dlls, as the solution has been compiled in both
modes. When I browse to the local website, it works, but which set of
dlls is it using? What happens when I deploy to Test and there is only
a \bin\ directory, no \Debug or \Release?

I assume .NET has some path-searching rules that govern where it looks
for a website's binaries, but I've been unable to find these on the
web. Does anyone know of a good reference?

Thanks,
Chris

Nov 19 '05 #1
21 2821
The Debug and Release directories are used by the Visual Studio IDE, to
place the respective assemblies from different builds in there. In your app,
you only need ONE: bin.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
I've got an ASP.NET website on my local box, set to compile to
bin\Debug and bin\Release in debug and release modes. Both directories
are populated with dlls, as the solution has been compiled in both
modes. When I browse to the local website, it works, but which set of
dlls is it using? What happens when I deploy to Test and there is only
a \bin\ directory, no \Debug or \Release?

I assume .NET has some path-searching rules that govern where it looks
for a website's binaries, but I've been unable to find these on the
web. Does anyone know of a good reference?

Thanks,
Chris

Nov 19 '05 #2
Correction - this actually doesn't work. After I deleting the contents
of the "temporary ASP.NET files" directory, the site no longer loads.

ASP.NET appears to be hard-coded to look for the dlls in the temporary
ASP.NET files folder and the approot\bin directory, and nowhere else.
There doesn't seem to be any support for different Debug and Release
dirs.

Nov 19 '05 #3
Right, but when you build from within the IDE, or choose Debug...Start,
it only puts the dlls in Debug or Release, it doesn't copy them to the
website's bin directory. So the site doesn't run, and you get a bunch
of misleading errors. Very buggy behavior on visual studio's part.

steps to reproduce:

Create a blank asp.net web project
Put some code in the default page
Change build locations to bin\Debug and bin\Release
Build the website in both modes
Try to browse to the website

Result - something similar to this:

Parser Error Message: Could not load type 'WebApplication2.Global'.
This happens because vstudio doesn't copy the dlls to \bin, and ASP.NET
doesn't look any deeper than \bin. The correct behavior, in my opinion,
is for vstudio to copy the most recently built dlls to the \bin folder
as part of the build process. Another nice feature would be if ASP.NET
followed some kind of search pattern down through bin to any subfolders
it found.

Hopefully this is fixed in Whidbey. (I'm using 2003). Can anybody test
2005 and see if this bug exists there?

Nov 19 '05 #4
When you build an asp.net application in release mode, it places the release
built assembly into the /bin directory.

When you build an asp.net application in debug mode, it places the debug
built assembly into the /bin directory.

If you assembly is large enough, you will see a size difference in the bin
directly whether you built from debug or release.

bill

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Correction - this actually doesn't work. After I deleting the contents
of the "temporary ASP.NET files" directory, the site no longer loads.

ASP.NET appears to be hard-coded to look for the dlls in the temporary
ASP.NET files folder and the approot\bin directory, and nowhere else.
There doesn't seem to be any support for different Debug and Release
dirs.

Nov 19 '05 #5
You're correct, if the default settings are used. But in the project
properties, you can change the build directory for each "mode". For
example, bin\Debug in Debug mode and bin\Release in release mode. If
you do that, the website won't run, and you get no clear indication of
why. See my reply to Kevin Spencer in this thread for steps to
reproduce.

Nov 19 '05 #6
I'm not sure which reply you posted in reply to my message, as you didn't
quote it. However, I can assure you that what I told you was true. I don't
use Visual Studio for deployment; it's really too simple to need it. I just
copy over the template files and the DLLs from my development machine to the
deployment server. When I do so, I copy whichever version of the DLLs I want
to deploy to the \bin folder of the app. Works perfectly every time.

Gotta love that XCopy deployment!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
You're correct, if the default settings are used. But in the project
properties, you can change the build directory for each "mode". For
example, bin\Debug in Debug mode and bin\Release in release mode. If
you do that, the website won't run, and you get no clear indication of
why. See my reply to Kevin Spencer in this thread for steps to
reproduce.

Nov 19 '05 #7
Kevin,

I was thinking he could just change his private probing path and it would
work. Is there a limitation to this for asp.net applications?

<runtime>
<assemblyBinding>
<probing privatePath="bin/Debug" />
</assemblyBinding>
</runtime>

bill
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e3**************@TK2MSFTNGP14.phx.gbl...
I'm not sure which reply you posted in reply to my message, as you didn't
quote it. However, I can assure you that what I told you was true. I don't
use Visual Studio for deployment; it's really too simple to need it. I just copy over the template files and the DLLs from my development machine to the deployment server. When I do so, I copy whichever version of the DLLs I want to deploy to the \bin folder of the app. Works perfectly every time.

Gotta love that XCopy deployment!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
You're correct, if the default settings are used. But in the project
properties, you can change the build directory for each "mode". For
example, bin\Debug in Debug mode and bin\Release in release mode. If
you do that, the website won't run, and you get no clear indication of
why. See my reply to Kevin Spencer in this thread for steps to
reproduce.


Nov 19 '05 #8
Hi William,

Yes, he could, but I don't see how it would help. Why would he want 2 sets
of code (Debug and Release) for 1 app? And if he only needs one, why use a
non-default location?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:O5**************@TK2MSFTNGP14.phx.gbl...
Kevin,

I was thinking he could just change his private probing path and it would
work. Is there a limitation to this for asp.net applications?

<runtime>
<assemblyBinding>
<probing privatePath="bin/Debug" />
</assemblyBinding>
</runtime>

bill
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e3**************@TK2MSFTNGP14.phx.gbl...
I'm not sure which reply you posted in reply to my message, as you didn't
quote it. However, I can assure you that what I told you was true. I
don't
use Visual Studio for deployment; it's really too simple to need it. I

just
copy over the template files and the DLLs from my development machine to

the
deployment server. When I do so, I copy whichever version of the DLLs I

want
to deploy to the \bin folder of the app. Works perfectly every time.

Gotta love that XCopy deployment!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
> You're correct, if the default settings are used. But in the project
> properties, you can change the build directory for each "mode". For
> example, bin\Debug in Debug mode and bin\Release in release mode. If
> you do that, the website won't run, and you get no clear indication of
> why. See my reply to Kevin Spencer in this thread for steps to
> reproduce.
>



Nov 19 '05 #9
Why would you want to change the default build locations?

I was thinking you could use

<runtime>
<assemblyBinding>
<probing privatePath="bin/Debug" />
</assemblyBinding>
</runtime>

to change the runtime assembly location, but for some reason I can't get it
to work.

I see your steps to reproduce, but it is not a bug. ASP.NET documentation
clearly states the assemblies should be located in the \bin directory under
the Application root. You can't take the wheels of the car and then be
upset at Ford that your car doesn't drive anymore.

It does give you an indication of why. It says it can't load type:
WebApplication2.Global. That means the type loader can't find the assembly
that contains the WebApplication2.Global type. Meaning it can't find the
assembly, because you have taken them from the directory they should be.

Again, what reason do you have for changing the debug/release build
locations?

bill

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
You're correct, if the default settings are used. But in the project
properties, you can change the build directory for each "mode". For
example, bin\Debug in Debug mode and bin\Release in release mode. If
you do that, the website won't run, and you get no clear indication of
why. See my reply to Kevin Spencer in this thread for steps to
reproduce.

Nov 19 '05 #10
Looks like a workaround.. I assume these settings are in
machine.config?

Nov 19 '05 #11
That is the main question I posed to him, why...

But I tried setting the privatePath on my machine and it never worked. I
renamed "bin" to "bin1" and added the privatePath="bin1". I only received
"could not load type" errors. I tried looking around and never came across
if it was even possible in an asp.net application. I did see plenty of
examples of windows forms applications, and it worked on my machine using
windows forms and console applications.

Thanks,

bill

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl...
Hi William,

Yes, he could, but I don't see how it would help. Why would he want 2 sets
of code (Debug and Release) for 1 app? And if he only needs one, why use a
non-default location?

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"William F. Robertson, Jr." <th****@nameht.org> wrote in message
news:O5**************@TK2MSFTNGP14.phx.gbl...
Kevin,

I was thinking he could just change his private probing path and it would work. Is there a limitation to this for asp.net applications?

<runtime>
<assemblyBinding>
<probing privatePath="bin/Debug" />
</assemblyBinding>
</runtime>

bill
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:e3**************@TK2MSFTNGP14.phx.gbl...
I'm not sure which reply you posted in reply to my message, as you didn't quote it. However, I can assure you that what I told you was true. I
don't
use Visual Studio for deployment; it's really too simple to need it. I

just
copy over the template files and the DLLs from my development machine to
the
deployment server. When I do so, I copy whichever version of the DLLs I

want
to deploy to the \bin folder of the app. Works perfectly every time.

Gotta love that XCopy deployment!

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
> You're correct, if the default settings are used. But in the project
> properties, you can change the build directory for each "mode". For
> example, bin\Debug in Debug mode and bin\Release in release mode. If
> you do that, the website won't run, and you get no clear indication

of > why. See my reply to Kevin Spencer in this thread for steps to
> reproduce.
>



Nov 19 '05 #12
These go in the .config file for your application, but I couldn't get it to
work on my machine for a web application, only a forms application or a
console app. But there really is no good reason for wanting to change this
default behavior of the IDE.

bill

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
Looks like a workaround.. I assume these settings are in
machine.config?

Nov 19 '05 #13
Not deployment, development. I use XCopy for deployment too.

What I'm talking about here is the Debug...Start New Instance command
in visual studio, used during development on the local machine. If you
change the output directories for the binaries, that command crashes
and the error doesn't explain why. The docs don't either.

If changing the output directory for a website breaks the website, why
is it allowed?
Here's a quote from the Help for the Project properties...Configuration
Properties...Output Path setting:

Output path
Specifies the directory in which output generated by the project should
be placed. For client-based projects, this can be any valid file or
Universal Naming Convention (UNC) path. **For Web-based projects, any
relative path within the project folder is allowed**. By default, this
is set to the Bin directory in the current project directory structure.
To access this property programmatically, see OutputPath Property.

Bug, missing feature, bad documentation.. whatever you want to call it,
this should be fixed in the next version of Studio.

Nov 19 '05 #14
>Again, what reason do you have for changing the
debug/release build locations?


I'd like to use the Debug versions in dev and test, and the release
versions in preprod and prod. I have an xcopy script that copies
everything out to the staging point. This gets run whenever a version
is ready for test. The server images for test, preprod and prod are all
created at the same time. What I want to be able to do is:

Compile in Debug mode
Compile in Release mode
XCopy everything to staging

This works fine for all the other projects in the solution, which have
Debug and Release folders. It won't work the same way for the web
sites. Based on the problem behavior described in this thread, I have
to pick either Debug or Release for the web sites. Plus, the whole
process becomes more fragile because it depends on which order the code
gets compiled in.. Debug..Release or Release..Debug. Which makes my
deployment instructions for other developers more complicated...

I can work around the problem, but I'm still curious if it's fixed in
2005. If not, maybe I'll submit it to MS.

Nov 19 '05 #15
Are they other projects referenced by your web application? If they are,
you can set the reference Copy Local to true. This will copy the assembly
into the bin directory, then all the release builds are in one location, and
the debug builds are in one location.

We deploy here similiarly to you.

Compile in Debug mode
Run debug xcopy script
--repeat until bugs are completely removed.

Compile in Release mode
Run release xcopy script.

By placing all the assemblies in the defaulted "bin" directory, you don't
have to worry about having difference build versions of assemblies floating
around all over your deployment. When you build in release mode, every
single release mode dll will be in one location.

On a side note, do you allow all your developers to push to
release/production?

bill

"Chris Durkin" <du*******@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Again, what reason do you have for changing the
debug/release build locations?


I'd like to use the Debug versions in dev and test, and the release
versions in preprod and prod. I have an xcopy script that copies
everything out to the staging point. This gets run whenever a version
is ready for test. The server images for test, preprod and prod are all
created at the same time. What I want to be able to do is:

Compile in Debug mode
Compile in Release mode
XCopy everything to staging

This works fine for all the other projects in the solution, which have
Debug and Release folders. It won't work the same way for the web
sites. Based on the problem behavior described in this thread, I have
to pick either Debug or Release for the web sites. Plus, the whole
process becomes more fragile because it depends on which order the code
gets compiled in.. Debug..Release or Release..Debug. Which makes my
deployment instructions for other developers more complicated...

I can work around the problem, but I'm still curious if it's fixed in
2005. If not, maybe I'll submit it to MS.

Nov 19 '05 #16
On 17 Feb 2005 13:07:34 -0800, "Chris Durkin" <du*******@hotmail.com>
wrote:
Again, what reason do you have for changing the
debug/release build locations?


I'd like to use the Debug versions in dev and test, and the release
versions in preprod and prod. I have an xcopy script that copies
everything out to the staging point. This gets run whenever a version
is ready for test. The server images for test, preprod and prod are all
created at the same time. What I want to be able to do is:


What's missing with a release mode build that you can't use release
builds in test?

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #17
The debug versions have .PDBs and show line numbers in the stack trace
if an exception occurs.

Nov 19 '05 #18
>Are they other projects referenced by your web application?
If they are, you can set the reference Copy Local to true.
This will copy the assembly into the bin directory, then all the
release builds are in one location, and the debug builds are
in one location.
We are using the copy local feature, which helps.. The solution is more
complex than just one web site.. a couple of websites, some windows
services, a Forms EXE, all referencing a bunch of common dlls.
Different "things" get deployed to different servers. What I want is a
Debug and Release copy of each "thing", which would include it and all
the dlls it references.

My workaround for the websites will be something like this:

use \bin\ for Debug mode
use \bin\Release for release mode
document the fact that the websites always use Debug code in dev

That way I can preserve the current methdology of running the deploy
scripts only once for each release candidate.
On a side note, do you allow all your developers to push to
release/production?


Yes, we can all push code up. No buildmaster. I don't allow or
disallow, I'm just a lowly contractor ;)

Nov 19 '05 #19
You can have PDBs and stack traces with line numbers in release builds
too:

Project -> Properties -> Configuration Properties -> Build -> Generate
Debugging Information.

http://odetocode.com/Blogs/scott/arc...01/24/963.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 17 Feb 2005 14:38:03 -0800, "Chris Durkin" <du*******@hotmail.com>
wrote:
The debug versions have .PDBs and show line numbers in the stack trace
if an exception occurs.


Nov 19 '05 #20
True, you can set Release mode to include all the debug settings, but
then it isn't really Release mode, is it? Kind of defeats the purpose.
Debug mode has several useful features.. line #s, ability to attach to
a process, trace flags, etc.. but that stuff is for debugging, not
production code.

Scott Allen wrote:
You can have PDBs and stack traces with line numbers in release builds too:

Project -> Properties -> Configuration Properties -> Build -> Generate Debugging Information.

http://odetocode.com/Blogs/scott/arc...01/24/963.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 17 Feb 2005 14:38:03 -0800, "Chris Durkin" <du*******@hotmail.com>
wrote:
The debug versions have .PDBs and show line numbers in the stack traceif an exception occurs.


Nov 19 '05 #21
Yes - I'd say it really is release mode - optimizations and all.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 18 Feb 2005 12:20:06 -0800, "Chris Durkin" <du*******@hotmail.com>
wrote:
True, you can set Release mode to include all the debug settings, but
then it isn't really Release mode, is it? Kind of defeats the purpose.
Debug mode has several useful features.. line #s, ability to attach to
a process, trace flags, etc.. but that stuff is for debugging, not
production code.

Scott Allen wrote:
You can have PDBs and stack traces with line numbers in release

builds
too:

Project -> Properties -> Configuration Properties -> Build ->

Generate
Debugging Information.

http://odetocode.com/Blogs/scott/arc...01/24/963.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 17 Feb 2005 14:38:03 -0800, "Chris Durkin" <du*******@hotmail.com>
wrote:
>The debug versions have .PDBs and show line numbers in the stacktrace >if an exception occurs.


Nov 19 '05 #22

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

Similar topics

4
by: Kelly E | last post by:
Here's my function. I keep getting 'Object not set to an instance of an object when I call myDR.Read. (I'm using the Application Data blocks v1). I have similar routines throughout this project...
16
by: LP | last post by:
Hi, Considering code below. Will it make GC to actually collect. One application creates new instances of a class from 3rd party assembly in a loop (it has to). That class doesn't have .Dispose or...
5
by: Jim | last post by:
Hello, I am writing an application to list all the sites viewed via internet explorer and have created the following routine to read the history files to a temporary file which is then used by...
16
by: Daniel | last post by:
Hi Group, Why does the below code not generate an error? I have a table with x number of records. Each record is read from the DB into a hashtable. Then I add to the hashtable additional keys....
3
by: kai | last post by:
Hi, Base on MSDN help, in VS2005 IDE, select "Tools -> Code Snippets Manager", but I cannot find "Code Snippets Manager" under "Tools" menu. Also I noticed when I insert snippets in C#, it has...
7
by: Bo Yang | last post by:
Hi , I am reading some boost code now , and I got confused by the following code in the add_reference type trait . template <class TT&(* is_reference_helper1(wrap<T>) )(wrap<T>); char...
0
by: rn5a | last post by:
A custom server control containing a Button inherits from the WebControl class. I want to give users the option to change the BackColor of the Button. If this is the code in the ASPX page that uses...
1
by: locy | last post by:
can someone explain to me "what does this code do" class baseclass { public: virtual void runme() { std::cout<<"are you"<<std::endl; }
3
by: xmail123 | last post by:
Why does this code work? I am new to C# and have been studying this piece of code. It loops through an Adjacency Matrix table to populate a tree view. I have two questions about why this code...
3
by: qianz99 | last post by:
Hi I am not sure what this code does. I have the following questions 1. where is the case? 2. #define TLV_INTEGER(name, octets) p->name = -1; Is it define a function TLV_INTEGER(name, octets) ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.