Deployment of source code?

S

Scott M.

I thought I understood this, but I guess not.

In ASP .NET 3.5, using VS 2008 Pro. and working with Web Applicaiton
Projects (NOT WEB SITES) that use the code-behind model, I was under the
impression that deployment of the .aspx files and the pre-compiled .dll in
the /bin folder was all that is needed. As far as I can remember, this is
what I've been doing since ASP.NET's inception.

But, now I've switched hosting providers and am starting fresh by uploading
only the files needed for the site to function. I've built my project in
release mode and used the Publish feature with "Only files needed to run this
applicaiton" selection turned on. As expected, only my .aspx, web.config,
global.asax, and /bin directory (with my compiled .dll in it) are deployed.
But, now I'm getting errors when I try to access the .aspx pages that say
that the referenced CodeFile cannot be found.

Again, to be clear, I'm NOT using Web Site, this is an ASP.NET Web
Application Project that is built locally and I just want to deploy the .aspx
pages but not the source code. I'm sure this is what I've done in the past.

I've tried taking the CodeFile="" portion out of the @Page directive line,
but then I get an error saying that an instance of that page's class could
not be made.

What gives?
 
G

Gregory A. Beamer

Scott M. said:
I thought I understood this, but I guess not.

In ASP .NET 3.5, using VS 2008 Pro. and working with Web Applicaiton
Projects (NOT WEB SITES) that use the code-behind model, I was under the
impression that deployment of the .aspx files and the pre-compiled .dll in
the /bin folder was all that is needed. As far as I can remember, this is
what I've been doing since ASP.NET's inception.

But, now I've switched hosting providers and am starting fresh by
uploading
only the files needed for the site to function. I've built my project in
release mode and used the Publish feature with "Only files needed to run
this
applicaiton" selection turned on. As expected, only my .aspx, web.config,
global.asax, and /bin directory (with my compiled .dll in it) are
deployed.
But, now I'm getting errors when I try to access the .aspx pages that say
that the referenced CodeFile cannot be found.

Again, to be clear, I'm NOT using Web Site, this is an ASP.NET Web
Application Project that is built locally and I just want to deploy the
.aspx
pages but not the source code. I'm sure this is what I've done in the
past.

I've tried taking the CodeFile="" portion out of the @Page directive line,
but then I get an error saying that an instance of that page's class could
not be made.

What gives?

What gives? Without the page class, you only have a partial class that is
the tags being rendered. So, without an actual class definition, it screams
at you.

To deploy without source, right click on the web project and choose publish.
Then choose a folder to publish to. You can then deploy the compiled
solution from that point. It will compile the code into DLLs and NOT include
the code behind files.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************
 
S

Scott M.

Gregory A. Beamer said:
What gives? Without the page class, you only have a partial class that is
the tags being rendered. So, without an actual class definition, it screams
at you.

To deploy without source, right click on the web project and choose publish.
Then choose a folder to publish to. You can then deploy the compiled
solution from that point. It will compile the code into DLLs and NOT include
the code behind files.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************

Unfortunately, the Publish option doesn't work as you describe.

I get that there are partial classes and that not deloying the .vb codefile
means that part of the class definition is missing, but that shouldn't matter
if I'm deploying my application assembly (.dll) because the entire class
definition is in that.

When I choose Publish and select "Only files needed to run the application"
the published files do not include source code files (as I expect and want),
but when you try to call one of the .aspx files, I get a message saying that
the codefile cannot be found.

I've tracked this down to the change from the older "CodeBehind" attribute
to the new CodeFile attribute. It seems that when working with the
codebehind model, but utilizing the "CodeFile" attribute, source code MUST be
deployed along with the other files, but if you put all your code back into
one code-behind, remove the "partial" keyword, and change "CodeFile" to
"CodeBehind" that you can deploy just the .aspx pages and the assembly in the
/bin folder.

-Scott
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top