Skip to content

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Jun 18, 2020

The introduction of _BlockWinMDsOnUnsupportedTFMs broke the WPF temp project generation, which broke PowerShell Core. This PR changes the target ordering so it doesn't destabilize the WPF targets.

I've validated that this change doesn't cause this target to be skipped on incremental builds.

Fixes #12093

cc: @rlander @AaronRobinsonMSFT @ryalanms @wli3 @dsplaisted

…gets ordering

The introduction of _BlockWinMDsOnUnsupportedTFMs broke the WPF temp project generation, which broke PowerShell Core. This PR changes the target ordering so it doesn't destabilize the WPF targets.

I've validated that this change doesn't cause this target to be skipped on incremental builds.

Fixes #12093

cc: @rlander @AaronRobinsonMSFT @ryalanms @wli3 @dsplaisted
@jkoritzinsky jkoritzinsky changed the title Change _BlockWinMDsOnUnsupportedTFMs dependencies to fix WPF temp tar… Change _BlockWinMDsOnUnsupportedTFMs dependencies to fix WPF temp targets ordering Jun 18, 2020
BeforeTargets="CoreCompile"
AfterTargets="PreBuildEvent"
DependsOnTargets="ResolveReferences"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '5.0'))">
Copy link
Member

Choose a reason for hiding this comment

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

@chsienki another case where work is predicated on netcoreapp versions. Should sync up to see if this is the preferred style and if so consider using in our code.

@wli3
Copy link

wli3 commented Jun 18, 2020

test?

@jkoritzinsky
Copy link
Member Author

To my understanding @ryalanms validated this change. Since the repro for this uses the WindowsDesktop SDK and requires a strong-named assembly, I'm not sure of the best way to add a test.

@ryalanms
Copy link
Member

I performed these steps:

1. Clone repository https://github.com/PowerShell/PowerShell.git
2. Update the global.json file to have `5.0.100-preview.6.20314.3`
3. In PowerShell (on Windows), `Import-Module .\build.psm1`
4. `Start-PSBootstrap` to install the Preview 6 SDK
5. Start-PSBuild -Clean (to repro the break)

Errors:

D:\PowerShell\src\System.Management.Automation\DscSupport\CimDSCParser.cs(323,17): error CS0122: 'CimMofDeserializer' is inaccessible due to its protection level [D:\PowerShell\src\System.Management.Automation\System.Management.Automation.csproj] D:\PowerShell\src\System.Management.Automation\DscSupport\CimDSCParser.cs(324,17): error CS0122: 'CimMofDeserializer' is inaccessible due to its protection level [D:\PowerShell\src\System.Management.Automation\System.Management.Automation.csproj]

6. Manually apply change to Microsoft.NET.Sdk.targets
 <Target Name="_BlockWinMDsOnUnsupportedTFMs"
          BeforeTargets="CoreCompile"
          DependsOnTargets="ResolveReferences"
 <Target Name="_BlockWinMDsOnUnsupportedTFMs"
          AfterTargets="PreBuildEvent"
          DependsOnTargets="ResolveReferences"
7.  Start-PSBuild -Clean

The build now succeeds.

@dsplaisted
Copy link
Member

To my understanding @ryalanms validated this change. Since the repro for this uses the WindowsDesktop SDK and requires a strong-named assembly, I'm not sure of the best way to add a test.

It should be possible to write a test. Tests in this repo can use the WindowsDesktop SDK, and should also be able to create a strong name.

@mmitche
Copy link
Member

mmitche commented Jun 18, 2020

Is this ready to go? I needs to be ASAP or we will miss p6.

@jkoritzinsky
Copy link
Member Author

It's ready. Daniel agreed to let me add a test in master after we merge this in.

@mmitche mmitche merged commit 3f8076a into release/5.0.1xx-preview6 Jun 18, 2020
jkoritzinsky added a commit to jkoritzinsky/dotnet-sdk that referenced this pull request Jun 30, 2020
jkoritzinsky added a commit to jkoritzinsky/dotnet-sdk that referenced this pull request Jun 30, 2020
@chucker
Copy link
Contributor

chucker commented Jul 23, 2020

Did this fix ship in preview 7? I'm trying to track down an issue that broke WPF compilation* for me after I installed .NET 5 preview 7. If I uninstall it, it works again.

*) in an Sdk-style project, but in .NET Framework 4.x, using MSBuild.Sdk.Extras

@jkoritzinsky
Copy link
Member Author

Yes, it got merged into Preview 7.

@jkoritzinsky jkoritzinsky deleted the jkoritzinsky/fix-target-ordering/5.0.100p6 branch July 23, 2020 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants