Skip to content

Commit

Permalink
Add mscorlib facade for refs consuming Windows.winmd
Browse files Browse the repository at this point in the history
Reference assemblies consuming Windows.winmd need to have
an mscorlib facade because Windows.winmd has references to
types in mscorlib.
  • Loading branch information
ericstj committed Aug 28, 2017
1 parent d9d42e3 commit 1f8756b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\external\winrt\winrt.depproj" />
<ProjectReference Include="..\..\mscorlib.WinRT-Facade\ref\mscorlib.WinRT-Facade.csproj" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
<ProjectReference Include="..\..\System.IO\ref\System.IO.csproj" />
Expand Down
8 changes: 8 additions & 0 deletions src/mscorlib.WinRT-Facade/ref/Configurations.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
uap;
</BuildConfigurations>
</PropertyGroup>
</Project>
33 changes: 33 additions & 0 deletions src/mscorlib.WinRT-Facade/ref/TypeForwards.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.CompilerServices;

// The following types are can be referenced by windows.winmd and are spec'ed to come from mscorlib
[assembly: TypeForwardedTo(typeof(System.Attribute))]
[assembly: TypeForwardedTo(typeof(System.Boolean))]
[assembly: TypeForwardedTo(typeof(System.Byte))]
[assembly: TypeForwardedTo(typeof(System.Char))]
[assembly: TypeForwardedTo(typeof(System.Double))]
[assembly: TypeForwardedTo(typeof(System.Enum))]
[assembly: TypeForwardedTo(typeof(System.FlagsAttribute))]
[assembly: TypeForwardedTo(typeof(System.Guid))]
[assembly: TypeForwardedTo(typeof(System.Int16))]
[assembly: TypeForwardedTo(typeof(System.Int32))]
[assembly: TypeForwardedTo(typeof(System.Int64))]
[assembly: TypeForwardedTo(typeof(System.IntPtr))]
[assembly: TypeForwardedTo(typeof(System.MulticastDelegate))]
[assembly: TypeForwardedTo(typeof(System.Object))]
[assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsConst))]
[assembly: TypeForwardedTo(typeof(System.Single))]
[assembly: TypeForwardedTo(typeof(System.String))]
[assembly: TypeForwardedTo(typeof(System.Type))]
[assembly: TypeForwardedTo(typeof(System.UInt16))]
[assembly: TypeForwardedTo(typeof(System.UInt32))]
[assembly: TypeForwardedTo(typeof(System.UInt64))]
[assembly: TypeForwardedTo(typeof(System.ValueType))]
[assembly: TypeForwardedTo(typeof(void))] // System.Void

// XAML compiler is checking for the following
[assembly: TypeForwardedTo(typeof(System.Array))]
19 changes: 19 additions & 0 deletions src/mscorlib.WinRT-Facade/ref/mscorlib.WinRT-Facade.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<UseECMAKey>true</UseECMAKey>
<!-- do not binplace, this is only used to help compile references
against Windows.winmd. The real mscorlib comes from src/shims/shims.proj -->
<BinPlaceRef>false</BinPlaceRef>
</PropertyGroup>
<ItemGroup>
<Compile Include="TypeForwards.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

0 comments on commit 1f8756b

Please sign in to comment.