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
(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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With