diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2022-05-11 14:37:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-11 14:37:12 +0300 |
commit | 5b5bd46c03c86f8545f2c4c8628ac25d875210fe (patch) | |
tree | f7e6f7bb945d52a3ac4e1982118597c49cbc1f2d /eng/references.targets | |
parent | 9158543338acd47019ffb6ec634a273a9e28cb99 (diff) |
Error if a reference assembly is platform specific (#69116)
Fixes https://github.com/dotnet/runtime/issues/29154. I didn't introduce a new target to keep the validation cost as low as possible.
Diffstat (limited to 'eng/references.targets')
-rw-r--r-- | eng/references.targets | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/eng/references.targets b/eng/references.targets index 5b7418b38e6..80eed8f9a38 100644 --- a/eng/references.targets +++ b/eng/references.targets @@ -74,12 +74,14 @@ </TargetPathWithTargetPlatformMoniker> </ItemDefinitionGroup> - <Target Name="ValidateReferenceAssemblyProjectReferences" + <Target Name="ValidateReferenceAssemblyProjectReferencesAndTargetFramework" AfterTargets="ResolveReferences" Condition="'$(IsReferenceAssemblyProject)' == 'true' and '$(SkipValidateReferenceAssemblyProjectReferences)' != 'true'"> - <Error Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferencePath.IsReferenceAssemblyProject)' != 'true' and '%(ReferencePath.ReferenceAssembly)' == ''" - Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'." /> + <Error Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'." + Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferencePath.IsReferenceAssemblyProject)' != 'true' and '%(ReferencePath.ReferenceAssembly)' == ''" /> + <Error Text="Reference assemblies must be TargetPlatform agnostic. $(MSBuildProjectName) incorrectly targets $(TargetFramework), platform: $(TargetPlatformIdentifier)." + Condition="'$(TargetPlatformIdentifier)' != ''" /> </Target> <!-- An opt-in target to trim out private assemblies from the ref assembly ReferencePath. --> @@ -92,13 +94,12 @@ </ItemGroup> </Target> - <!-- For experimental ref assemblies (which typically have the same name as a regular ref + <!-- For experimental ref assemblies (which typically have the same name as a regular ref assembly), bump their minor file version by 100 to make it distinguishable from the regular - ref assembly. - --> + ref assembly. --> <Target Name="UpdateExperimentalRefAssemblyFileVersion" AfterTargets="_InitializeAssemblyVersion" - Condition="'$(IsReferenceAssemblyProject)' == 'true' and '$(IsExperimentalRefAssembly)' == 'true'"> + Condition="'$(IsReferenceAssemblyProject)' == 'true' and '$(IsExperimentalRefAssembly)' == 'true'"> <PropertyGroup> <_FileVersionMaj>$(FileVersion.Split('.')[0])</_FileVersionMaj> <_FileVersionMin>$(FileVersion.Split('.')[1])</_FileVersionMin> |