Created On:  26 October 2012

Problem:

Customer used the Visual COBOL Net Express import wizard to import a number of Net Express projects that existed in the same physical folder location.  Some of the projects were .INT/GNT projects and some were .DLL projects.

The DLL projects build fine and the INT/GNT projects build fine if they are built prior to any .DLL project being built.  If the INT/GNT project is build after a DLL project that resides in the same folder then the following error occurs:

   "Could not copy the file "obj\x86\Debug\Program1" because it was not found. Microsoft.Common.Targets line 3364.

Why is this happening?

Resolution:

This problem is caused by using the same root folder for multiple projects that are imported where some projects are .dll projects and some are .int/.gnt.

Because the projects are in the same folder they share a common obj\x86\debug folder which is where the build places the temporary .obj files when linking.
The build process checks to see if there is an .obj file present in obj\x86\debug folder and if there is it will trigger a copy of the output file from the obj\x86\debug folder to the actual output folder.

This works fine for .dll projects as the output file .dll will be placed in the obj\x86\debug folder and the copy will succeed.

Under normal circumstances this will also work for an .int/gnt project because they do not generate .obj files into obj\x86\debug so the copy will not be attempted. The .int or .gnt is created directly in the output folder.

The problem occurs when a .dll project build is done prior to an .int/gnt project build because the resulting .obj file will still remain in obj\x86\debug so it tries to copy an output file that doesn't exist.

This problem can be solved by adding a prebuild event command of

del $(SolutionDir)\obj\x86\debug\*.obj

under Project-->Properties-->COBOL-->Build events.

This causes the .obj files to be removed from obj\x86\debug before starting the build.

Incident #2598365