Handling VB6 dependencies

Feb 15, 2012 at 8:34 PM
Edited Feb 15, 2012 at 9:12 PM

What is the appropriate way to hande VB6 with dependent projects? The list in ProjectsToBuild doesn't appear to guarantee the build order.

In any case, we'd prefer to explicitly call out the dependencies, along these lines:

 

	<Target Name="BuildDLLs">
		<ItemGroup>
			<ProjectsToBuild Include="utility.vbp;tools.vbp" />
			<MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)" />
		</ItemGroup>
	</Target>

	<Target Name="BuildEXEs" DependsOnTargets="BuildDLLs">
		<ItemGroup>
			<ProjectsToBuild Include="mainapp.vbp" />
			<MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)" />
		</ItemGroup>
	</Target>

 

But, it builds the DLLs a second time during the BuildEXEs target, which is undesirable for a couple reasons (mainly performance and COM re-re-registration).

Any assistance appreciated!

 

 <TargeName="BuildRootLibs">
 <ItemGroup>
 <!-- primary libraries (independent of other builds) -->
 <!-- bad compat
$(SrcBasePath)\appprofilesupportlib\appprofilesupportlib.vbp;
-->
<ProjectsToBuild Include="
<Target Name="BuildRootLibs">
<ItemGroup>
<!-- primary libraries (independent of other builds) -->
<!-- bad compat
$(SrcBasePath)\appprofilesupportlib\appprofilesupportlib.vbp;
-->
<ProjectsToBuild Include="
Feb 15, 2012 at 9:10 PM

I see now (having edited my own initial post to include the task) that it's possible to use different names for the <ProjectsToBuild /> element instead. Somewhat surprising that the scope continues to grow, but I guess I don't fully understand MSBuild.

	<Target Name="BuildDLLs">
		<ItemGroup>
			<DLLsToBuild Include="utility.vbp;tools.vbp" />
		</ItemGroup>
		<MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(DLLsToBuild)" />
	</Target>

	<Target Name="BuildEXEs" DependsOnTargets="BuildDLLs">
		<ItemGroup>
			<EXEsToBuild Include="mainapp.vbp" />
		</ItemGroup>
		<MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(EXEsToBuild)" />
	</Target>