ASP.NET publish trying to copy a non-existant file - cSharp Coder

Latest

cSharp Coder

Sharp Future

Friday, July 1, 2022

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.

No comments:

Post a Comment