question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Excluding folder contents from publish

See original GitHub issue

Publishing from Visual studio to IIS server on Windows Server 2012 R2

In .csproj:

<ItemGroup>
   <Content Include="wwwroot\LicenceFiles" CopyToPublishDirectory="Never" />
</ItemGroup>

Expected behavior

For the contents of this directory not to be published

Actual behavior

The directory contents are being added to the server when publishing

Is there another way in core to stop folders from being published? Specifically, this is a folder that I am writing generated PDF files to. Obviously I don’t want to be pushing up any of the files that have been generated in development, so want to retain the folder on the server but just not sync any content.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
vijayrkncommented, Mar 13, 2017

@ralphking I just tried this on VS 2017 RTW and seems to be working. It is excluding all the files (including sub directories) from wwwroot\images

  <ItemGroup>
    <Content Update="wwwroot\images\**\*.*" CopyToPublishDirectory="Never" />
  </ItemGroup>

If you are publishing from VS, please make sure to check this so that if the files are already present, they will be removed as well.

image

3reactions
livarcocccommented, Mar 6, 2017

Please use

<ItemGroup>
   <Content Update="wwwroot\LicenceFiles" CopyToPublishDirectory="Never" />
</ItemGroup>

The Web SDK (assuming that’s what you are using) is including these files for you already. So you need to update the files’ metadata to prevent them from being published.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MS Visual Studio: How to exclude certain Project Folders ...
I have certain folders which I want to keep in the project but not to include it in publishing. Is that possible? ......
Read more >
Excluding Files and Folders from Deployment
In the Solution Explorer window, right-click the file, and then click Properties. · In the Properties window, in the Build Action row, select ......
Read more >
dotnet/sdk - Excluding folder contents from publish #7861
Is there another way in core to stop folders from being published? Specifically, this is a folder that I am writing generated PDF...
Read more >
Excluding Files and Folders in Visual Studio Web Site Project
Publish profiles now seem to be located under Project Properties (the little wrench icon, not the Properties page). Took 4-eva to find em,...
Read more >
Exclude folder from publish to Orchestrator - Help
Exclude folder from publish to Orchestrator ... Hi,. Is there a way to exclude certain files/folders from being part of the Publish feature?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found