ASP.NET Publishing Web App Copying File Error When the File Has Already Been Deleted
ASP.NET Publishing Web App Copying File Error When the File Has Already Been Deleted
I'm having a very peculiar issue in Visual Studio when trying to publish my MVC Web App on IIS, Windows 10. It is trying to copy a file that no longer exists in my solution. This is the error:
Severity Code Description Project File Line Suppression State
Error Copying file objReleaseAspnetCompileMergeSourceViewsDemoFile.cshtml to objReleasePackagePackageTmpobjReleaseAspnetCompileMergeSourceViewsDemoFile.cshtml failed. Could not find file 'objReleaseAspnetCompileMergeSourceViewsDemoFile.cshtml'. Solution 0
This file does not exist anywhere in my solution so I am unsure as to why it's trying to copy this file. I've tried restarted Visual Studio, cleaning and rebuilding my solution, deleting the .vs folder, but all of this has been for naught.
@UdaraKasun I did yes, everywhere it could possibly be located for this solution. I had to migrate my solution to a new one to fix it.
– user9972789
Sep 2 at 11:55
3 Answers
3
Try,
Right Click -> App_Data -> Click Exclude from Project.....
Already migrated my project to a new one to do a fix. Thanks for your help.
– user9972789
Sep 2 at 11:55
If you get an error like this it's better just to migrate your project to a new solution, that's what I did.
Solution 1
After you deleted file from folder (Not in the visual studio) usually become this error message. the reason for your "projectname.CSPROJ" file already recorded your deleted file reference
Eg : <Content Include="ViewshomeIndex.cshtml" />
<Content Include="ViewshomeIndex.cshtml" />
Then you can to delete that reference from in your "projectname.CSPROJ"
Solution 2
if you can see file in the project, You can right click on the file and Exclude file from the project
after that you can publish your project without error
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Erlier Did you delete file.cshtm ?
– Udara Kasun
Sep 2 at 3:55