ASP.NET publish trying to copy a non-existant file
Asked Answered
P

13

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?

Piscary answered 22/5, 2012 at 15:50 Comment(2)
Update: I went into Project --> Package/Publish Settings, and clicked "Exclude generated debug symbols." The project is now publishing as I write this.Piscary
Does this answer your question? Error Copying file bin\EntityFramework.SqlServer.xml to ..\bin\EntityFramework.SqlServer.xml failedDownhill
P
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.

Piscary answered 23/5, 2012 at 14:14 Comment(4)
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 !Civvies
Dah ! The files aren't in the folder but just in the .proj. SubVersion Commit fail !Civvies
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 <Content Include=OffendingDLL.dll> reference. Save it on disk , VS asked to reload project. Now publishing okayMichelle
@FrançoisBreton thanks man,your comment helped me after wasting 30 mins on web .Wahoo
B
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.
Booth answered 1/12, 2015 at 23:20 Comment(1)
This saved my day. I had the same problem but with npm-files. (For example npm-debug.log)Ne
P
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.

Piscary answered 23/5, 2012 at 14:14 Comment(4)
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 !Civvies
Dah ! The files aren't in the folder but just in the .proj. SubVersion Commit fail !Civvies
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 <Content Include=OffendingDLL.dll> reference. Save it on disk , VS asked to reload project. Now publishing okayMichelle
@FrançoisBreton thanks man,your comment helped me after wasting 30 mins on web .Wahoo
S
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.

Syracuse answered 29/4, 2016 at 7:18 Comment(0)
U
10

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

Solution explorer with file

Underwear answered 31/7, 2019 at 7:33 Comment(0)
C
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.

Chellean answered 22/4, 2016 at 15:32 Comment(0)
L
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.

Lemmie answered 20/4, 2018 at 10:18 Comment(0)
G
3

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

Gretna answered 14/1, 2022 at 7:43 Comment(0)
P
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.

Print answered 1/2, 2019 at 13:0 Comment(1)
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'.Palua
H
1

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

Hoot answered 17/4, 2018 at 22:48 Comment(0)
D
0

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

Deformation answered 27/8, 2018 at 10:41 Comment(0)
H
0

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

Hierogram answered 29/12, 2020 at 18:46 Comment(0)
O
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.

Objectivism answered 20/1, 2021 at 10:11 Comment(0)
T
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.

Toh answered 12/10, 2022 at 21:59 Comment(1)
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.Matney

© 2022 - 2024 — McMap. All rights reserved.