简体   繁体   中英

Visual Studio 2008 strange build error (type conflicts with imported type)

When building a vs project, the build fails with the following error :

Error   3846    Could not write to output file 'obj\Debug\app.exe' -- 
'The process cannot access the file because it is being used by another process. '

However, when I use unlocker to view what's locking the file, no blocking process is found? The only solution to make the build work is to delete the'obj\\Debug\\app.exe' file manually.

Throughout the project though, we are getting the following warning :

Warning: the type x in 'E:\\ProjectDir\CustomClass.css' conflicts with the imported type x
in 'obj\Debug\app.exe'. Using the type defined in 'E:\\ProjectDir\CustomClass.css'

I suspect this warning is the cause of the project not building. However, I have no idea why the type is conflicting, or what VS is doing??

Any ideas anyone?

Edit: As suggested by kostas ch., renaming the output file (app.exe -> app2.exe) makes the build work again. However, the same warning stays and still mentions the old app.exe name? Removing the app.exe in the obj\\Debug folder makes for a new warning, this time it mentions the app.exe in bin\\Debug. Removing that file makes the warning go away, and the project keeps building ok. However, when renaming the output file agiain to the old name app.exe, the same error returns .. ??

I have no idea whatsoever is happening, but I'm glad for the workaround, thanks kostas.ch!

For error:

Error 3846 Could not write to output file 'obj\\Debug\\app.exe' -- 'The process cannot access the file because it is being used by another process. '

First try:
The application is still running. Just Start the task manager, click Processes Tab, find app.exe, right click it and click End Process.

Second:
Restart the Visual Studio.

Third:
Stop Visual Studio, delete app.exe and start Visual Studio.

Warning: the type x in 'E:\\ProjectDir\\CustomClass.css' conflicts with the imported type x in 'obj\\Debug\\app.exe'. Using the type defined in 'E:\\ProjectDir\\CustomClass.css'

Maybe you refer to other project that have the same x type.
The solution is just type:

x xvariable;

Right click on 'x' and Goto Declaration, it will show both the source code of x that are conflicted and remove that is not correct or rename it.

Rename the app.exe. I have faced same problem before and i did not find any solution. This is not then best practice but it works and i have not found something else.

I had a like this. A lots of warning have generated for all of my classes in the solution that have said:

The type "myNamespace.myClassname" conflicts with "....\release\....exe". Using...

I explored the "Solution Explorer" and found a reference with name of my namespace in the list. simply I removed it, and it removed warnings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM