Skip to content

Commit

Permalink
Add Accessibility.dll to WinForms (#593)
Browse files Browse the repository at this point in the history
* Add Accessibility.dll to WinForms

This is a primary interop assembly for OLEACC.dll.

It's needed because both Winforms and WPF expose public types that depend on the
COM interop types in OLEACC so they cannot embed the types.

* Move RestoreSources to eng\Versions.props

* Don't call ComputeIntermediateSatelliteAssemblies

Calling this target directly can cause it to run out of order.  This was
happening when the pkg project built before source, and was causing
CreateManifestResourceNames to remove all EmbeddedResources here
https://github.com/Microsoft/msbuild/blob/d42d3504057ef2b88dd4f68c4bfc5591371bd6fe/src/Tasks/Microsoft.CSharp.CurrentVersion.targets#L121
because we hadn't run the targets that set %(EmbeddedResource.Type).

Instead of doing this depend on the BuildOutputGroup.
Output groups are meant to be safe to call in isolation, so they should
always fully specify their target dependency chain to produce the
correct items without modifying the project state.

* Update to latest IL SDK

And remove workaround for ILProj loading in VS.

* number readme

* Workaround Accessibility missing PDB

Missing PDB was resulting in a failure during builds when attempting to
push symbols.

* Newlines
  • Loading branch information
ericstj authored and zsd4yr committed Mar 18, 2019
1 parent 389b83d commit 2fc563f
Show file tree
Hide file tree
Showing 14 changed files with 926 additions and 8 deletions.
3 changes: 2 additions & 1 deletion NuGet.Config
Expand Up @@ -4,6 +4,7 @@
<clear />
<add key="arcade" value="https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json" />
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="dotnet-coreclr" value="https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
</configuration>
20 changes: 20 additions & 0 deletions Winforms.sln
Expand Up @@ -41,6 +41,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Facade", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternalUtilitiesForTests", "src\Common\tests\InternalUtilitiesForTests\InternalUtilitiesForTests.csproj", "{3603561D-907D-494B-9E3C-29D7001018F6}"
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}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accessibility", "Accessibility", "{088DD24C-DF6B-45F3-A8BC-592580A4B2A9}"
ProjectSection(SolutionItems) = preProject
src\Accessibility\readme.md = src\Accessibility\readme.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -99,6 +108,14 @@ Global
{3603561D-907D-494B-9E3C-29D7001018F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3603561D-907D-494B-9E3C-29D7001018F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3603561D-907D-494B-9E3C-29D7001018F6}.Release|Any CPU.Build.0 = Release|Any CPU
{351D8601-6E21-45E8-B3B9-847C4540BD4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{351D8601-6E21-45E8-B3B9-847C4540BD4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{351D8601-6E21-45E8-B3B9-847C4540BD4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{351D8601-6E21-45E8-B3B9-847C4540BD4E}.Release|Any CPU.Build.0 = Release|Any CPU
{6103E743-057D-41C6-946C-23A751A08748}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6103E743-057D-41C6-946C-23A751A08748}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6103E743-057D-41C6-946C-23A751A08748}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6103E743-057D-41C6-946C-23A751A08748}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -119,6 +136,9 @@ Global
{238195CE-7CCE-4469-ACD8-EA00E88D947A} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A}
{F1B0790A-1A40-4487-A607-36D21D827E44} = {434C00C3-E498-4BA7-9764-9F0FC8CFE457}
{3603561D-907D-494B-9E3C-29D7001018F6} = {DF68A171-D27B-4E6A-8A7E-63A651622355}
{351D8601-6E21-45E8-B3B9-847C4540BD4E} = {088DD24C-DF6B-45F3-A8BC-592580A4B2A9}
{6103E743-057D-41C6-946C-23A751A08748} = {088DD24C-DF6B-45F3-A8BC-592580A4B2A9}
{088DD24C-DF6B-45F3-A8BC-592580A4B2A9} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136}
Expand Down
2 changes: 1 addition & 1 deletion eng/CodeStyle.targets
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-beta.61" PrivateAssets="all" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" Visible="false" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions eng/Version.Details.xml
Expand Up @@ -61,5 +61,15 @@ Note: if the Uri is a new place, you will need to add a subscription from that p
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>443dea11f8649fe12fedf60cfab0a4b2b20bd153</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.IL" Version="3.0.0-preview4-27515-71">
<Uri>https://github.com/dotnet/coreclr</Uri>
<Sha>68fad02f41707a5333992cd7701e75aefb4e51c8</Sha>
<SourceBuildId>5596</SourceBuildId>
</Dependency>
<Dependency Name="Microsoft.NETCore.ILAsm" Version="3.0.0-preview4-27515-71">
<Uri>https://github.com/dotnet/coreclr</Uri>
<Sha>68fad02f41707a5333992cd7701e75aefb4e51c8</Sha>
<SourceBuildId>5596</SourceBuildId>
</Dependency>
</ToolsetDependencies>
</Dependencies>
10 changes: 9 additions & 1 deletion eng/Versions.props
Expand Up @@ -6,6 +6,11 @@
<PreReleaseVersionLabel>preview4</PreReleaseVersionLabel>
<!-- Use the compiler in the CLI instead of in the sdk, since the sdk one doesn't work with netcoreapp3.0 yet -->
<UsingToolMicrosoftNetCompilers>false</UsingToolMicrosoftNetCompilers>
<!-- Additional sources required for restore of PackageReferences -->
<RestoreSources>
$(RestoreSources);
https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json
</RestoreSources>
</PropertyGroup>
<!-- Corefx-updated dependencies -->
<PropertyGroup>
Expand All @@ -19,6 +24,10 @@
<SystemWindowsExtensionsPackageVersion>4.6.0-preview4.19164.7</SystemWindowsExtensionsPackageVersion>
<MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview4.19164.7</MicrosoftNETCorePlatformsPackageVersion>
</PropertyGroup>
<!-- CoreCLR-updated dependencies -->
<PropertyGroup>
<MicrosoftNETCoreILAsmPackageVersion>3.0.0-preview4-27515-71</MicrosoftNETCoreILAsmPackageVersion>
</PropertyGroup>
<!-- Arcade-updated dependencies -->
<PropertyGroup>
<MicrosoftDotNetGenFacadesPackageVersion>1.0.0-beta.19162.7</MicrosoftDotNetGenFacadesPackageVersion>
Expand All @@ -41,7 +50,6 @@
</PropertyGroup>
<!-- Additional unchanging dependencies -->
<PropertyGroup>
<AccessibilityPackageVersion>4.6.0-alpha-27122-5</AccessibilityPackageVersion>
<MoqPackageVersion>4.10.0</MoqPackageVersion>
<MicrosoftTargetingPackNETFrameworkv472PackageVersion>1.0.0</MicrosoftTargetingPackNETFrameworkv472PackageVersion>
</PropertyGroup>
Expand Down
7 changes: 4 additions & 3 deletions eng/packageContent.targets
Expand Up @@ -12,15 +12,16 @@
</PropertyGroup>

