Open yaakov-h opened 8 years ago
Just re-reading this - scratch (1) on the solution above, we should want the NuGet package to override MSI-installed contracts even when the MSI is an older version. We should therefore use DontImportCodeContracts
as-is.
As mentioned in #13, the NuGet package does not automatically install the targets file in the project.
If I add the following import after
Microsoft.CSharp.targets
:I get the following build error:
Judging by MSBuild diagnostic output,
Microsoft.CodeContracts.targets
from the MSI is being included, which means that the targets file from NuGet comes in afterwards and is adding items to now-not-empty ItemGroups.If I edit the
csproj
file to reflect the following:Then Contracts work from NuGet, overriding any MSI-installed Code Contracts on the system.
So, I see three problems:
I think the simplest solution to this is:
CodeContractsPackaged
which acts the same asDontImportCodeContracts