when we publish website using Visual Studio, we are getting following erros.
publish has encountered an error Object reference not set to an instance of an object A diagnostic log has been written to following location
Change the target location in publish profile, this error occurs when same folder used for more than one project.
Error
Severity Code Description Project Path File Line Suppression State Suppression State
Error Copying file obj\Release\Package\PackageTmp\Scripts\bootstrap.min.js to obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Scripts\bootstrap.min.js failed. Could not find a part of the path 'obj\Release\Package\PackageTmp\Scripts\bootstrap.min.js'. InnerException.WebUI 0
Solution
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.
Se Default path of published=> bin\Release\Publish
Delete all published profile
Solutions
-Files are missing, just include files. those are giving error
Solution 0
Change the target location in publish profile, this error occurs when same folder used for more than one project.
Solution 1
- Remove all warning from the project
- Delete temp files in AppData/Local/Temp
- File Publish option
- Check all text boxes like Delete All existing files
- Precompile during...
- Exclude files from...
Solution 2
here are few more instructions
- Run Visual Studio as Administrator
- Clean the Solution or project
- Delete all files into obj Directory
- Review if any files need to include in the project
- Build Solution again.
Share This with your friend by choosing any social account