tags:

views:

24

answers:

1

We've got a MsBuild.proj file which contains the following section (simplified):

<Target Name="WEB" DependsOnTargets="CleanResults;UpdateAssemblyInfo;Services;Business">

    <!-- Other build and release stuff -->      
            <MSBuild Projects="$(CreateInstallValuesScriptProjectFile)" Properties="DatabaseStructureLocation=$(DatabaseDirectory)\Sandbox\002.Structure" />
        </Target>

Basically, the InstallValuesScript generates a .sql file in our databasedirectory, which will update the version of our application in the database. Fairly simple.

The build is called as such:

MSBuild msbuild.proj /m /t:WEB /p:Configuration=Release;DoRelease=true;DoSandBox=false;DoWix=false /fileLoggerParameters:LogFile=msbuild.log;Verbosity=normal;Encoding=UTF-8

However, what we're seeing is that the InstallValues section is called multiple times, and as a result this file is created a couple of times, and on different locations... Obviously when the build is compiled two or three times instead of only once, thats annoying but not really critical (just goes a bit slower), however for this Installvalues file, we really don't want multiple instances of it.

So what gives, can a target be called multiple times? Maybe caused by the compiling of a dependant assembly? Some light on this strange phenomenom would be highly appreciated.

+1  A: 

In general, unless you <CallTask>, MSBuild wont run a Target multiple times, even if you have duplicates in dependencies (the order matters, but once its done, its done).

Do you perhaps have some nesting of calls to project files which chain in some complex manner?

But The Truth is in the Logs [that you seem to be creating so assiduously!]

Ruben Bartelink
Yes, most likely the problem will be a nesting of calls. Might be better off to redo the build from scratch I think. But thanks for pointing me to the logs, always check the obvious solution first :)
Sam