Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Expose all APIs to netstandard builds #401

Merged
merged 7 commits into from
Sep 6, 2018
Merged

Expose all APIs to netstandard builds #401

merged 7 commits into from
Sep 6, 2018

Conversation

AArnott
Copy link
Collaborator

@AArnott AArnott commented Sep 2, 2018

This exposes all p/invoke APIs to all existing builds, including portable/netstandard.
It also adds an additional win8 target which omits the store-banned APIs.

In this way, someone targeting a combination of mono, .NET Framework, .NET Core, etc. can target portable/.netstandard and still get all the Windows APIs. By omitting the APIs from win8, when an actual app targeting the Microsoft Store is built, the banned APIs will be gone and not block store compliance checks. This could mean that if a library calls one of these banned methods, that the Store app will see a missing method exception at runtime.

Fixes #382

@clairernovotny
Copy link
Member

clairernovotny commented Sep 3, 2018

Are those Win8 banned API's allowed for Windows 10? I recall Win10 allowing additional API's for store apps.

Also, as Win8 requires VS 2015 and older SDK's to be present, is it "good enough" to target uap10.0 instead for this purpose?

@AArnott
Copy link
Collaborator Author

AArnott commented Sep 3, 2018

Are those Win8 banned API's allowed for Windows 10? I recall Win10 allowing additional API's for store apps.

No. The public documentation simply lists each API as banned or not without regard to which OS version. I have confirmed this with MSFT internally -- when they update the app submission compliance system to add allowed APIs, it allows them for all Windows 8/10 versions.

Also, as Win8 requires VS 2015 and older SDK's to be present, is it "good enough" to target uap10.0 instead for this purpose?

No. There are Win8 apps that consume P/Invoke.
But FWIW, I might not need to install VS 2015. So far I'm trying to install the Win8.1 SDK directly (and the UWP workload from VS2017, for my docker image). That may be all that's missing here.

@clairernovotny
Copy link
Member

You may want to use -UseBasicParsing as I understand that avoids the legacy engine:

https://github.com/onovotny/SignService/blob/master/scripts/Install-WindowsSdkISO.ps1#L48

@AArnott AArnott force-pushed the fix382 branch 3 times, most recently from 04ef123 to 3aa032a Compare September 3, 2018 15:33
We should take all trivia up to the nearest directive.

As it was, we were taking all trivia except directives, which means we were dropping #if/#endif but picking up the content between them when it was 'inactive' making it also trivia, till we excluded the directives and then we activated the code accidentally.

This was exposed when we updated to the latest codegeneration.roslyn package in order to fix some other directive handling.
@AArnott
Copy link
Collaborator Author

AArnott commented Sep 6, 2018

I filed NuGet/Home#7277 to track the last remaining build issue. I have no workaround in mind yet.

@clairernovotny
Copy link
Member

I thought that a blank GetPackagingOutputs was added to the common targets, because I recall needing that workaround with UWP in the past, so interesting to see that it's needed here? If that solves it, I can add that into the extras

@AArnott
Copy link
Collaborator Author

AArnott commented Sep 6, 2018

@onovotny Funny... I came to the same conclusion just in the last little while and filed novotnyllc/MSBuildSdkExtras#115

The GetPackagingOutputs target is defined as empty in the .NET SDK, but the win8 targets (and apparently UWP as well based on your comment) define it later in evaluation with a bunch of content.

@AArnott AArnott merged commit 674583f into master Sep 6, 2018
@AArnott AArnott deleted the fix382 branch September 6, 2018 16:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants