Skip to content

[netcore3] Open source PresentationBuildTasks #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 5, 2019
Merged
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 Documentation/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ See [Developer Guide](developer-guide.md) to learn how to develop changes for th

This project follows the general [.NET Core Contribution Guidelines](https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/contributing.md). The contribution bar from the general contribution guidelines is copied below.

## Do not change files in the `Shared` directory
## Do not change files in the `Shared`, `WindowsBase`, `PresentationCore`, and `PresentationFramework` directories

The directory [`src/Microsoft.DotNet.Wpf/src/Shared`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/Shared) contains files that are shared between the public GitHub repo and the internal WPF repos. Changes to files in this directory will *not* be accepted since they also affect internal code. Once all the appropriate source has been published to the public repo, this restriction will no longer be needed.
The directories [`src/Microsoft.DotNet.Wpf/src/Shared`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/Shared), [`src/Microsoft.DotNet.Wpf/src/WindowsBase`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/WindowsBase), [`src/Microsoft.DotNet.Wpf/src/PresentationCore`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/PresentationCore), [`src/Microsoft.DotNet.Wpf/src/PresentationFramework`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/PresentationFramework) contains files that are shared between the public GitHub repo and the internal WPF repos. Changes to files in this directory will *not* be accepted since they also affect internal code. Once all the appropriate sources have been published to the public repo, this restriction will no longer be needed.

## Contribution "Bar"

Expand All @@ -26,3 +26,13 @@ Maintainers will not merge changes that have narrowly-defined benefits due to co
Most .NET Core components are cross-platform and we appreciate contributions that either improve their feature set in a given environment or that add support for a new environment. We will typically not accept contributions that implement support for an OS-specific technolology on another operating system. For example, we do not intend to create an implementation of the Windows registry for Linux or an implementation of the macOS keychain for Windows. We also do not intend to accept contributions that provide cross-platform implementations for Windows Forms or WPF.

Contributions must also satisfy the other published guidelines defined in this document.

## Code Formatting Improvements and Minor Enhancements

We will consider code-formatting improvements that are identified by running code analyzers.

Our CodeAnalysis rules are not enabled by default. These can be enabled by setting the MSBuild property `EnableAnalyzers=true` (in commandline, it is set as `/p:EnableAnalyzers=true`).

The code analyzer would likely recommend changes that can result in changes to the generated IL. In general, we prefer code-formatting PR's to be limited to changes that do not have any impact on the IL - these are easier to review and approve and do not require additional testing.

Please open issues for changes that affect the IL or might require additional validation, and work with the project maintainers to determine whether a PR would be appropriate.
38 changes: 35 additions & 3 deletions Microsoft.Dotnet.Wpf.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Arcade.Wpf
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Wpf.ProjectTemplates.ArchNeutral", "packaging\Microsoft.Dotnet.Wpf.ProjectTemplates\Microsoft.DotNet.Wpf.ProjectTemplates.ArchNeutral.csproj", "{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Wpf.ProjectTemplates", "Microsoft.DotNet.Wpf.ProjectTemplates", "{891FF487-721B-4935-833A-F9ABFEB1E79D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PresentationBuildTasks", "src\Microsoft.DotNet.Wpf\src\PresentationBuildTasks\PresentationBuildTasks.csproj", "{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.NET.Sdk.WindowsDesktop", "Microsoft.NET.Sdk.WindowsDesktop", "{1D4C8AD7-12E7-4987-98AF-AEE79F53E494}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.WindowsDesktop.ArchNeutral", "packaging\Microsoft.NET.Sdk.WindowsDesktop\Microsoft.NET.Sdk.WindowsDesktop.ArchNeutral.csproj", "{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Wpf.ProjectTemplates", "Microsoft.DotNet.Wpf.ProjectTemplates", "{22D643D8-87D6-4FE8-9632-58A3CD3DC7CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -91,6 +97,30 @@ Global
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x64.Build.0 = Release|x64
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x86.ActiveCfg = Release|Any CPU
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0}.Release|x86.Build.0 = Release|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|x64.ActiveCfg = Debug|x64
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|x64.Build.0 = Debug|x64
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|x86.ActiveCfg = Debug|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Debug|x86.Build.0 = Debug|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|Any CPU.Build.0 = Release|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|x64.ActiveCfg = Release|x64
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|x64.Build.0 = Release|x64
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|x86.ActiveCfg = Release|Any CPU
{4216C2EA-E2B9-4FB2-9803-F73FDC64CAC4}.Release|x86.Build.0 = Release|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|x64.ActiveCfg = Debug|x64
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|x64.Build.0 = Debug|x64
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Debug|x86.Build.0 = Debug|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|Any CPU.Build.0 = Release|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|x64.ActiveCfg = Release|x64
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|x64.Build.0 = Release|x64
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|x86.ActiveCfg = Release|Any CPU
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -101,8 +131,10 @@ Global
{9A7E395B-E859-40E2-809D-EFB72CF3A2EE} = {BF20132A-191F-4D34-9A1B-831772A6DFCF}
{8A2ABE39-2D50-48CA-AC32-078BBA32757A} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3} = {8A2ABE39-2D50-48CA-AC32-078BBA32757A}
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0} = {891FF487-721B-4935-833A-F9ABFEB1E79D}
{891FF487-721B-4935-833A-F9ABFEB1E79D} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
{BFF6C118-3369-43B5-ACA6-D65ED00EEBE0} = {22D643D8-87D6-4FE8-9632-58A3CD3DC7CB}
{1D4C8AD7-12E7-4987-98AF-AEE79F53E494} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
{440D06B8-E3DE-4C0D-AD25-CD4F43D836E1} = {1D4C8AD7-12E7-4987-98AF-AEE79F53E494}
{22D643D8-87D6-4FE8-9632-58A3CD3DC7CB} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D4D12991-F531-4FC3-849D-29946BCA818A}
Expand Down
4 changes: 2 additions & 2 deletions eng/WpfArcadeSdk/tools/ShippingProjects.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project>
<PropertyGroup>
<ExternalShippingProjects>
System.Xaml
System.Xaml;
PresentationBuildTasks
</ExternalShippingProjects>

<InternalShippingProjects>
PresentationBuildTasks;
PresentationCore;
DirectWriteForwarder;
PresentationCore-CommonResources;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{440d06b8-e3de-4c0d-ad25-cd4f43d836e1}</ProjectGuid>
<TargetFramework>netcoreapp3.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<IsShippingPackage>true</IsShippingPackage>
<VersionPrefix>3.0.0</VersionPrefix>
</PropertyGroup>

<PropertyGroup>
<!--
PlatformIndependentPackage = true means that this package does
not require the automatic generation of a runtime.json file using
the Bait & Switch technique to reference RID specific packages
-->
<PlatformIndependentPackage>true</PlatformIndependentPackage>
</PropertyGroup>

<PropertyGroup>
<PackageName>$(MSBuildProjectName.Replace('.ArchNeutral',''))</PackageName>
<AssemblyName>$(PackageName</AssemblyName>
<PackageDescription>WindowsDesktop SDK</PackageDescription>
</PropertyGroup>

<ItemGroup>
<PackagingContent Include="Sdk\*" SubFolder="root\Sdk" />
<PackagingContent Include="targets\*" SubFolder="root\targets" />
<PackagingContent Include="useSharedDesignerContext.txt" SubFolder="root" />
</ItemGroup>
</Project>
29 changes: 29 additions & 0 deletions packaging/Microsoft.NET.Sdk.WindowsDesktop/Sdk/Sdk.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
***********************************************************************************************
Sdk.props

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project>

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />

<!-- The MicrosoftWindowsDesktopSdkPath is a hook so that you can redirect to a local version of the WPF SDK targets
(ie in order to test changes locally) without modifying the .NET Core SDK itself. This should work
as long as there are no changes to Sdk.props and Sdk.targets themselves. -->
<PropertyGroup Condition="'$(MicrosoftWindowsDesktopSdkPath)' == ''">
<MicrosoftWindowsDesktopSdkPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\targets))</MicrosoftWindowsDesktopSdkPath>
</PropertyGroup>

<Import Project="$(MicrosoftWindowsDesktopSdkPath)\Microsoft.NET.Sdk.WindowsDesktop.props "/>

</Project>
22 changes: 22 additions & 0 deletions packaging/Microsoft.NET.Sdk.WindowsDesktop/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
***********************************************************************************************
Sdk.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project>

<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />

<Import Project="$(MicrosoftWindowsDesktopSdkPath)\Microsoft.NET.Sdk.WindowsDesktop.targets "/>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<Project>

<ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' And '$(UseWPF)' == 'true'">
<ApplicationDefinition Include="App.xaml"
Condition="'$(EnableDefaultApplicationDefinition)' != 'false' And Exists('$(MSBuildProjectDirectory)/App.xaml')">
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>

<None Remove="@(ApplicationDefinition)"
Condition="'$(EnableDefaultApplicationDefinition)' != 'false'" />

<Page Include="**/*.xaml"
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(ApplicationDefinition)"
Condition="'$(EnableDefaultPageItems)' != 'false'" >
<Generator>MSBuild:Compile</Generator>
</Page>

<None Remove="@(Page)"
Condition="'$(EnableDefaultPageItems)' != 'false'" />
</ItemGroup>

<ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<FrameworkReference Include="Microsoft.WindowsDesktop.App" IsImplicitlyDefined="true" />
</ItemGroup>

<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWPF)' == 'true' ">
<_SDKImplicitReference Include="WindowsBase"/>
<_SDKImplicitReference Include="PresentationCore"/>
<_SDKImplicitReference Include="PresentationFramework"/>
<_SDKImplicitReference Include="System.Windows.Controls.Ribbon"/>
<_SDKImplicitReference Include="System.Xaml"/>
<_SDKImplicitReference Include="UIAutomationClient"/>
<_SDKImplicitReference Include="UIAutomationClientSideProviders"/>
<_SDKImplicitReference Include="UIAutomationProvider"/>
<_SDKImplicitReference Include="UIAutomationTypes"/>
</ItemGroup>

