[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 833
  • Last Modified:

ASP.NET Exclude directory from "Build", but include in "Publish"

I have a MVC application with one directory with aspx pages and I am trying to accomplish the following:

- Exclude that directory during "Build" (compile)

- Include the directory after "Publishing"

(or use a script/macro to copy it manually or something like that)

Any ideas on how to do that?
0
conrad2010
Asked:
conrad2010
  • 5
  • 4
2 Solutions
 
13598Commented:
You could try on the solution explorer tree right-clicking on the folder and select Exclude from project while you are debugging.
Before publishing right-click again and select Include in Project.
0
 
conrad2010Author Commented:
@13598:

when I do that, that directory will compile... I want to prevent it from compiling but send it to the production server...
0
 
13598Commented:
Exclude from Project compiles it? Did you clear it (delete the directory) before you changed it to exclude ?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
13598Commented:
Also what is the reason to exclude it during debug?
You can specify a different folder to compile it to during debug than release so you wouldn't have to worry about it after you change your configuration to release and rebuild it.
Under your Project Properties/Compile tab/Build Output Path you can enter something like bin\debug for your debug configuration and leave it as just \bin for your release configuration.
0
 
conrad2010Author Commented:
@13598:

the main project is MVC, but there is a "promo" directory with html, asp and aspx where the aspx cannot be compiled with the MVC (it breaks)...

so I'm trying to "exclude" the folder when compiling, but still include it when publishing to the production server

I've looked into post-build events but I'm not clear on how to include the folder after compiling
0
 
conrad2010Author Commented:
I know I could simply FTP it, but I want to try a "one button push" solution
0
 
13598Commented:
Take a look at this:
http://stackoverflow.com/questions/699610/adding-to-built-in-excludefrombuild-itemgroup-with-web-deployment-project
And this:

MSBuild has a special syntax for recursing "**\", here is an example:
<ItemGroup>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.resx"/>
</ItemGroup>
 
0
 
conrad2010Author Commented:
Thanks!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now