Nuget Migration - Prompt developers to replace the project reference

7 Dec 2015 - 20:15 UTC.

As we gradually moved our sizeable codebase towards nuget package management one of the things I want to ensure is we remove the use of project references.

We have a number of solutions covered by a CI build (and a few that aren't) so I elected to use MSBuild to cover the following aims

1) To allow the project to only be built in the solution it belongs to

2) To fail the build of other solutions that include the project. And give a meaningful error message to developers.

3) To fail a CI build which still uses the project reference and give the same detail as #2

4) To have a syntax that is reusable with minimal extra work. For example the solution "Company.SolutionA" could contain projects "Company.SolutionA.Core" and "Company.SolutionA.Client" and both projects would build in that solution. But in "Company.SolutionB" neither would build as they shouldn't be in there.

The MSBuild syntax to achieve this is actually quite simple:




There are no comments.

Posting Comments is disabled.