WAP Publish Question - CodeFile included in publish

Last post 07-09-2009 3:47 AM by Thomas Sun – MSFT. 6 replies.

Sort Posts:

  • WAP Publish Question - CodeFile included in publish

    07-06-2009, 6:21 AM
    • Member
      5 point Member
    • anjenkin84
    • Member since 06-01-2007, 3:30 PM
    • UK, Cornwall
    • Posts 20

    I am using a Web Application Project to develop some web user controls (c#).

    In the WAP the user control directive contains the codefile and inherits attributes.

    When I publish the WAP to the target website. The dll from bin is copied correctly to the bin of the website, the user controls (.ascx files) are copied correctly.

    When I perform a build on the website, I get errors as the ascx files still contain the codefile attribute in the directive. To resolve this I simply remove the codefile attribute and the ascx still works as the code is picked up through the inherits (which is now in the dll).

    My question is - can the publish automatically remove the codefile attribute for me. or.. am I using WAP / Build / Publish incorrectly?

    Many Thanks, Adam

  • Re: WAP Publish Question - CodeFile included in publish

    07-07-2009, 9:00 AM
    • Star
      8,662 point Star
    • satalaj
    • Member since 11-28-2007, 12:41 AM
    • Pune
    • Posts 1,712

    Have you added those directive manually at the time of designing user controls ?

  • Re: WAP Publish Question - CodeFile included in publish

    07-07-2009, 9:15 AM
    • Member
      5 point Member
    • anjenkin84
    • Member since 06-01-2007, 3:30 PM
    • UK, Cornwall
    • Posts 20

    No, when I add a new user control it is automatically created with codebehind and inherits attributes.

    I have read that codebehind should read as codefile so I have manually changed this.

  • Re: WAP Publish Question - CodeFile included in publish

    07-07-2009, 9:31 AM
    • Star
      8,662 point Star
    • satalaj
    • Member since 11-28-2007, 12:41 AM
    • Pune
    • Posts 1,712

    What happen when if you don't change it manually?

  • Re: WAP Publish Question - CodeFile included in publish

    07-07-2009, 10:47 AM
    • Member
      5 point Member
    • anjenkin84
    • Member since 06-01-2007, 3:30 PM
    • UK, Cornwall
    • Posts 20

    If I leave it as CodeBehind, the attribute is still present in the published user control on the target website, howerver in this instance the user control builds on the target site successfully, and only contains a warning instead of an error.

    Is this correct, or should the attribute have been removed? 

  • Re: WAP Publish Question - CodeFile included in publish

    07-07-2009, 11:22 AM
    • Star
      8,662 point Star
    • satalaj
    • Member since 11-28-2007, 12:41 AM
    • Pune
    • Posts 1,712

    Can you post that warning here. or google / bing about it  and see how harmful it is to your application.

  • Re: WAP Publish Question - CodeFile included in publish

    07-09-2009, 3:47 AM
    Answer

     Hi,

    After we use Publish feature to publish ASP.NET web application, we can remove the "CodeFile" from Page directive, instead, ASP.NET uses Inherits to load assembly.

    In ASP.NET Website project, the compiler will remove CodeFile attribute and change the Inherits attribute to include the assembly name.

    You also can try to disable “allow this precompiled site to be updatable” while precompiling website. By doing this, the .aspx page just is the placeholder.

    Thanks.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (7 items)
Microsoft Communities