Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6210429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:09:27+00:00 2026-05-24T06:09:27+00:00

I am using the _bin_deployableAssemblies folder to copy over the ASP.NET MVC assemblies to

  • 0

I am using the _bin_deployableAssemblies folder to copy over the ASP.NET MVC assemblies to the bin folder after each build. Unfortunately the MSBuild task also copies the hidden .svn folder.

First attempt to fix

I want to solve this at a project level, so I have added a RemoveDir task to the AfterBuild target in the .csproj file, which works for normal builds.

<RemoveDir Directories="@(OutDir).svn" />

But it doesn’t seem to work when I publish the site. After publishing the .svn folder is copied to the destination folder of the publish wizard. And strangely it also ends up in the /bin folder in the project, despite the RemoveDir task!

In the targets file C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets an item group is created dynamically to include all files in the folder _bin_deployableAssemblies:

<CreateItem Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*" 
            Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
    <Output ItemName="_binDeployableAssemblies" TaskParameter="Include"/>
</CreateItem>

Using a Message task in the AfterBuild target I can see that this item group included all files in the .svn folder.

Second attempt to fix

So I tried the following trick to adjust the item group in the .AfterBuild target:

<ItemGroup>
    <_binDeployableAssemblies Remove="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\.svn\**\*.*" />
</ItemGroup>

If I print the list of files after that using a Message task I can see that it no longer includes the files in the .svn folder. But, the .svn files are still copied to the output folder when building or publishing!

Possible actual fix

It seems that the Publish command first does a regular build, at which point we can remove the files using the AfterBuild target. But then it is going to copy files to a temporary location (in the /obj folder) in order to publish them. During this phase it seems that it copies everything from _bin_deployableAssemblies over to bin again and only then copies bin (and other project files) to the temporary location. This seems to happen after AfterBuild.

So the trick might be to hook into the process somewhere before the project files are copied to the temporary folder. Or afterwards, but then not only the temporary folder needs to be cleaned, but also the original bin folder, for the second time. This may be possible by hooking into one of the many DependsOn targets.

If there is no suitable target to do this, then perhaps removing the files from some intermediary item group could be a solution so they never actually get copied or published.

I have not been able to achieve either of these possible fixes due to a lack of understanding of the Publish process.

Main question

How can I either prevent the files from being copied or remove the files after they are copied? How can I do this for both regular builds and the publish command?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:09:28+00:00Added an answer on May 24, 2026 at 6:09 am

    Add this to your .csproj file (or the {projectName}.wpp.targets file):

      <PropertyGroup>
        <OnAfterCopyAllFilesToSingleFolderForPackage>
          __RemoveSvnFromPackageTemp
        </OnAfterCopyAllFilesToSingleFolderForPackage>
      </PropertyGroup>
    
      <Target Name="__RemoveSvnFromBin" AfterTargets="_CopyBinDeployableAssemblies">
        <Message Text="Removing .SVN from BIN" Importance="normal"/>
        <RemoveDir Directories="$(OutDir).svn" />
      </Target>
    
      <Target Name="__RemoveSvnFromPackageTemp">
        <Message Text="Removing .SVN from PackageTempDir" Importance="normal"/>
        <RemoveDir Directories="$(_PackageTempDir)\bin\.svn" />
      </Target>
    

    That works for Build, Package, and Publish!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC there are situations (such as form submission) that may require a
Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies): using Facebook; var app
Hi how do i publish the files from my bin folder using clickonce? i
The system I am using has gnuplot installed in /usr/bin . I don't have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
I am using /bin/tcsh as my default shell. However, the tcsh style command os.system('setenv
We are using TeamCity 5.0 to build a C# solution using the sln2008 build
JS Bin demo Task: I'm creating an event scheduler using jQuery UI. Events are
Im using python markdown for my django project, when i have the value #/usr/bin/env

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.