error MSB3021: Unable to copy file "obj\Debug\ChangeBuild.proj.exe"

Im using an msbuild script to do my build and because it includes an msi installer im using the devenv.exe method to compile the solution. I have had this previously working but since then ive moved the checkout folder of teamcity and updated the paths in the msbuild script to reflect that change and now my build fails with:


[12:08:50]: [Copy] C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868, 9): error MSB3021: Unable to copy file "obj\Debug\ChangeBuild.proj.exe" to "bin\Debug\ChangeBuild.proj.exe". Could not find file 'obj\Debug\ChangeBuild.proj.exe'.


Now i dont underwstand why its even looking in a \Debug\ folder at all as ive specifically told it to run the Release configuration! but more to the point why is it copying the MBBuild script after the build???
[12:03:45]: [Exec] "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln" /Build Release /out "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.txt"

the actual build works and all compiles ok, as the solution build output file shows....
========== Build: 47 succeeded or up-to-date, 0 failed, 0 skipped ==========


but TC then fails with with the file copy error?  Please help, what have i missed....




heres a section of the full log and you can see that the warning is the installer and the error is the file copy failing constantly but where is this copy coming from? who told it to copy from this folder when all my output paths are elsewhere and why is the
[12:03:45]: [Message] Compiling : C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln
[12:03:45]: [Compile] Exec
[12:03:45]: [Exec] "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln" /Build Release /out "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.txt"
[12:08:49]: [Compile] Message
[12:08:49]: [Message] Compile : C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] _GenerateSatelliteAssemblyInputs
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] CreateSatelliteAssemblies
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] GetTargetPath
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] GetCopyToOutputDirectoryItems
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] _CopySourceItemsToOutputDirectory
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] _CheckForCompileOutputs
[12:08:49]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] CopyFilesToOutputDirectory
[12:08:49]: [CopyFilesToOutputDirectory] Copy
[12:08:49]: [Copy] Copying file from "obj\Debug\ChangeBuild.proj.exe" to "bin\Debug\ChangeBuild.proj.exe".
[12:08:50]: [Copy] C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868, 9): error MSB3021: Unable to copy file "obj\Debug\ChangeBuild.proj.exe" to "bin\Debug\ChangeBuild.proj.exe". Could not find file 'obj\Debug\ChangeBuild.proj.exe'.
[12:08:50]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] _CleanGetCurrentAndPriorFileWrites
[12:08:50]: [Clisp\Clisp.Studio\ChangeBuild.proj.teamcity] _CleanRecordFileWrites
[12:09:01]: Process exited with code 1
[12:09:02]: MSBuild output:
[12:09:02]: Removing directory "C:\vjtech\dev\Clisp2010Change\Install\Release".
[12:09:02]: Clean : C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln
[12:09:02]: Compile:
[12:09:02]: Compiling : C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln
[12:09:02]: "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln" /Build Release /out "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.txt"
[12:09:02]: Compile : C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\Clisp.Studio.sln
[12:09:02]: CopyFilesToOutputDirectory:
[12:09:02]: Copying file from "obj\Debug\ChangeBuild.proj.exe" to "bin\Debug\ChangeBuild.proj.exe".
[12:09:02]: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2868,9): error MSB3021: Unable to copy file "obj\Debug\ChangeBuild.proj.exe" to "bin\Debug\ChangeBuild.proj.exe". Could not find file 'obj\Debug\ChangeBuild.proj.exe'. [C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\ChangeBuild.proj.teamcity]
[12:09:02]: Done Building Project "C:\vjtech\dev\Clisp2010Change\Clisp\Clisp.Studio\ChangeBuild.proj.teamcity" (Build target(s)) -- FAILED.
[12:09:02]: Build FAILED.

8 comments
Comment actions Permalink

It seems that you are passing in Release as a configuration for the build but then trying to get the compilation from Debug. If the Release configuration means building the project in release format then it may not be in the debug folder. If this is the case then I think you need to make your build script a little less specific and use something like bin\{configuration}

