Solved

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

Posted on 2010-08-17
9
824 Views
Last Modified: 2013-11-27
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
Comment
Question by:conrad2010
  • 5
  • 4
9 Comments
 
LVL 16

Expert Comment

by:13598
ID: 33459445
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
 

Author Comment

by:conrad2010
ID: 33459521
@13598:

when I do that, that directory will compile... I want to prevent it from compiling but send it to the production server...
0
 
LVL 16

Expert Comment

by:13598
ID: 33466389
Exclude from Project compiles it? Did you clear it (delete the directory) before you changed it to exclude ?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 16

Expert Comment

by:13598
ID: 33466644
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
 

Author Comment

by:conrad2010
ID: 33466711
@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
 

Author Comment

by:conrad2010
ID: 33466715
I know I could simply FTP it, but I want to try a "one button push" solution
0
 
LVL 16

Accepted Solution

by:
13598 earned 500 total points
ID: 33466837
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
 
LVL 16

Assisted Solution

by:13598
13598 earned 500 total points
ID: 33466860
0
 

Author Closing Comment

by:conrad2010
ID: 33467002
Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question