views:

373

answers:

2

We have Asp.net .aspx and MVC Co-existing project, Codebehind/Codefile are still existing inside .aspx files after project published, it needes a lot of effort to get rid of these after deployment: we have to manually change every .aspx file

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/xxx.master" 
AutoEventWireup="true" Inherits="xxx.Login" Codebehind="Default.aspx.cs" %>

To

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/xxx.master" 
AutoEventWireup="true" Inherits="xxx.Login"  %>

it is ton of work to do that anyone can help? Thanks

A: 

You don't need to remove the Codebehind attribute from your ASPX files. You just deploy them without .CS files. The classes specified in the Codebehind are compiled in to the assembly and are available after the assembly gets deployed (which you do always).

Dmytrii Nagirniak
if the codebehind/codefile attribute not been removed, the web page generated an error when request to the page, after manually remove it, it works, so this attribute should be remvoed somehow.ThanksSimon
A: 

Even i face this problem in my Dynamic Data website. It compiles the application and i got the dlls in bin but the Page directive in aspx stills holds codebehind attribute pointing to the original .aspx.cs file(even though the published files does not have .aspx.cs files).

I am rite now manually rmeoving this attribute in Page directive in all pages. I tried "Web deployment plugin too but still no luck!

Satheesh