ASP.NET publish trying to copy a non-existant file
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.
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.
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.