Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)CodeStyle.props" />
<Import Project="eng\FacadeAssemblies.props" />

<Import Project="$(RepositoryEngineeringDir)FacadeAssemblies.props" />
<Import Project="$(RepositoryEngineeringDir)ApiCompatability\DesktopApiCompat.props" />
<Import Project="$(RepositoryEngineeringDir)ApiCompatability\PreviousReleaseApiCompat.props" />
<PropertyGroup>
<Product>Microsoft&#xAE; .NET</Product>
<Copyright>$(CopyrightNetFoundation)</Copyright>
Expand Down Expand Up @@ -33,6 +34,15 @@
<ExcludeByFile />
</PropertyGroup>

<PropertyGroup>
<AvoidRunningResolveMatchingPreviousReleaseContract>false</AvoidRunningResolveMatchingPreviousReleaseContract>
</PropertyGroup>

<PropertyGroup>
<PreviousReleaseStableApiProject>$(RepositoryEngineeringDir)ApiCompatability\WinFormsStableAPIProject\WinFormsStableAPIProject.csproj</PreviousReleaseStableApiProject>
<DesktopReferencePath>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.7.2\$(MicrosoftTargetingPackNETFrameworkv472PackageVersion)\lib\net472\</DesktopReferencePath>
</PropertyGroup>

