1

I have run into a problem with msbuild. I have a three tiers of project files. The lowest create libraries, some of which are language neutral, and some of which are language specific. The next tier builds a project that combines the language neutral libraries with the libraries for a specific language into a product. The final tier builds the product multiple times for the different languages.

The problem that I am having is that the language neutral library is being built multiple times, and when I invoke msbuild with the /m flag I get sharing violations during the build, since multiple threads end up building the language neutral project. I have been told that if I use the RemoveProperties parameter on the MSBuild task so that all of the properties match, msbuild will only build the project once. I have tried to do this, but have not been able to get the project to only build once. I have looked at a diagnostic log and created a custom logger to try and figure out which properties to add to the RemoveProperties parameter.

My question is how does msbuild decide that two invocations of the same project file are the same, and should only be built once. Based on the info passed to the OnProjectStarted event of my custom logger, all of the Global properties are the same. Is there something else that I need to make match?

Alex
  • 4,885
  • 3
  • 19
  • 39
  • Are you using any wildcards in assembly info files? this may cause the project to need recompilation if the build takes longer than 2 seconds and the compiler is invoked multiple times because of any changes that prevent incremental builds somehow. (use `True…>` to prevent such issues) – Martin Ullrich Nov 08 '17 at 02:38
  • 1
    I also recommend using the binary log feature in vs 2017 15.3+ using msbuild with the `/bl` argument and looking at the msbuild.binlog file using the [structured log viewer](http://msbuildlog.com). But this will be very hard to diagnose without the actual project files and only describing what they do.. – Martin Ullrich Nov 08 '17 at 02:40
  • The projects are Wix 3.11 projects to build MSIs, and bootstraps and some custom projects to create ISO images and publishing manifests. They are huge, and I haven't been able to create a small example that I can post. The suggestion to use the binary log feature sounds like it will be a great help, currently updating my environment to 15.3 – Matt Hoover Nov 09 '17 at 15:40

0 Answers0