How come the exclude property of the assemblies under 'detected dependencies' in vdproj doesn't persist?

StackOverflow https://stackoverflow.com/questions/8044840

  •  23-02-2021
  •  | 
  •  

Question

I have a simple problem. I want to exclude some of the dll dependencies (in the detected dependencies folder) in my setup project so they don't get copied into the users install folder. I solved it by setting the 'exclude' property to true on the assemblies I don't want, and then building the msi file. It works fine, the assemblies are excluded.

However, if I close visual studio and reload it, only one of the 'exclude' properties (of 4 in my case that I set) stays set to true. I checked the vdproj file and there are 4 lines in there like this:

"Exclude" = "11:TRUE"

... one for each of the assemblies I wanted excluded.

So it seems VS2010 is not correctly loading the settings from the vdproj file. I'm mystified. Does anyone have a workaround?

Was it helpful?

Solution

It's because the dependency analyzer always adds DLLs to the deployment project when their Copy Local properties are set to true. See the section titled "Previously excluded files are included again when the solution is re-opened" in the MSDN article, Troubleshooting Setup and Deployment Projects. You'll have to choose between using Visual Studio's Copy Local and using your deployment project to install files in the right place, especially in a complex solution.

OTHER TIPS

This is for all the people who come here looking for a solution!

Well I had the same problem as mentioned above, but the DLL which I wanted to avoid is a detected depedency (my project A depends on B.dll which has a dependency to C.Dll(2.0.0.0)) but I dont want C.dll(2.0.0.0) in my MSI (as I have a direct dependency to another version of C.dll (1.0.0.0)). I tried to exclude the DLL but that wont work as VDProj refreshes the dependency everytime I reload the project and adds the detected dependency back.

The solution from Microsoft was to make the "CopyLocal" property to false for the referenced DLL, I had so many of these DLL's and I did not wanted to go to each project and update this (as this would cause the testing effort to sky rocket because as per the testers am virtually changing code for a lot of projects). So I worked around this by adding the particular DLL (C.Dll (1.0.0.0)) to the setup project manually. Just right click the setup project and select add file.

enter image description here

also remember to set the location to which you want the file to be deployed, in my case it was going to the BIn folder.

enter image description here

This file would override all the other detected dependencies (with similar name) and get deployed to the location which we specify.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top