|
132 | 132 | </ItemGroup> |
133 | 133 | </Target> |
134 | 134 |
|
| 135 | + <Target Name="VerifyDependencies" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" AfterTargets="Build"> |
| 136 | + <ResolveAssemblyReference AssemblyFiles="$(TargetPath)" SearchPaths="" AutoUnify="true"> |
| 137 | + <Output TaskParameter="ResolvedDependencyFiles" ItemName="ResolvedDependencies"/> |
| 138 | + </ResolveAssemblyReference> |
| 139 | + |
| 140 | + <ItemGroup> |
| 141 | + <ExpectedDependencies Include="Microsoft.Deployment.DotNet.Releases, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> |
| 142 | + <ExpectedDependencies Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" /> |
| 143 | + <ExpectedDependencies Include="Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| 144 | + <ExpectedDependencies Include="System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| 145 | + <ExpectedDependencies Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" /> |
| 146 | + <ExpectedDependencies Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| 147 | + <ExpectedDependencies Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| 148 | + <ExpectedDependencies Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" /> |
| 149 | + </ItemGroup> |
| 150 | + |
| 151 | + <!-- Check that the dependencies of the output assembly match our expectations --> |
| 152 | + <PropertyGroup> |
| 153 | + <ResolvedDependenciesList>@(ResolvedDependencies->'%(FusionName)')</ResolvedDependenciesList> |
| 154 | + <ExpectedDependenciesList>@(ExpectedDependencies->'%(Identity)')</ExpectedDependenciesList> |
| 155 | + <DependencyMismatchErrorText>This may have consequences for MSBuild.exe binding redirects, please get signoff from the MSBuild team.</DependencyMismatchErrorText> |
| 156 | + </PropertyGroup> |
| 157 | + |
| 158 | + <Error Text="$(AssemblyName) is expected to depend on %(ExpectedDependencies.Identity). $(DependencyMismatchErrorText)" |
| 159 | + Condition="!($([System.String]::Copy('$(ResolvedDependenciesList)').Contains('%(ExpectedDependencies.Identity)')))" /> |
| 160 | + <Error Text="$(AssemblyName) is not expected to depend on %(ResolvedDependencies.FusionName). $(DependencyMismatchErrorText)" |
| 161 | + Condition="!($([System.String]::Copy('$(ExpectedDependenciesList)').Contains('%(ResolvedDependencies.FusionName)')))" /> |
| 162 | + </Target> |
| 163 | + |
135 | 164 | </Project> |
0 commit comments