• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 836
  • 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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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