Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 131 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS Visual Studio: How to exclude certain Project Folders from publishing?

#1
I have certain folders which I want to keep in the project but not to include it in publishing.

Is that possible?
Reply

#2
Another way you can do is you can hide folders in windows explorer that are not needed to be get published(not the best solution but works if you have large set of images that still need to be in development box).
Reply

#3
If it is a web-site project, you may exclude certain folders and/or files as follows (*see elements **ExcludeFoldersFromDeployment** and **ExcludeFilesFromDeployment***):

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit

[To see links please register here]

.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>D:\YAZILIM\Adopen.2015\PreCompiledWeb</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>AdoIntranet</SingleAssemblyName>
<ExcludeFoldersFromDeployment>customobjects;uploads</ExcludeFoldersFromDeployment>
<ExcludeFilesFromDeployment>app.config</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
Reply

#4
You can do a 'Find & Replace' in the Web.cspoj file to quickly eliminate a particular folder from the **publish/deployment** process

Like so;

<Content Include="Uploads/

to

<None Include="Uploads/
Reply

#5
As the question is tagged with ASP, there is no `.proj` file to mess with. With VS2015, there is another useful file instead: `website.publishproj`. And [this Asp.Net article on excluding files and folders][1] mentions the `.wpp.targets` file.

All of these files contain `<ItemGroup>` elements, that may have elements like `<ExcludeFromPackageFolders>`. As these seem documented features, just use them and don't feel guilty for hacking or 'messing'. For me, excluding a directory using the simple instructions of that link and the `website.publishproj` file worked like a charm!


[1]:

[To see links please register here]

Reply

#6
[Michael] is totally right, through editing the .csproj file you can manually exclude files/folder from being published.

One easier way if you don't want to mess with the .csproj file is to highlight the file(s) inside the VS solution explorer. Under the properties panel, change build to action from 'content' to 'none'.

This way you don't have to unload the project from the solution, load the .csproj and add a line for each new file you add that doesn't need to be published but instead achieve the same with 3 mouse-clicks.

(assuming you've set the 'Only publish files needed to run this application' under the publishing tab)

[Michael]:

[To see links please register here]

Reply

#7
- Unload Project,
- Right click Edit *.csproj,
- Add this:

> <ItemGroup>
> <Content Update="Data\CernainFolder\*.*">
> <CopyToPublishDirectory>Never</CopyToPublishDirectory>
> </Content>
> </ItemGroup>

- Reload Project.

This should work nicely
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through