I am facing a strange issue while publishing a site. The site is already published and I am just trying to update it. I am using the same publishing profile which worked perfectly well so far just 2 days back.
Initially it is a warning like this :
00:24:28:161 C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(593,5): Warning MSB3026: Could not copy
"C:\Users\user\Desktop\ASP.NET projects\AuthSystem-Login - Version17_WIPExcelChart_testingLocalNuget\wwwroot\obj\Release\net6.0\PubTmp\Out\wwwroot\DataFile\ABCD.xlsx" to "C:\Users\user\Desktop\ASP.NET projects\AuthSystem-Login - Version17_WIPExcelChart_testingLocalNuget\obj\Release\net6.0\PubTmp\Out\wwwroot\obj\Release\net6.0\PubTmp\Out\wwwroot\DataFile\ABCD.xlsx". Beginning retry 10 in 1000ms. Could not find a part of the path 'C:\Users\user\Desktop\ASP.NET projects\AuthSystem-Login - Version17_WIPExcelChart_testingLocalNuget\obj\Release\net6.0\PubTmp\Out\wwwroot\obj\Release\net6.0\PubTmp\Out\wwwroot\DataFile\ABCD.xlsx'.
After some time, this warning becomes an error message :
Error MSB3021: Unable to copy file
"C:\Users\user\Desktop\ASP.NET projects\AuthSystem-Login - Version17_WIPExcelChart_testingLocalNuget\wwwroot\obj\Release
net6.0\PubTmp\Out\wwwroot\DataFile\ABCD.xlsx" to
"C:\Users\user\Desktop\ASP.NET projects\AuthSystem-Login - Version17_WIPExcelChart_testingLocalNuget\obj\Release\net6.0\PubTmp\Out\wwwroot\obj\Release\net6.0\PubTmp\Out\wwwroot\DataFile\ABCD.xlsx".
This happens for all the files in Datafile folder.
What I tried :
As far as I remember, I did not change any settings from the last time (when it worked fine). Is there any option where I explicitly tell not to copy the files inside DataFile folder? May be that will solve this issue.
In my case, I did a couple of things after a lot of trial and error and it's working now.
Changing the path (shortening it). I copied the entire project to some new folder having a short path (e.g. C:/user/admin/tmp). Earlier it was longer.
But the same path was working 2 days back and as I mentioned I was just updating the project. Therefore my guess was that there was some other setting which got changed (how I don't know). Since I had installed a couple of memory profiler in the last 2 days, I assumed it might had some impact. I uninstalled those.
Honestly I am not sure of this behavior but it's working now.