1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 <PropertyGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">
5 <!-- Tell ResolveMatchingContract to run and resolve contract to project reference -->
6 <ResolveMatchingContract>true</ResolveMatchingContract>
7 <NotSupportedSourceFile>$(IntermediateOutputPath)$(TargetName).notsupported.cs</NotSupportedSourceFile>
8 <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateNotSupportedSource</CoreCompileDependsOn>
9 <!-- Not supported sources are created from the ref assembly, we currently don't produce finalizers in dummmy assemblies, so we disable ApiCompat to not fail. -->
10 <RunApiCompat>false</RunApiCompat>
13 <ItemGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">
14 <AssemblyMetadata Include="NotSupported">
19 <!-- GenerateNotSupportedSource
22 * Reference assemblies
24 Generates source for the contract that throws PlatformNotSupportedException
26 <Target Name="GenerateNotSupportedSource"
27 DependsOnTargets="ResolveMatchingContract"
28 Inputs="@(ReferencePath);@(ResolvedMatchingContract)"
29 Outputs="$(NotSupportedSourceFile)">
32 <!-- build out a list of directories where dependencies are located -->
33 <_referencePathDirectoriesWithDuplicates Include="@(ReferencePath->'%(RootDir)%(Directory)'->TrimEnd('\'))" />
34 <!-- strip metadata, removing duplicates -->
35 <_referencePathDirectories Include="%(_referencePathDirectoriesWithDuplicates.Identity)" />
38 <Error Text="No single matching contract found." Condition="'@(ResolvedMatchingContract->Count())' != '1'" />
41 <GenAPIArgs>-assembly:"%(ResolvedMatchingContract.Identity)"</GenAPIArgs>
42 <GenAPIArgs>$(GenAPIArgs) -libPath:"@(_referencePathDirectories)"</GenAPIArgs>
43 <GenAPIArgs>$(GenAPIArgs) -out:"$(NotSupportedSourceFile)"</GenAPIArgs>
44 <GenAPIArgs Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(GenAPIArgs) -throw:"$(GeneratePlatformNotSupportedAssemblyMessage)"</GenAPIArgs>
48 <GenAPICmd>$(ToolHostCmd) "$(ToolsDir)GenAPI.exe"</GenAPICmd>
51 <Exec Command="$(GenAPICmd) $(GenAPIArgs)" WorkingDirectory="$(ToolRuntimePath)" />
54 <FileWrites Include="$(NotSupportedSourceFile)" />
55 <Compile Include="$(NotSupportedSourceFile)" />