Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there way to exclude an entire folder(s) when publishing a site?

i want to have test pages in a folder called "tests" and be able to run the pages during debug but when i publish the application it excludes those files. Im using Asp. Net 3.5, Windows Server 2008, and c# Vs 2010

like image 686
Letseatlunch Avatar asked Dec 12 '10 03:12

Letseatlunch


People also ask

How do I exclude files from a folder?

(2) Go to the "Settings" tab and Click "Exclude files and locations". Then, click "Browse". (3) Here, at this step, you can use either a file or a folder. Select a file or a folder and click OK.

How do I get excluded files in Visual Studio?

In Visual Studio, right-click on the file to be excluded from build, choose Properties, Configuration Properties -> General -> Excluded From Build -> Yes -> OK. In Eclipse, right-click on the file to be excluded from build, choose Properties, C/C++ Build -> Excluded from build -> OK.

How do I publish a solution in Visual Studio 2019?

To publish your app from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.


1 Answers

You could either exclude it from the project, which isn't really ideal, or you could use a post-build event script that would remove the folder you don't want published. Alternatively, you could try adding something like this to your project file:

  <itemgroup>
    <excludefrombuild Include="$(SourceWebPhysicalPath)\obj\**\*.*"/>
    <excludefrombuild Include="$(SourceWebPhysicalPath)\Properties\**\*.*"/>
    <excludefrombuild Include="$(SourceWebPhysicalPath)\**\*.csproj*"/>
    <excludefrombuild Include="$(SourceWebPhysicalPath)\**\*.resx"/>
    <excludefrombuild Include="$(SourceWebPhysicalPath)\**\*.Publish.xml"/>
  </itemgroup>

Take a look here for more information on this:

http://blogs.msdn.com/b/webdevtools/archive/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-application-s-project-file.aspx

like image 104
Tyler Treat Avatar answered Oct 24 '22 22:10

Tyler Treat