Why deployment server needs cs files?

J

John Dalberg

I have a few user controls in ascx files. I copied these files to the
deployment server. However the server gives error message that the code
behind (cs) are missing. I thought all cs files are compiled in the dll.

The web pages work if I copied the cs files. Why do I need to copy them
over?

John Dalberg
 
T

Thomas Hansen

I have a few user controls in ascx files. I copied these files to the
deployment server. However the server gives error message that the code
behind (cs) are missing. I thought all cs files are compiled in the dll.

The web pages work if I copied the cs files. Why do I need to copy them
over?

You should (I assume you're using Visual Studio 2005 here)
Right Click your Web Project and choose "Build deployment" (or release
or something)
Then you get to choose a folder where you'r web site will appear in a
BUILT version.
Browse to that folder and COPY that content into the Virtual Directory
of your web server on your server environment and
you should have a working website!

If you copy the .cs files and does it the way you're doing it the site
will run a houndrer times SLOWER since you're not taking advantage of
the precompilation options in Asp.Net 2.0...

..t
 
L

Laurent Bugnion [MVP]

Hi,

John said:
I have a few user controls in ascx files. I copied these files to the
deployment server. However the server gives error message that the code
behind (cs) are missing. I thought all cs files are compiled in the dll.

The web pages work if I copied the cs files. Why do I need to copy them
over?

John Dalberg

The deployment model changed in 2.0. You know have three options:

- Copy the ASCX, ASPX, ASMX files and also the CS files to the server.
The code-behind will be compiled on demand. This can be interesting for
web sites where parts of the site change often. This avoids recompiling
the whole site. Note that the code is protected because (normally), the
ASP.NET server refuses to serve code files.

- Publish the site using the "Build / Publish" menu. This precompiles
the website, and then deploys only the files needed to the web server.

- Use the web application project (WAP) template for VS2005. It's the
best suited model for web applications (as opposed to websites), but
it's also great for websites IMHO. It is closer to the 1.1 model, and
you have full control on the assembly, and on what gets published.

The WAP can be installed from here:
http://webproject.scottgu.com/

However, the WAP is included in VS2005 SP1, so you must uninstall it
before you install the SP1.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top