hope this helps

paul

0
Comment actions Permalink

this is just my point, im not asking it to come from anywhere TC is doing that!

in msbuild i tell it to do a release config build (which it succesfully does),
but the MSBuild Exec task im using is failing becuase after building TC is trying to copy the build script (having added an extension of .exe) to another folder? i never anywhere in my msbuild script to do that.


the portion that is failing in the build script is here


    <!-- ================= COMPILE INSTALLER ================= -->
    <Target Name="Clean" DependsOnTargets="GetRevision">
        <RemoveDir Directories="$(SetupSourceDirectory)" Condition="Exists('$(SetupSourceDirectory)')" ContinueOnError="true"/>
        <RemoveDir Directories="$(ZipSourceDirectory)" Condition="Exists('$(ZipSourceDirectory)')" ContinueOnError="true"/>
    </Target>
    <Target Name="Compile" DependsOnTargets="Clean">
        <Message Text="Compiling : $(SolutionToBuild)"/>
        <Exec Command="%22$(VisualStudio10)%22 %22$(SolutionToBuild)%22 /Build Release /out %22$(ErrorLogFile)%22"/>              <---------- this never finished, but the compile completes ok
        <Message Text="Compiled : $(SolutionToBuild)"/>
    </Target>

the compile works perfectly, but TC is trying to copy a file that doesnt exist nor should it ever exist as its not part of our source.

it looks as though TC has created an exe of some sort from the build script and is trying to copy that from one folder to another?? but why


this script was working fine up until recently and i cant for the life of me work out why is doesnt now?



Attachment(s):
Clisp_Studio_Clisp_Studio_2010_-_Release_Build_69b9df384727.log.zip
0
Comment actions Permalink

what does the copy part of the build script look like? TeamCity seems to think there is a reference to a zdebug in there somewhere. maybe what ou can do is to add

<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>

to the ProprtyGroup of the build script then pass in the configuration as part of the parameteres /p:Configuration:Release

then use $(configuration) as part of the paths to see if that helps?

paul

0
Comment actions Permalink

There isnt a copy part of the build script thats just it...

here is the majority of my build script (anonymised ofc)

in tc im just doing a straight MSBuild runner as per screenshot attached.

<!-- ================= SOLUTION COMPILES CHECK ================= -->
<Target Name="PreCompile" >
<MSBuild Projects="$(SolutionToBuild)" Properties="Configuration=Release;Platform=x86"/>
</Target>

<!-- ================= UPDATE THE VERSION NUMBERS ================= -->
<Target Name="UpdateVersionNumbers" DependsOnTargets="PreCompile">
<!-- AUTOMATICALLY UPDATE ALL VERSIONS OF ALL THE PROJECTS IN THE SOLUITION (ONLY THOSE THAT ARE MODIFIED) ....-->
<Exec Command="%22$(AutoVersionToolPath)%22 /V:* /A:M %22$(SolutionToBuild)%22"/>
</Target>


<!-- ================= SEND UPDATED VERSIONS TO KILN ================= -->
<Target Name="CommitVersions" DependsOnTargets="UpdateVersionNumbers">
<Message Text="Sending $(MercurialProjectDirectory) => $(MercurialRepoPath)"/>

<HgCommit
LibraryLocation="$(MercurialHgPath)"
LocalPath="$(MercurialProjectDirectory)"
User="$(MercurialUser)"
Timeout="$(MercurialTimeout)"
Message="The continuous integration build process updated version numbers"
/>
<HgPush LibraryLocation="$(MercurialHgPath)"
LocalPath="$(MercurialProjectDirectory)"
User="$(MercurialUser)"
Timeout="$(MercurialTimeout)"
Password="$(MercurialPass)"
Destination="$(MercurialRepoPath)"
/>
</Target>


<!-- ================= GET STUDIO REVISION FROM KILN ================= -->
<Target Name="GetRevision" DependsOnTargets="CommitVersions">
<Message Text="Getting revision number from Kiln"/>

