Can't get ExcludeFromBuild to work.... RRS feed

  • Question

  • User-1502422837 posted

    I have VS 2005 Professional Edition and Microsoft Web Deployment Projects 2005 installed.  I have a solution that consists of two web sites, some class libraries, and some aspx, ascx files that should not be compiled when I build the solution.  I'm not going to go into detail why the aspx and ascx files should be compiled, because that would make this post longer than I want it to be, and I want to keep this post as short as possible.  I tried to exclude the folder that contains the ascx and aspx files by adding the ExcludeFromBuild node to the wdproj file as follows:

        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>



        <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Security\**\*.*"/>


     Security is the folder that contains all the aspx and ascx files I want excluded from the build (actually, "Security" contains a number of folders, some nested, which contain that ascx, aspx files -- hence the \**\ to indicate nested folders.   I verified that $(SourceWebPhysicalPath) is correct by looking at the SourceWebPhysicalPath node at the top of the wdproj file.

    The problem is that I cannot get this to work.  The compiler still tries to include the files I want excluded from the build.  VS 2005 thus barfs and generates a bunch of compiler errors related to the ascx and aspx files, which I want excluded from the build, and which I tried to do.

     I could theoretically manually select each file I want excluded in the solution explorer, right-click and select "Exclude from project," but as there are 100+ files, this would be a major pain in the a**.  I'd really like to simplify this by using the <ExcludeFromBuild> node, but am getting really frustrated because I cannot get this to work, and I'm sure I'm following the instructions provided by Microsoft.

    Wednesday, January 16, 2008 11:09 AM

All replies

  • User-1502422837 posted

    OK, looks like you can only do this for web applications, NOT web sites.  I just tried it for a web application and it worked fine.

    Friday, January 18, 2008 4:16 PM
  • User-613285958 posted

    I have a WDP that I cannot compile. It needs to use the IIS metabase Path to find some include files. However, I also have RadControls virtual directory and I need to exclude it. If I exclude the directory via "ExcludeFromBuild" then compile produces an error of "The MetabasePath parameter cannot be combined with VirtualPath or PhysicalPath.

    Is the error related to using both metabasepathth and excludefrombuild? If so, is this a Catch22 situation or is there a solution?

    Tuesday, February 5, 2008 10:22 AM
  • User-613285958 posted

    I solved my problem. Was due to the way I was handling some include files left over from pre-aspx days in a migrated application.

    Tuesday, February 5, 2008 2:26 PM
  • User1447247935 posted
    Joe can you expand upon how you fixed this issue? I've been trying to workout the same error for several hours now.
    Thursday, April 9, 2009 11:53 AM
  • User-613285958 posted

    puterart, wish I could help but my issue was over a year ago and I can't even recall the exact problem, much less what I did to solve it. [:)]

    Thursday, April 9, 2009 12:40 PM
  • User1447247935 posted

     Haha, understandable. The weird thing is my entire deployment project builds but craps out when I add an <ExcludeFromBuild Include="$(SourceWebVirtualPath)/web.config" /> or any excludefrombuild tag into the ItemGroup. Any ideas?

    Thursday, April 9, 2009 2:37 PM