I am using Visual Studio 2005. After taking code from version control first, the c#.net application runs correctly. But, after doing some modifications, when I build I am
Go to file's path then un-check read only checkbox of this file.
This has reared it's head again in Visual Studio 2017, in this case the cause is the Application Insights process ServiceHub.DataWarehouseHost.exe.
There is a workaround discussed in the thread warning MSB3026: Could not copy "obj\Debug\netcoreapp1.1\src.pdb" to "bin\Debug\netcoreapp1.1\src.pdb", which is to add a pre-build event to the project to kill the process every time the project is built. Quoting from that link:
- Right click properties on project
- Choose properties
- Build Events
- Pre-build event command line
taskkill /IM ServiceHub.DataWarehouseHost.exe /F 2>nul 1>nul
Exit 0
- Save and build
Check Task Manager and make sure you don't have a devenv.exe process hanging. Kill the runaway process and try again.
I stepped into this problem too.
First go and check if you have mapped your bin and obj folder to the Source Control program.
This may be turning your files from binaries folders into read only archives, which make impossible to visual studio to overwrite them when it compiles the code.
Go and remove the mapping from these folders, check the changes and try again.
My problem occurred using TFS(Team foundation server) and Visual Studio 2010.
Hope this helps someone.
I created this problem when I added a new setup project to the solution, and then added files directly from the /bin/release folder of the main application project to the application files folder of the setup project. The source control of the setup project was consistently blocking me from completing a build of the main application project.
Solution: create a separate dump folder outside of any of the projects that will contain all the files to be included in the install, and add them from there. It's a pain because now I have to remember to copy all the files for each new install package. I might see if I can do something with post-build actions our an automated build to make the process smoother.
I know its an old thread but for those looking for answers, like me a few minutes ago, I recommend trying to restart your computer first. That alone fixed for me. Before could not even manualy copy to the folder.