<HgVersion
LibraryLocation="$(MercurialHgPath)"
LocalPath="$(MercurialProjectDirectory)"
Timeout="$(MercurialTimeout)">
<Output TaskParameter="Revision" PropertyName="Revision" />
</HgVersion>

<Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
</Target>    


<!-- ================= COMPILE INSTALLER ================= -->
<Target Name="Clean" DependsOnTargets="GetRevision">
<RemoveDir Directories="$(SetupSourceDirectory)" Condition="Exists('$(SetupSourceDirectory)')" ContinueOnError="true"/>
<RemoveDir Directories="$(ZipSourceDirectory)" Condition="Exists('$(ZipSourceDirectory)')" ContinueOnError="true"/>
</Target>
<Target Name="Compile" DependsOnTargets="Clean">
<Message Text="Compiling : $(SolutionToBuild)"/>
<Exec Command="%22$(VisualStudio10)%22 %22$(SolutionToBuild)%22 /Build Release /out %22$(ErrorLogFile)%22"/>             <---------- this fails
<Message Text="Compiled : $(SolutionToBuild)"/>
</Target>



< IT NEVER GETS PAST HERE>



<!-- ================= MAKE ZIP OF MSI + PRE+REQS ================= -->
<Target Name="Zip" DependsOnTargets="Compile">
<ItemGroup>
<ZipFiles Include="$(ZipSourceDirectory)\**\*.*" Exclude="*.zip" />
</ItemGroup>
<Zip Files="@(ZipFiles)"
WorkingDirectory="$(ZipSourceDirectory)"
ZipFileName="$(ZipSourceDirectory)\$(ApplicationName) V$(Major).$(Minor).$(Build).$(Revision).zip"
ZipLevel="9" />
</Target>


<!-- ================= COPY TO NETWORK ================= -->
<Target Name="CopyToNetwork" DependsOnTargets="Zip">
<!-- CREATE NEW FOLDER FOR BUILD ON S-->
<!-- <Message Text="Create Folder : $(SDriveReleasesFolder)\Version $(Major).$(Minor).$(Build).$(Revision)"/>-->
<MakeDir Directories="$(SDriveReleasesFolder)\Version $(Major).$(Minor).$(Build).$(Revision)" Condition="!Exists('$(SDriveReleasesFolder)\Version $(Major).$(Minor).$(Build).$(Revision)')" ContinueOnError="true"/>

<!-- COPY MSI MSI TO S -->
<Copy SourceFiles="$(ZipSourceDirectory)\$(ApplicationName) V$(Major).$(Minor).$(Build).$(Revision).zip" DestinationFolder="$(SDriveReleasesFolder)\Version $(Major).$(Minor).$(Build).$(Revision)"/>
</Target>


<!-- ================= UPLOAD ZIP FILE TO FTP ================= -->
.. more stuff here



Note: there is a typo in the Build File Path in this screenshot, which i have already corrected.



Attachment(s):
msbuild.png
0
Comment actions Permalink

not knowing what caused this to stop working and thinking it might have been a recent upgrade to TC from 5.2 to 6.0.3 i reverted all build script changes and the old one is now working again....?? i will diff the files and see what the changes are (though i already know it was only an source code path) and the matching change in TC. but ill report back as i this is almost impossible to debug

0
Comment actions Permalink

$(MSBuildProjectFile) or similar wellknown parameters are affected by msbuild runner under TeamCity. TeamCity MSBuild runner generates wrapping MSBuild script for your own script. This lead to changes in wellknown properties values in the build.

In TeamCity 6.5 you may disable wrapper generation by setting teamcity.msbuild.generateWrappingScript configuration parameter to false. Please note, this wrapping script was generated since early time as that was not changed between 5.0 and 6.0.

0
Comment actions Permalink

ok ive finally found the issue, i got a path mixed up with another build so this was my fault no TC. sorry for the confusion guys and thanks for the help

0
Comment actions Permalink

these things happen

glad its resolved :)

0

Please sign in to leave a comment.