<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWindowsForms)' == 'true' ">
<_SDKImplicitReference Include="System.Windows.Forms"/>
</ItemGroup>

<ItemGroup Condition=" '$(DisableImplicitFrameworkReferences)' != 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(UseWindowsForms)' == 'true' And '$(UseWPF)' == 'true' ">
<_SDKImplicitReference Include="WindowsFormsIntegration"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project>

<!--
For now, UseLegacyPresentationBuildTasks=true can be used to use the in-box framework
PresentationBuildTasks and targets when running in full framework MSBuild. This is
just an escape hatch while the new PresentationBuildTasks bake.

When we remove this,we can remove the correpsonding corresponding mscorlib swap targets in
Microsoft.DesktopUI.App.targets, and the production of ref-mscorlib shims
-->
<Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets"
Condition ="'$(MSBuildRuntimeType)' != 'Core' and '$(UseLegacyPresentationBuildTasks)' == 'true'"/>

<Import Project="Microsoft.WinFX.targets"
Condition="'$(MSBuildRuntimeType)' == 'Core' or '$(UseLegacyPresentationBuildTasks)' != 'true'" />

<ItemGroup Condition=" '$(EnableDefaultItems)' == 'true' And '$(UseWPF)' == 'true'">

<!-- In the WindowsDesktop .props, we globbed all .xaml files as Page items. If any of those files are included
as Resource, Content, or None items, then remove them from the Page items. -->
<Page Remove="@(Resource);@(Content);@(None)"
Condition="'$(EnableDefaultPageItems)' != 'false'" />
</ItemGroup>

<!-- Generate error if there are duplicate page items. The task comes from the .NET SDK, and this target follows
the pattern in the CheckForDuplicateItems task, where the .NET SDK checks for duplicate items for the item
types it knows about. -->
<Target Name="CheckForDuplicatePageItems" BeforeTargets="_CheckForInvalidConfigurationAndPlatform;CoreCompile"
DependsOnTargets="CheckForDuplicateItems"
Condition="'$(UseWPF)' == 'true'">

<CheckForDuplicateItems
Items="@(Page)"
ItemName="Page"
DefaultItemsEnabled="$(EnableDefaultItems)"
DefaultItemsOfThisTypeEnabled="$(EnableDefaultPageItems)"
PropertyNameToDisableDefaultItems="EnableDefaultPageItems"
MoreInformationLink="$(DefaultItemsMoreInformationLink)"
ContinueOnError="$(CheckForDuplicateItemsContinueOnError)">
<Output TaskParameter="DeduplicatedItems" ItemName="DeduplicatedPageItems" />
</CheckForDuplicateItems>

<ItemGroup Condition="'$(DesignTimeBuild)' == 'true' And '@(DeduplicatedPageItems)' != ''">
<Page Remove="@(Page)" />
<Page Include="@(DeduplicatedPageItems)" />
</ItemGroup>

</Target>

</Project>
Empty file.
13 changes: 11 additions & 2 deletions src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ namespace MS.Internal.PresentationCore
namespace MS.Utility
#elif AUTOMATION
namespace MS.Internal.Automation
#elif REACHFRAMEWORK
namespace System.Windows.Xps
#elif PRESENTATIONFRAMEWORK
namespace System.Windows
#elif PRESENTATIONUI
namespace System.Windows.TrustUI
#elif WINDOWSFORMSINTEGRATION
namespace System.Windows
#elif RIBBON_IN_FRAMEWORK
namespace Microsoft.Windows.Controls
#else
namespace System
#endif
{

internal partial class SR
{
private static ResourceManager ResourceManager => SRID.ResourceManager;
Expand Down Expand Up @@ -90,4 +99,4 @@ internal static string Format(string resourceFormat, object p1, object p2, objec
return string.Format(resourceFormat, p1, p2, p3);
}
}
}
}
1 change: 0 additions & 1 deletion src/Microsoft.DotNet.Wpf/src/Directory.Build.Props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<GenerateResourcesCodeAsConstants>true</GenerateResourcesCodeAsConstants>
<WpfSharedDir>$(MSBuildThisFileDirectory)Shared\</WpfSharedDir>
<WpfCommonDir>$(MSBuildThisFileDirectory)Common\</WpfCommonDir>
<WpfGraphicsPath>$(MSBuildThisFileDirectory)WpfGfx\</WpfGraphicsPath>
<WpfGraphicsDir>$(WpfGraphicsPath)</WpfGraphicsDir>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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;

namespace MS.Internal
{

internal enum LocalizationDirectivesToLocFile
{
None, // No Localization file generated.
CommentsOnly, // Put the Localization comments to .loc file.
All, // Put the localization comments and attributes to .loc file.
Unknown
}
}

Loading