David Clarke
David Clarke

Reputation: 13266

Visual Studio setup project Team Build output differs from local build

I have a Visual Studio 2010 setup project (.vdproj) that constantly misbehaves. There is a dependency in the setup project that gets included in the installer despite my attempts to exclude it or delete it from the project file. I can exclude the assembly from the dependencies using Visual Studio, then build the project, and the output on my local machine will not include the excluded assembly. When I check in the project and build using TFS (2008), the assembly is always included.

The assembly in question is one of a number I exclude because they are already included in the setup project as project outputs. So the installer can end up with two copies of the same assembly and if it attempts to write them to the same location, either the GAC or the bin folder, the installation fails with a file in use error.

And often I'll find that when I re-open the setup project, the Exclude flag has reverted to false.

This is really quite annoying and wastes a fair amount of time because now I use Orca to load up each build to try to ensure that the duplicate assemblies aren't present in the output. Is there any way to resolve this?

Upvotes: 1

Views: 780

Answers (2)

jessehouwing
jessehouwing

Reputation: 114887

Visual Studio Setup Projects are essentially deprecated and haven't seen major work in ages. Apart from the issue you're seeing, they have a lot of other issues in combination with Team Build.

See: http://msdn.microsoft.com/en-us/library/ee721500.aspx

Caution

Future versions of Visual Studio will not include the Visual Studio Installer project templates. To preserve existing customer investments in Visual Studio Installer projects, Microsoft will continue to support the Visual Studio Installer projects that shipped with Visual Studio 2010 per the product life-cycle strategy. For more information, see Expanded Microsoft Support Lifecycle Policy for Business & Development Products.

Have a look at Wix as a replacement for these projects.

Upvotes: 2

David Clarke
David Clarke

Reputation: 13266

I found this page on msdn that has a work-around for the Exclude flag being reset to False:

Previously excluded files are included again when the solution is re-opened

When you exclude a file from a Setup project, you may see that the file is included again after you close and re-open the solution. This may occur if there are two copies of the same DLL file from two different source locations.

To work around this error, change the Copy Local property on one of the files:

In Solution Explorer, click on the DLL reference that you want to remove.

On the View menu, click Properties Window.

Change the Copy Local property to False.

Unfortunately this solution isn't going to work for me because the setup project is for an ASP.NET website but the Microsoft work-around is documented here for future reference.

I think I've established why the dependency is present. The website references the project outputs from a number of projects. When the site is precompiled, the referenced project assemblies are built and dropped into the bin folder. The setup project then identifies them as dependencies, despite the setup project already including the project outputs for those projects. The reason I use the project outputs in the setup project is because TFS likes to checkin dlls contained in the precompiled web folder which is part of the file structure of the solution. This has sometimes resulted in old or incorrect versions of dlls being present in the resulting installer.

The work-around for me is to edit the TFSBuild.proj file and add a task to delete those dlls from the precompiled bin directory. Then they won't be identified as dependencies when building the installer.

Upvotes: 0

Related Questions