42

I'm trying to publish an ASP.NET project in VS2010, and am getting the following error:

Copying file bin\CKFinder.pdb to obj\Release\Package\PackageTmp\bin\CKFinder.pdb failed. Could not find file 'bin\CKFinder.pdb'.

I had tried using a trial version of CKFinder (with CKEditor), but I backed it out. I removed all references to CKFinder, including the folders and the references - or so I thought.

Why is this error coming up? Ideas?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Ray K.
  • 2,431
  • 3
  • 25
  • 39
  • 2
    Update: I went into Project --> Package/Publish Settings, and clicked "Exclude generated debug symbols." The project is now publishing as I write this. – Ray K. May 22 '12 at 16:17
  • Does this answer your question? [Error Copying file bin\EntityFramework.SqlServer.xml to ..\bin\EntityFramework.SqlServer.xml failed](https://stackoverflow.com/questions/22388119/errorcopying-file-bin-entityframework-sqlserver-xml-to-bin-entityframework-s) – TylerH Jan 20 '23 at 22:19

13 Answers13

47

I also bumped to this problem. I was receiving the following error, when trying to publish MVCForum 1.7:

Copying file App_Data\NuGetBackup\Hello.txt to obj\Release\Package\PackageTmp\App_Data\NuGetBackup\Hello.txt failed. Could not find file 'App_Data\NuGetBackup\Hello.txt'.

François Breton's comment helped me achieve the solution.

It's simple:

Open your .csproj file with a text editor (Notepad, Notepad++) Visual Studio will open it as a project.

Press Ctrl + F and search for the file of the problem. In my case the file was "Hello.txt" without commas.

Under the <ItemGroup> it resided:

<ItemGroup>
<Content Include="App_Data\NuGetBackup\Hello.txt" />
<Content Include="Content\admin\Admin.css">
    <DependentUpon>Admin.scss</DependentUpon>
</Content>
...More code omitted due to brevity.

I deleted the <Content Include="App_Data\NuGetBackup\Hello.txt" /> line, and voila! Visual Studio allowed me to Preview before publishing!

It will end like this:

<ItemGroup>
<Content Include="Content\admin\Admin.css">
    <DependentUpon>Admin.scss</DependentUpon>
</Content>
...More code omitted due to brevity.
Arulkumar
  • 12,966
  • 14
  • 47
  • 68
Jose A
  • 10,053
  • 11
  • 75
  • 108
13

Update: I went into Project --> Package/Publish Settings, and clicked "Exclude generated debug symbols." The project began publishing with no issue.

Update #2 (this is probably the better answer): I tried to publish as debug instead of release (yes, I wanted to keep the debug features in this particular release), and the error came up again. It turned out that I did not exclude the CKfinder.dll from the project. Once I did so, it ran with no problem.

Ray K.
  • 2,431
  • 3
  • 25
  • 39
  • 1
    not me... Error 1 Copying file Views\Default1\Index.cshtml to obj\Release\Package\PackageTmp\Views\Default1\Index.cshtml failed. Could not find file 'Views\Default1\Index.cshtml'. In VS2012 Express ! – François Breton Feb 13 '13 at 15:09
  • 6
    Dah ! The files aren't in the folder but just in the .proj. SubVersion Commit fail ! – François Breton Feb 13 '13 at 15:12
  • 7
    Francois Breton comment proved helpful for me. I had removed a reference to a dll, but TFS did not reflect the same. I had to go and edit my Project.csproj file and remove the reference. Save it on disk , VS asked to reload project. Now publishing okay – Vishnoo Rath Nov 07 '13 at 12:33
  • @FrançoisBreton thanks man,your comment helped me after wasting 30 mins on web . – Shekhar Pankaj Oct 27 '15 at 15:09
13

Me just removed yellow marked file from my visual studio solution & it worked greatly for me because files were added and removed many times from folders but its not removed from VS solution project.

Anjan Kant
  • 4,090
  • 41
  • 39
10

Delete file showing exclamation mark in the solution explorer. It worked for me

Solution explorer with file

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Murugan
  • 615
  • 5
  • 19
6

I ran into same problem, i just clicked show all files, and deleted the files that had exclamation mark with them. Hope this helps someone.

Abdullah
  • 307
  • 2
  • 6
  • 16
3

Right click on your project => unload project => right click again on your newly unloaded project => edit 'myProject.csproj' => Search for the offending files (CTRL + F) and remove.

If the error appears again within the same parent directory, but now under a different file name, it could be that a user has mistakenly included a file in the project (like I did). All files under the offending directory can be removed. This should solve the problem.

Developer Guy
  • 2,318
  • 6
  • 19
  • 37
PontiusTheBarbarian
  • 1,004
  • 9
  • 17
3

You must exclude bin folder from project, then republish your project. the way can solve my problem

2

In my case I got a similar error but with .cshtml files like this:

copying to Views\Home\About.cshtml to obj\Release\Package\PackageTmp\Views\Home\About.cshtml failed. Could not find file 'Views\Home\About.cshtml'

Looking at the Solution Explorer tree everything seemed fine with no yellow markings but when clicking on a file it gave an error.

The item 'About.cshtml' does not exist in the project directory. It may have been moved, renamed or deleted.

enter image description here

Removing the files from Solution solved it for me.

Ogglas
  • 62,132
  • 37
  • 328
  • 418
  • I remove my .chtml file in my project so not Exist File In solution... .But on Publish Time Show this error meseage :>> obj\Release\Package\PackageTmp\Views\Account\Login.cshtml to obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Views\Account\Login.cshtml failed. Could not find file 'obj\Release\Package\PackageTmp\Views\Account\Login.cshtml'. – saman samadi Jan 06 '21 at 14:18
1

I mistakenly included obj Folder to Visual Studio Project. Excluding Obj folder from project fixed my issue

mxasim
  • 2,153
  • 21
  • 15
0

Check for bin folder is added in vs explorer. If it was there then exclude from project and check. It worked for me.

0

I had files inside of my directory I intended to publish to. Deleting these allowed for a successful publish.

Thomas
  • 2,622
  • 1
  • 9
  • 16
0

Another solution is to delete publish profile, this error happened to me after I deleted 1 of the EF DbContext. The solution keep track of that file inside publish folder, I recreated the profile and publish successfully.

My error was this

No DbContext named 'xxxx' was found.

Ariwibawa
  • 627
  • 11
  • 23
0

These problems occur when the bin file is included in the project, note that if the bin folder exists in your solution, exclude it.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 18 '22 at 07:08