27

I have a VS2013 setup project that builds the setup that installs the exes produced by two C# projects. When I build the setup project I get duplicate messages as if there are two build processes. I removed one of the two exes from the output of the setup project but I still get the duplicate messages.

------ Starting pre-build validation for project 'SetupWindowsService' ------ 
------ Starting pre-build validation for project 'SetupWindowsService' ------ 
------ Pre-build validation for project 'SetupWindowsService' completed ------
------ Pre-build validation for project 'SetupWindowsService' completed ------
2>------ Build started: Project: SetupWindowsService, Configuration: Release ------
2>------ Build started: Project: SetupWindowsService, Configuration: Release ------
Building file 'C:\projects\SetupTESTWindowsService\Release\SetupWindowsService.msi'...
Building file 'C:\projects\SetupTESTWindowsService\Release\SetupWindowsService.msi'...
Packaging file 'MoreLinq.dll'...
Packaging file 'MoreLinq.dll'...
Packaging file 'System.Web.Razor.dll'...
Packaging file 'System.Web.Razor.dll'...
................

All the dlls dependencies are duplicated. The output that results from building the project is ok (i.e. the msi file). The TargetPlatform is x86. In the configuration Manager the Active solution platform is Any CPU and the Active solution configuration is Release. All the projects that the setup project depends on are Release/Any CPU.

Is this normal? I am using VS 2013 Premium Update 3 running on Win 7 64 bit Ultimate.

Thanks

Just an update: I opened the vdproj in notepad++ and I removed the Debug configuration under "Configurations". Built the project and there were no duplicate messages anymore. I thought that solved it. Did another rebuild and the duplicates are back.

boggy
  • 3,674
  • 3
  • 33
  • 56
  • I'm trying to migrate from Visual Studio 2010 to Visual Studio 2013 and am having the same issue. Did you find any resolution? I'm not content with thinking this is normal when it doesn't happen in Visual Studio 2010. – Michael Repucci Feb 27 '15 at 16:11
  • 4
    Upon further investigation I've found that the first time I build after the installer project is loaded there are no duplicates. But on subsequent builds, especially after switching configurations, I get duplicates, triplicates, and more. Seems like something lingers in Visual Studio's memory of the project that makes it think these build steps need to be done multiple times. – Michael Repucci Feb 27 '15 at 16:38
  • I have this same issue. I don't really know what version it started in, but I am using 2015 RC now and it is still happening. – efischency Jul 16 '15 at 14:36
  • Happens to me too, using 2015 CE. It's a bit worrying. – Benjamin Oct 01 '15 at 20:30
  • I'm seeing this too. Does it mean there are duplicate entries in the final installer? – Sam Nov 24 '15 at 06:48
  • Can produce it with VS2015 Update 1 Community Edition. This might have something to do with `PreBuildEvent` as my project uses one. – dotNET Feb 18 '16 at 09:06
  • 3
    Michael Repucci. I see the same. The problem is still there in Visual Studio 2019. There are no errors, but it's annoying that I can still not find the root cause of this problem after four years. Still unclear to me if I do something wrong or that it is some kind of bug. – JRB May 29 '19 at 00:39

3 Answers3

13

I think this is a bug in Visual Studio or its build process.

I get the same issue with VS2015; occasionally the IDE will start multiple tasks to build the same setup project. Once it has started doing this, it only gets worse. If I continue, I can get three tasks attempting the same build, and sometimes these tasks interact and cause one of them to fail.

The easiest workaround I've found is to simply exit and reload the entire IDE.

I suspect changing the maximum number of parallel builds in the IDE Tools/ Options/ Projects and Solutions / Build and Run will also work:

https://msdn.microsoft.com/en-us/library/y0xettzf%28v=vs.90%29.aspx

MZB
  • 2,071
  • 3
  • 21
  • 38
  • I did an experiment setting the maximum number of parallel builds to 1, but it didn't seem to work. After the second rebuild I still see this message -- Starting pre-build validation for project 'SetupXXXXWindowsService' -- twice. It's annoying that this problem is still there after all this years and even more annoying that I cannot figure out If I do something wrong or that it is a bug in the Setup project or In Visual Studio – JRB May 29 '19 at 01:02
  • 4
    Hello from December, 2019 and VS 2019 ... it´s still not fixed! – SteveCinq Dec 05 '19 at 04:40
  • 1
    Feb 2022 - still a problem. – VariableSquid Feb 22 '22 at 15:47
0

Why are there duplicate outputs from DLLs, when compiling Visual Studio Projects using VS 2013? This is my take on your question, without seeing your *.csproj file.

It appears that your MSBuild is set to duplicate outputs, this is easily changed, and you can follow the link for more information.

KeepDuplicateOutputs

This is an "Optional Boolean attribute" If it is true, multiple references to the same item in the target's Returns are recorded.

However, by default, this attribute is false. Without seeing your project, open your *.csproj using notepad or similar and scroll down to the bottom, the following is the default in my VS 2015 Community IDE. Make the changes to experiment with your output.

<!-- To modify your build process...
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->

If this answered your question, please mark it as answerd, pretty please (pleading voice).

  • Setting this flag explicitly to false doesn't seem to help (oh well, because the default is false). I started seeing this problem recently after we enabled "Multiple startup projects" in VS for two projects. Interestingly, I don't have this problem with the first project, but the second one only. – newman Mar 24 '17 at 15:23
-5

Change the launch condition .NET framework version as :

.NET Framework 4
wogsland
  • 9,106
  • 19
  • 57
  • 93
VIjay
  • 1