<!-- Make sure coverage targets are defined even in projects where coverlet is not installed -->
<Target Name="InstrumentModulesAfterBuild" />
<Target Name="GenerateCoverageResult" />
Expand Down
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<Import Project="$(RepositoryEngineeringDir)CodeStyle.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)packageContent.targets" />
<Import Project="$(RepositoryEngineeringDir)ResolveMatchingContract.targets" />
<Import Project="$(RepositoryEngineeringDir)ApiCompatability\ResolveMatchingPreviousReleaseContract.targets" />
<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
<Import Project="$(RepositoryEngineeringDir)ApiCompatability\DesktopApiCompat.targets" />
<!--Import Project="$(RepositoryEngineeringDir)ApiCompatability\PreviousReleaseApiCompat.targets" /-->
<!-- to prevent using MS.NC.Platforms from SDK, which is lagging behind the version that WinForms gets from the CoreFx packages -->
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Platforms" Version="$(MicrosoftNETCorePlatformsPackageVersion)" />
Expand Down
31 changes: 24 additions & 7 deletions Winforms.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accessibility", "src\Accessibility\src\Accessibility.ilproj", "{351D8601-6E21-45E8-B3B9-847C4540BD4E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accessibility-version", "src\Accessibility\ver\Accessibility-version.csproj", "{6103E743-057D-41C6-946C-23A751A08748}"
ProjectSection(ProjectDependencies) = postProject
{5950A0B3-7977-4138-8837-1F9531A3C9C9} = {5950A0B3-7977-4138-8837-1F9531A3C9C9}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accessibility", "Accessibility", "{088DD24C-DF6B-45F3-A8BC-592580A4B2A9}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -61,8 +64,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Maui.I
{8AB0265C-B32D-444E-BFCB-8902FE45143A} = {8AB0265C-B32D-444E-BFCB-8902FE45143A}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsControlsClassicTests", "src\System.Windows.Forms\tests\IntegrationTests\WinFormsControlsClassicTests\WinFormsControlsClassicTests.csproj", "{840B70B2-4F4B-4FF0-A26F-185789625C78}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.IntegrationTests.Common", "src\System.Windows.Forms\tests\IntegrationTests\System.Windows.Forms.IntegrationTests.Common\System.Windows.Forms.IntegrationTests.Common.csproj", "{48979B4E-EAEC-4B41-BB49-44CA230BECAB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiComboBoxTests", "src\System.Windows.Forms\tests\IntegrationTests\MauiTests\MauiComboBoxTests\MauiComboBoxTests.csproj", "{AF320975-3529-48A7-B4C9-67BCE1E1B9BE}"
Expand Down Expand Up @@ -107,6 +108,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "accessibility", "accessibil
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AccessibilityTests", "src\System.Windows.Forms\tests\AccessibilityTests\AccessibilityTests.csproj", "{A9F13504-5560-4CC7-80A2-11E23E5852E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiCompatability", "ApiCompatability", "{9B468403-49CC-482E-8D94-79BD0A7C45EB}"
ProjectSection(SolutionItems) = preProject
eng\ApiCompatability\DesktopApiCompat.props = eng\ApiCompatability\DesktopApiCompat.props
eng\ApiCompatability\DesktopApiCompat.targets = eng\ApiCompatability\DesktopApiCompat.targets
eng\ApiCompatability\DesktopAttributeTypeExclusions.txt = eng\ApiCompatability\DesktopAttributeTypeExclusions.txt
eng\ApiCompatability\PreviousReleaseApiCompat.props = eng\ApiCompatability\PreviousReleaseApiCompat.props
eng\ApiCompatability\PreviousReleaseApiCompat.targets = eng\ApiCompatability\PreviousReleaseApiCompat.targets
eng\ApiCompatability\ResolveMatchingPreviousReleaseContract.targets = eng\ApiCompatability\ResolveMatchingPreviousReleaseContract.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PreviousReleaseWitnessProject", "PreviousReleaseWitnessProject", "{DE508AD2-A8FD-4151-B9A5-32C0D11DBA62}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsStableAPIProject", "eng\ApiCompatability\WinFormsStableAPIProject\WinFormsStableAPIProject.csproj", "{5950A0B3-7977-4138-8837-1F9531A3C9C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -185,10 +200,6 @@ Global
{87CF8481-647B-4951-8A57-468B2F0CD84B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87CF8481-647B-4951-8A57-468B2F0CD84B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87CF8481-647B-4951-8A57-468B2F0CD84B}.Release|Any CPU.Build.0 = Release|Any CPU
{840B70B2-4F4B-4FF0-A26F-185789625C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{840B70B2-4F4B-4FF0-A26F-185789625C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{840B70B2-4F4B-4FF0-A26F-185789625C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{840B70B2-4F4B-4FF0-A26F-185789625C78}.Release|Any CPU.Build.0 = Release|Any CPU
{48979B4E-EAEC-4B41-BB49-44CA230BECAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48979B4E-EAEC-4B41-BB49-44CA230BECAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48979B4E-EAEC-4B41-BB49-44CA230BECAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -201,6 +212,10 @@ Global
{A9F13504-5560-4CC7-80A2-11E23E5852E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9F13504-5560-4CC7-80A2-11E23E5852E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9F13504-5560-4CC7-80A2-11E23E5852E1}.Release|Any CPU.Build.0 = Release|Any CPU
{5950A0B3-7977-4138-8837-1F9531A3C9C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5950A0B3-7977-4138-8837-1F9531A3C9C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5950A0B3-7977-4138-8837-1F9531A3C9C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5950A0B3-7977-4138-8837-1F9531A3C9C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -228,11 +243,13 @@ Global
{8F20A905-BD37-4D80-B8DF-FA45276FC23F} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{8AB0265C-B32D-444E-BFCB-8902FE45143A} = {8F20A905-BD37-4D80-B8DF-FA45276FC23F}
{87CF8481-647B-4951-8A57-468B2F0CD84B} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{840B70B2-4F4B-4FF0-A26F-185789625C78} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{48979B4E-EAEC-4B41-BB49-44CA230BECAB} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{AF320975-3529-48A7-B4C9-67BCE1E1B9BE} = {8F20A905-BD37-4D80-B8DF-FA45276FC23F}
{D390F7D2-1E11-4DEE-B7F1-4FD0681A81F0} = {DF68A171-D27B-4E6A-8A7E-63A651622355}
{A9F13504-5560-4CC7-80A2-11E23E5852E1} = {D390F7D2-1E11-4DEE-B7F1-4FD0681A81F0}
{9B468403-49CC-482E-8D94-79BD0A7C45EB} = {462AD69A-9395-4E98-882D-569CDE562559}
{DE508AD2-A8FD-4151-B9A5-32C0D11DBA62} = {9B468403-49CC-482E-8D94-79BD0A7C45EB}
{5950A0B3-7977-4138-8837-1F9531A3C9C9} = {DE508AD2-A8FD-4151-B9A5-32C0D11DBA62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136}
Expand Down
27 changes: 27 additions & 0 deletions eng/ApiCompatability/DesktopApiCompat.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>

<!--
This file is intended to be used in combination with DesktopApiCompat.targets,
ResolveMetchingContract.targets, and DesktopAttributeTypeExclusion.txt to check
implementation against Classic Desktop reference assemblies excluding known
changes notated in DesktopAPICompatBaseline files.

You can use the /p:BaselineAllAPICompatError=true flag to regenerate baseline files.
-->

<PropertyGroup>
<RunApiCompat>true</RunApiCompat>
<!-- only validate that the current implementation is compatible
with the old one, not vice-versa (since latest may have new
API missing from old) -->
<RunApiCompatForSrc>true</RunApiCompatForSrc>
<RunMatchingRefApiCompat>false</RunMatchingRefApiCompat>
<DesktopAPICompatLeftOperand>".NET 4.7.2 implementation"</DesktopAPICompatLeftOperand>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NETFramework reference assembly

<DesktopAPICompatRightOperand>".NET Core 3.1 implementation"</DesktopAPICompatRightOperand>
Copy link
Member

@ericstj ericstj Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NETCore implementation

<ApiCompatArgs>$(ApiCompatArgs) --left-operand $(DesktopAPICompatLeftOperand) --right-operand $(DesktopAPICompatRightOperand)</ApiCompatArgs>
</PropertyGroup>

<PropertyGroup>
<ApiCompatExcludeAttributeList>$(RepositoryEngineeringDir)/ApiCompatability/DesktopAttributeTypeExclusions.txt</ApiCompatExcludeAttributeList>
</PropertyGroup>
</Project>
7 changes: 7 additions & 0 deletions eng/ApiCompatability/DesktopApiCompat.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<ItemGroup Condition="'$(RunApiCompat)' == 'true'">
<PackageReference Include="Microsoft.DotNet.ApiCompat"
Version="$(MicrosoftDotNetApiCompatPackageVersion)"
PrivateAssets="All" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions eng/ApiCompatability/DesktopAttributeTypeExclusions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
T:System.Security.SecurityCriticalAttribute
13 changes: 13 additions & 0 deletions eng/ApiCompatability/PreviousReleaseApiCompat.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project>
<PropertyGroup>
<RunPreviousReleaseApiCompat>true</RunPreviousReleaseApiCompat>
<!-- only validate that the current implementation is compatible
with the old one, not vice-versa (since latest may have new
API missing from old) -->
<RunPreviousReleaseApiCompatForSrc>true</RunPreviousReleaseApiCompatForSrc>
<RunPreviousReleaseMatchingRefApiCompat>false</RunPreviousReleaseMatchingRefApiCompat>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary

<PreviousReleaseAPICompatLeftOperand>".NET Core 3.0 reference"</PreviousReleaseAPICompatLeftOperand>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places we use "implementation"

Suggested change
<PreviousReleaseAPICompatLeftOperand>".NET Core 3.0 reference"</PreviousReleaseAPICompatLeftOperand>
<PreviousReleaseAPICompatLeftOperand>".NET Core 3.0 implementation"</PreviousReleaseAPICompatLeftOperand>

or we need to change in other places to use "reference" for the PreviousReleaseAPICompatLeftOperand

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above try to use more generic names so you don't need to version these.

<PreviousReleaseAPICompatRightOperand>".NET Core 3.1 implementation"</PreviousReleaseAPICompatRightOperand>
<PreviousReleaseApiCompatBaseline>"PreviousReleaseApiCompatBaseline.txt"</PreviousReleaseApiCompatBaseline>
</PropertyGroup>
</Project>
65 changes: 65 additions & 0 deletions eng/ApiCompatability/PreviousReleaseApiCompat.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<Project>

<PropertyGroup>
<!-- If DotNetTool is undefined, we default to assuming 'dotnet' is on the path -->
<DotNetTool Condition="'$(DotNetTool)' == ''">dotnet</DotNetTool>
<_ApiCompatPath>$(MSBuildThisFileDirectory)\..\tools\netcoreapp2.1\Microsoft.DotNet.ApiCompat.dll</_ApiCompatPath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericstj this path doesn't appear exist locally, and it gets resolved to:

"C:\Development\winforms\.dotnet\dotnet.exe" "C:\Development\winforms\eng\ApiCompatability\\..\tools\netcoreapp2.1\Microsoft.DotNet.ApiCompat.dll" @"C:\Development\winforms\artifacts\obj\Accessibility\Debug\netcoreapp3.1\apicompat.rsp" > C:\Development\winforms\src\Accessibility\src\ApiCompatBaseline.txt

Through binlog I found that there is a variable PkgMicrosoft_DotNet_ApiCompat that points to the NuGet package's folder, and then it resolves the path the the dll correctly, but I wonder whether it is the correct way to resolve the issue.

diff --git a/eng/ApiCompatability/PreviousReleaseApiCompat.targets b/eng/ApiCompatability/PreviousReleaseApiCompat.targets
index 1efc4fe4..4899064a 100644
--- a/eng/ApiCompatability/PreviousReleaseApiCompat.targets
+++ b/eng/ApiCompatability/PreviousReleaseApiCompat.targets
@@ -3,7 +3,7 @@
       <!-- If DotNetTool is undefined, we default to assuming 'dotnet' is on the path -->
     <DotNetTool Condition="'$(DotNetTool)' == ''">dotnet</DotNetTool>
-    <_ApiCompatPath>$(MSBuildThisFileDirectory)\..\tools\netcoreapp2.1\Microsoft.DotNet.ApiCompat.dll</_ApiCompatPath>
+    <_ApiCompatPath>$(PkgMicrosoft_DotNet_ApiCompat)\tools\netcoreapp2.1\Microsoft.DotNet.ApiCompat.dll</_ApiCompatPath>

I presume it was copied from https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.ApiCompat/build/Microsoft.DotNet.ApiCompat.targets#L9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a correct way to do it. To ensure that property is generated you can add GeneratePathProperty="true" on the PackageReference. See NuGet/Home#6949.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, this should be updated to use PkgMicrosoft_DotNet_ApiCompat as @RussKie suggests.

<_ApiCompatCommand>"$(DotNetTool)" "$(_ApiCompatPath)"</_ApiCompatCommand>

</PropertyGroup>

<!-- ApiCompat for Implementation Assemblies -->
<Target Name="ValidateApiCompatAgainstPreviousRelease"
Condition="'$(RunApiCompatAgainstPreviousReleaseForSrc)' == 'true' and '$(RunApiCompat)' == 'true'">

<Error Condition="'@(ResolvedMatchingPreviousReleaseContract)' == ''"
Text="ResolvedMatchingPreviousReleaseContract item must be specified to run API compat." />
<Error Condition="!Exists('%(ResolvedMatchingPreviousReleaseContract.FullPath)')"
Text="ResolvedMatchingPreviousReleaseContract '%(ResolvedMatchingPreviousReleaseContract.FullPath)' did not exist." />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericstj I'm not sure what ResolvedMatchingPreviousReleaseContract is supposed to be...

.\eng\ApiCompatability\PreviousReleaseApiCompat.targets(22,5): error : ResolvedMatchingPreviousReleaseContract item must be specified to run API compat. [.\eng\ApiCompatability\WinFormsStableAPIProject\WinFormsStableAPIProject.csproj]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's being defined here and fed into APICompat, it represents the last version of the project it's running against as a basis for comparison. I wouldn't expect it to be defined for WinFormsStableAPIProject since that's not actually a library you want to run APICompat against. I had chatted with Zach about this before. I don't think you should be setting flags that control this globally. Instead you probably want to define some convention for deciding which projects need to run this and only set the property for those projects.


<ItemGroup>
<_DependencyDirectoriesTemp Include="@(ReferencePath -> '%(RootDir)%(Directory)')" />
<!-- Remove duplicate directories by batching over them -->
<!-- Add project references first to give precedence to project-specific files -->
<_DependencyDirectories Condition="'%(_DependencyDirectoriesTemp.ReferenceSourceTarget)' == 'ProjectReference'" Include="%(_DependencyDirectoriesTemp.Identity)" />
<_DependencyDirectories Condition="'%(_DependencyDirectoriesTemp.ReferenceSourceTarget)' != 'ProjectReference'" Include="%(_DependencyDirectoriesTemp.Identity)" />
<_ContractDependencyDirectories Include="@(ResolvedMatchingPreviousReleaseContract -> '%(RootDir)%(Directory)')" />
<_ContractDependencyDirectories Include="@(ResolvedMatchingPreviousReleaseContract -> '%(DependencyPaths)')" />
<_ContractDependencyDirectories Include="$(ContractDependencyPaths)" />
</ItemGroup>

<PropertyGroup>
<PreviousReleaseApiCompatArgs>$(PreviousReleaseApiCompatArgs) --left-operand $(PreviousReleaseAPICompatLeftOperand) --right-operand $(PreviousReleaseAPICompatRightOperand)</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatArgs>$(PreviousReleaseApiCompatArgs) "@(ResolvedMatchingPreviousReleaseContract)"</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatArgs>$(PreviousReleaseApiCompatArgs) --contract-depends "@(_ContractDependencyDirectories, ','),"</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatArgs Condition="'$(PreviousReleaseApiCompatExcludeAttributeList)' != ''">$(PreviousReleaseApiCompatArgs) --exclude-attributes "$(PreviousReleaseApiCompatExcludeAttributeList)"</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatArgs Condition="'$(PreviousReleaseApiCompatEnforceOptionalRules)' == 'true'">$(PreviousReleaseApiCompatArgs) --enforce-optional-rules</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatArgs Condition="'$(BaselineAllAPICompatError)' != 'true' and Exists('$(PreviousReleaseApiCompatBaseline)')">$(PreviousReleaseApiCompatArgs) --baseline "$(PreviousReleaseApiCompatBaseline)"</PreviousReleaseApiCompatArgs>
<!-- Must be last option. -->
<PreviousReleaseApiCompatArgs>$(PreviousReleaseApiCompatArgs) --impl-dirs "$(IntermediateOutputPath),@(_DependencyDirectories, ','),"</PreviousReleaseApiCompatArgs>
<PreviousReleaseApiCompatBaselineAll Condition="'$(BaselineAllAPICompatError)' == 'true'">&gt; $(PreviousReleaseApiCompatBaseline)</PreviousReleaseApiCompatBaselineAll>
<ApiCompatExitCode>0</ApiCompatExitCode>

<PreviousReleaseApiCompatResponseFile>$(IntermediateOutputPath)apicompat.rsp</PreviousReleaseApiCompatResponseFile>
</PropertyGroup>

<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteLinesToFile File="$(PreviousReleaseApiCompatResponseFile)" Lines="$(PreviousReleaseApiCompatArgs)" Overwrite="true" />

<Exec Command="$(_ApiCompatCommand) @&quot;$(PreviousReleaseApiCompatResponseFile)&quot; $(PreviousReleaseApiCompatBaselineAll)"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>

<!--
To force incremental builds to show failures again we are invalidating
one compile input.
-->
<Touch Condition="'$(ApiCompatExitCode)' != '0'" Files="$(IntermediateOutputPath)$(_ApiCompatSemaphoreFile)" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed for '$(TargetPath)'" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="ResolveMatchingPreviousReleaseContract" BeforeTargets="ResolveAssemblyReferences" Condition="'$(AvoidRunningResolveMatchingPreviousReleaseContract)' == 'false'">
<Error Condition="!Exists('$(PreviousReleaseStableApiProject)')" Text="Error, failed to locate '$(PreviousReleaseStableApiProject)'" />
<MSBuild Projects="$(PreviousReleaseStableApiProject)"
Targets="GetPreviousReleaseContract"
Properties="ContractName=$(AssemblyName);TargetFramework=$(TargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="ResolveMatchingPreviousReleaseContract"/>
</MSBuild>
<PropertyGroup>
<ResolvedMatchingPreviousReleaseContract>%(ResolveMatchingPreviousReleaseContract.DependencyPaths)</ResolvedMatchingPreviousReleaseContract>
</PropertyGroup>
<PropertyGroup>
<RunPreviousReleaseApiCompatForSrc Condition="!Exists('@(ResolvedMatchingPreviousReleaseContract)')">false</RunPreviousReleaseApiCompatForSrc>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<PropertyGroup>
<AvoidRunningResolveMatchingPreviousReleaseContract>true</AvoidRunningResolveMatchingPreviousReleaseContract>
</PropertyGroup>

<PropertyGroup>
<!-- You should simply be able to change this in order to witness another version -->
<StableVersionToWitness>3.0.0</StableVersionToWitness>
</PropertyGroup>

<ItemGroup>
<!-- Control the version of the Ref Pack used via the WindowsDesktop SDK -->
<FrameworkReference
Update="Microsoft.NETCore.App"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should have been WindowsDesktop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to simplify this to look like a customer project from previous release with no CS / references.

TargetingPackVersion="$(StableVersionToWitness)"
RuntimeFrameworkVersion="$(StableVersionToWitness)" />
</ItemGroup>

<!-- The purpose of this target is to return a path from a referenced package / project -->
<Target Name="GetPreviousReleaseContract" DependsOnTargets="ResolveReferences" Returns="@(_contractReferencePath)">
<Error Condition="'$(ContractName)' == ''" Text="ContractName must be specified" />
<ItemGroup>
<_contractReferencePath Include="@(ReferencePath)" Condition="'%(FileName)' == '$(ContractName)'" />
<_allReferenceDirectories Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" />
<_contractReferencePath DependencyPaths="@(_allReferenceDirectories)" />
</ItemGroup>
</Target>

<Target Name="Build">
<!-- This will override the default Build target. -->
</Target>
<Target Name="Rebuild">
<!-- This will override the default Rebuild target. -->
</Target>
<Target Name="BuildAndTest">
<!-- This will override the default BuildAndTest target. -->
</Target>
<Target Name="RebuildAndTest">
<!-- This will override the default RebuildAndTest target. -->
</Target>

</Project>
Loading