<Target Name="GetPackageContent"
DependsOnTargets="ComputeIntermediateSatelliteAssemblies"
DependsOnTargets="SatelliteDllsProjectOutputGroup"
Returns="@(PackageFile)">
<ItemGroup>
<PackageFile Include="$(TargetPath)" PackagePath="$(PackagePath)" />
<PackageFile Condition="'$(IncludePdbInPackage)' == 'true'" Include="$(TargetDir)$(TargetName).pdb" PackagePath="$(PackagePath)" />
<PackageFile Condition="'$(ProduceReferenceAssembly)' == 'true'" Include="$(TargetRefPath)" PackagePath="$(RefPackagePath)" />
<PackageFile Condition="'$(PackageAsRefAndLib)' == 'true'" Include="$(TargetPath)" PackagePath="$(RefPackagePath)" />
<PackageFile Condition="'$(IncludeResourcesInPackage)' == 'true'"
Include="@(IntermediateSatelliteAssembliesWithTargetPath->'$(TargetDir)%(Culture)\%(Filename)%(Extension)')"
PackagePath="$(PackagePath)/%(IntermediateSatelliteAssembliesWithTargetPath.Culture)" />
Include="@(SatelliteDllsProjectOutputGroupOutput->'%(FinalOutputPath)')"
PackagePath="$(PackagePath)/%(SatelliteDllsProjectOutputGroupOutput.Culture)" />
</ItemGroup>
</Target>

Expand Down
3 changes: 2 additions & 1 deletion global.json
Expand Up @@ -10,6 +10,7 @@
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19162.7",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19162.7"
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19162.7",
"Microsoft.NET.Sdk.IL": "3.0.0-preview4-27515-71"
}
}
2 changes: 2 additions & 0 deletions pkg/Microsoft.Private.Winforms.csproj
Expand Up @@ -68,6 +68,8 @@

<!-- Reference and Source System.Windows.Forms.Design.Editors includes -->
<ProjectReference Include="..\src\System.Windows.Forms.Design.Editors\src\System.Windows.Forms.Design.Editors.csproj" />

<ProjectReference Include="..\src\Accessibility\src\Accessibility.ilproj" />
</ItemGroup>

<!-- Force the output item type for all project references to "TfmSpecificPackageFile", which makes them get packed -->
Expand Down
28 changes: 28 additions & 0 deletions src/Accessibility/readme.md
@@ -0,0 +1,28 @@
# Accessibility

This directory contains source files used to build Accessibility.dll, the managed wrapper for COM accessibility interface.

See https://docs.microsoft.com/en-us/dotnet/api/accessibility

Source in this directory is generated by a tool and **should not be modified directly**.

To produce the IL source the following process is used:
1. Use http://aka.ms/tlbimp to generate an assembly for oleacc.dll

```cmd
tlbimp c:\windows\system32\oleacc.dll /out:Accessibility.dll
```

2. Use ildasm to disassemble that assembly.

```cmd
ildasm Accessibility.dll /out=Accessibility.il
```

3. Replace the desktop assembly references with their corresponding .NETCore assemblies (since .NETCore doesn't provide a version of tlbimp.exe yet)
- replace `[mscorlib]System.Runtime.InteropServices` with `[INTEROP_ASSEMBLY]System.Runtime.InteropServices`
- replace `[mscorlib]` with `[CORE_ASSEMBLY]`
- review the diff

4. Add assembly level attributes to the IL

0 comments on commit 2fc563f

Please sign in to comment.