Browse Source

Stop supporting ASP.NET Core 2.3 and remove the .NET Framework 4.6.2/4.7.2, .NET Standard 2.0/2.1 and UAP TFMs

Kévin Chalet 1 month ago
parent
commit
ae8da3644a
  1. 37
      Directory.Build.props
  2. 114
      Directory.Build.targets
  3. 309
      Directory.Packages.props
  4. 3
      OpenIddict.slnx
  5. 13
      eng/AfterTargetFrameworkInference.targets
  6. 6
      eng/Tools.props
  7. BIN
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll
  8. 181
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.CPP.targets
  9. 47
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.CSharp.targets
  10. 664
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.Common.targets
  11. 52
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.Cps.targets
  12. 48
      eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.VisualBasic.targets
  13. BIN
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Build.Tasks.dll
  14. 174
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.CPP.targets
  15. 61
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.CSharp.targets
  16. 753
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Common.targets
  17. 52
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Cps.targets
  18. 73
      eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.VisualBasic.targets
  19. 204
      eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.CPP.targets
  20. 61
      eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.CSharp.targets
  21. 142
      eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.Common.targets
  22. 52
      eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.Cps.targets
  23. 73
      eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.VisualBasic.targets
  24. 38
      eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.CPP.targets
  25. 5
      eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.CSharp.targets
  26. 49
      eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.Common.targets
  27. 5
      eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.VisualBasic.targets
  28. 181
      eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.AllFilesInProjectFolder.targets
  29. 242
      eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.AllFilesInTheProject.targets
  30. 445
      eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets
  31. 59
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FPSE.targets
  32. 60
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FTP.targets
  33. 116
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FileSystem.targets
  34. 49
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.MsDeploy.targets
  35. 54
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.Package.targets
  36. 1192
      eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.MsDeploy.Common.targets
  37. 459
      eng/msbuild/web/Web/Microsoft.DNX.Publishing.targets
  38. BIN
      eng/msbuild/web/Web/Microsoft.Web.Publishing.Tasks.dll
  39. 4802
      eng/msbuild/web/Web/Microsoft.Web.Publishing.targets
  40. 300
      eng/msbuild/web/Web/Microsoft.Web.Publishing/ImportAfter/Microsoft.Web.AzureAD.Publishing.targets
  41. BIN
      eng/msbuild/web/Web/Microsoft.Web.XmlTransform.dll
  42. 530
      eng/msbuild/web/Web/Microsoft.WebSite.Publishing.targets
  43. 101
      eng/msbuild/web/Web/Powershell/1.0.1/default-publish.ps1
  44. 13
      eng/msbuild/web/Web/Powershell/1.0.1/filesystem.pubxml
  45. 13
      eng/msbuild/web/Web/Powershell/1.0.1/package.pubxml
  46. 658
      eng/msbuild/web/Web/Powershell/1.0.1/publish-module.psm1
  47. 774
      eng/msbuild/web/Web/Transform/Microsoft.Web.Publishing.AspNetCompileMerge.targets
  48. BIN
      eng/msbuild/web/WebApplications/Microsoft.WebApplication.Build.Tasks.Dll
  49. 396
      eng/msbuild/web/WebApplications/Microsoft.WebApplication.targets
  50. 10
      gen/OpenIddict.Client.WebIntegration.Generators/OpenIddict.Client.WebIntegration.Generators.csproj
  51. 49
      gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs
  52. 10
      global.json
  53. 3
      sandbox/OpenIddict.Sandbox.AspNet.Client/OpenIddict.Sandbox.AspNet.Client.csproj
  54. 42
      sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config
  55. 3
      sandbox/OpenIddict.Sandbox.AspNet.Server/OpenIddict.Sandbox.AspNet.Server.csproj
  56. 38
      sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config
  57. 7
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Controllers/AuthenticationController.cs
  58. 3
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Controllers/HomeController.cs
  59. 15
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/OpenIddict.Sandbox.AspNetCore.Client.csproj
  60. 386
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Program.cs
  61. 432
      sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs
  62. 7
      sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthenticationController.cs
  63. 28
      sandbox/OpenIddict.Sandbox.AspNetCore.Server/Helpers/AsyncEnumerableExtensions.cs
  64. 15
      sandbox/OpenIddict.Sandbox.AspNetCore.Server/OpenIddict.Sandbox.AspNetCore.Server.csproj
  65. 383
      sandbox/OpenIddict.Sandbox.AspNetCore.Server/Program.cs
  66. 405
      sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs
  67. 26
      sandbox/OpenIddict.Sandbox.Console.Client/App.config
  68. 9
      sandbox/OpenIddict.Sandbox.Console.Client/InteractiveService.cs
  69. 46
      sandbox/OpenIddict.Sandbox.Console.Client/Models/ApplicationDbContext.cs
  70. 34
      sandbox/OpenIddict.Sandbox.Console.Client/OpenIddict.Sandbox.Console.Client.csproj
  71. 27
      sandbox/OpenIddict.Sandbox.Console.Client/Program.cs
  72. 1
      sandbox/OpenIddict.Sandbox.Maui.Client/MauiProgram.cs
  73. 24
      sandbox/OpenIddict.Sandbox.WinForms.Client/App.config
  74. 18
      sandbox/OpenIddict.Sandbox.WinForms.Client/MainForm.cs
  75. 46
      sandbox/OpenIddict.Sandbox.WinForms.Client/Models/ApplicationDbContext.cs
  76. 33
      sandbox/OpenIddict.Sandbox.WinForms.Client/OpenIddict.Sandbox.WinForms.Client.csproj
  77. 31
      sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs
  78. 26
      sandbox/OpenIddict.Sandbox.Wpf.Client/App.config
  79. 47
      sandbox/OpenIddict.Sandbox.Wpf.Client/Models/ApplicationDbContext.cs
  80. 33
      sandbox/OpenIddict.Sandbox.Wpf.Client/OpenIddict.Sandbox.Wpf.Client.csproj
  81. 32
      sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs
  82. 4
      shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj
  83. 624
      shared/OpenIddict.Extensions/OpenIddictHelpers.cs
  84. 170
      shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
  85. 24
      src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj
  86. 128
      src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs
  87. 2
      src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj
  88. 20
      src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj
  89. 2
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreConfiguration.cs
  90. 15
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs
  91. 14
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs
  92. 14
      src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs
  93. 14
      src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj
  94. 20
      src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj
  95. 5
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs
  96. 2
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs
  97. 6
      src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationPipeListener.cs
  98. 9
      src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj
  99. 23
      src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpContext.cs
  100. 6
      src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj

37
Directory.Build.props

@ -92,72 +92,39 @@
<SupportsWindowsTargeting
Condition=" '$(SupportsWindowsTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) ">true</SupportsWindowsTargeting>
<!--
Note: the .NET Core 5.0 reference assemblies or UWP contract assemblies may not be available if
the Windows SDK is not installed (or if a different version is installed). To ensure the solution
can be built on machines that don't have the UWP tooling installed, directory checks are used to
ensure the reference and contract assemblies are present on the machine before targeting uap10.0.
-->
<SupportsUniversalWindowsPlatformTargeting
Condition=" '$(SupportsUniversalWindowsPlatformTargeting)' == '' And $([System.OperatingSystem]::IsWindows()) And
('$(GITHUB_ACTIONS)' == 'true' Or (Exists('$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETCore\v5.0') And
Exists('$(MSBuildProgramFiles32)\Windows Kits\10\References\10.0.17763.0'))) ">true</SupportsUniversalWindowsPlatformTargeting>
<NetFrameworkTargetFrameworks Condition=" '$(NetFrameworkTargetFrameworks)' == '' ">
net462;
net472;
net48
</NetFrameworkTargetFrameworks>
<NetCoreTargetFrameworks Condition=" '$(NetCoreTargetFrameworks)' == '' ">
net8.0;
net9.0;
net10.0
</NetCoreTargetFrameworks>
<NetCoreAndroidTargetFrameworks
Condition=" '$(NetCoreAndroidTargetFrameworks)' == '' And '$(SupportsAndroidTargeting)' == 'true' ">
net9.0-android;
net10.0-android
</NetCoreAndroidTargetFrameworks>
<NetCoreIOSTargetFrameworks
Condition=" '$(NetCoreIOSTargetFrameworks)' == '' And '$(SupportsIOSTargeting)' == 'true' ">
net9.0-ios;
net10.0-ios
</NetCoreIOSTargetFrameworks>
<NetCoreMacCatalystTargetFrameworks
Condition=" '$(NetCoreMacCatalystTargetFrameworks)' == '' And '$(SupportsMacCatalystTargeting)' == 'true' ">
net9.0-maccatalyst;
net10.0-maccatalyst
</NetCoreMacCatalystTargetFrameworks>
<NetCoreMacOSTargetFrameworks
Condition=" '$(NetCoreMacOSTargetFrameworks)' == '' And '$(SupportsMacOSTargeting)' == 'true' ">
net9.0-macos;
net10.0-macos
</NetCoreMacOSTargetFrameworks>
<NetCoreWindowsTargetFrameworks
Condition=" '$(NetCoreWindowsTargetFrameworks)' == '' And '$(SupportsWindowsTargeting)' == 'true' ">
net8.0-windows7.0;
net8.0-windows10.0.17763;
net9.0-windows7.0;
net9.0-windows10.0.17763;
net10.0-windows7.0;
net10.0-windows10.0.17763
</NetCoreWindowsTargetFrameworks>
<NetStandardTargetFrameworks Condition=" '$(NetStandardTargetFrameworks)' == '' ">
netstandard2.0;
netstandard2.1
</NetStandardTargetFrameworks>
<UniversalWindowsPlatformTargetFrameworks
Condition=" '$(UniversalWindowsPlatformTargetFrameworks)' == '' And '$(SupportsUniversalWindowsPlatformTargeting)' == 'true' ">
uap10.0.17763
</UniversalWindowsPlatformTargetFrameworks>
</PropertyGroup>
<PropertyGroup>
@ -176,10 +143,8 @@
<PropertyGroup>
<RepoRelativeProjectDir>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</RepoRelativeProjectDir>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<AfterTargetFrameworkInferenceTargets>$(MSBuildThisFileDirectory)eng\AfterTargetFrameworkInference.targets</AfterTargetFrameworkInferenceTargets>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddTfmSpecificPlaceholders</TargetsForTfmSpecificContentInPackage>
<WebApplicationsTargetPath>$(MSBuildThisFileDirectory)eng\msbuild\web\WebApplications\Microsoft.WebApplication.targets</WebApplicationsTargetPath>
</PropertyGroup>
<!--

114
Directory.Build.targets

@ -16,27 +16,20 @@
</PropertyGroup>
<!--
Note: the trimming and Native AOT analyzers are only supported on .NET. Since the OpenIddict
Entity Framework 6.x and Entity Framework Core stores internally use new trimming/AOT-friendly
TypeDescriptor APIs introduced in .NET 9.0, only the .NET 9.0+ TFMs are marked as AOT-compatible.
Note: the trimming and Native AOT analyzers are only supported on .NET.
-->
<PropertyGroup
Condition=" $(RepoRelativeProjectDir.Contains('src')) And
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '9.0')) ">
<PropertyGroup Condition=" $(RepoRelativeProjectDir.Contains('src')) And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<!--
Note: .NET Native, .NET Framework and .NET Standard assemblies are not annotated with
nullable references annotations. To avoid errors on these target frameworks, related
warnings are disabled by setting <Nullable> to "annotations" instead of "enable".
Note: .NET Framework assemblies are not annotated with nullable references
annotations. To avoid errors on these target frameworks, related warnings
are disabled by setting <Nullable> to "annotations" instead of "enable".
-->
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' Or
'$(TargetFrameworkIdentifier)' == '.NETFramework' Or
'$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<Nullable>annotations</Nullable>
</PropertyGroup>
@ -48,84 +41,29 @@
<SupportedOSPlatformVersion Condition=" '$(TargetPlatformIdentifier)' == 'Windows' ">7.0</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<DefineConstants>$(DefineConstants);SUPPORTS_NAMED_PIPE_CONSTRUCTOR_WITH_ACL</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<DefineConstants>$(DefineConstants);SUPPORTS_APPLICATION_CONFIGURATION_INITIALIZATION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_AUTHENTICATION_HANDLER_TIME_PROVIDER_ARGUMENT</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_AUTHORIZATION_MIDDLEWARE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_BCL_ASYNC_ENUMERABLE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_BULK_DBSET_OPERATIONS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_DBSET_VALUETASK_FINDASYNC</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ENDPOINT_ROUTING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ENVIRONMENT_PROCESS_PATH</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_BROTLI_COMPRESSION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CURRENT_USER_ONLY_PIPE_OPTION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HEXADECIMAL_STRING_CONVERSION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HTTP_CLIENT_DEFAULT_REQUEST_VERSION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HTTP_CLIENT_DEFAULT_REQUEST_VERSION_POLICY</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_HTTP_CLIENT_RESILIENCE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_INT32_RANDOM_NUMBER_GENERATOR_METHODS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_KESTREL_TLS_HANDSHAKE_CALLBACK_OPTIONS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_MULTIPLE_VALUES_IN_QUERYHELPERS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_NAMED_PIPE_STATIC_FACTORY_WITH_ACL</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ONE_SHOT_HASHING_METHODS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ONE_SHOT_KEY_DERIVATION_METHODS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_PEM_ENCODED_KEY_IMPORT</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_REDIRECTION_ON_SIGN_IN</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_RELAXED_URI_LIMITS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_TEXT_ELEMENT_ENUMERATOR</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_TIME_CONSTANT_COMPARISONS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_TYPE_DESCRIPTOR_TYPE_REGISTRATION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_VALUETASK_COMPLETED_TASK</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_WINFORMS_TASK_DIALOG</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_CLONING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_CUSTOM_TRUST_STORE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_DOWNLOAD_MODE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_TRUST_MODE</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ZLIB_COMPRESSION</DefineConstants>
</PropertyGroup>
<PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp') Or
('$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '4.7.2'))) Or
('$(TargetFrameworkIdentifier)' == '.NETStandard') ">
<DefineConstants>$(DefineConstants);SUPPORTS_ECDSA</DefineConstants>
</PropertyGroup>
<PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp') Or
('$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '4.7.2'))) Or
('$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '2.1'))) ">
<DefineConstants>$(DefineConstants);SUPPORTS_CERTIFICATE_GENERATION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_EPHEMERAL_KEY_SETS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_KEY_DERIVATION_WITH_SPECIFIED_HASH_ALGORITHM</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_RSA_KEY_CREATION_WITH_SPECIFIED_SIZE</DefineConstants>
</PropertyGroup>
<PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp') Or
('$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '2.1'))) ">
<DefineConstants>$(DefineConstants);SUPPORTS_BROTLI_COMPRESSION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_CURRENT_USER_ONLY_PIPE_OPTION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_SERVICE_PROVIDER_IN_HTTP_MESSAGE_HANDLER_BUILDER</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_TIME_CONSTANT_COMPARISONS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_WEB_INTEGRATION_IN_GENERIC_HOST</DefineConstants>
</PropertyGroup>
<PropertyGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '9.0')) ">
<DefineConstants>$(DefineConstants);SUPPORTS_CERTIFICATE_LOADER</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_JSON_ELEMENT_DEEP_EQUALS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_JSON_ELEMENT_PROPERTY_COUNT</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_KEYED_HTTP_CLIENT_RESOLUTION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_TYPE_DESCRIPTOR_TYPE_REGISTRATION</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_CLONING</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_X509_CHAIN_POLICY_VERIFICATION_TIME_MODE</DefineConstants>
</PropertyGroup>
<PropertyGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '10.0')) ">
<DefineConstants>$(DefineConstants);SUPPORTS_ASYNC_LINQ</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_RELAXED_URI_LIMITS</DefineConstants>
<DefineConstants>$(DefineConstants);SUPPORTS_ZLIB_COMPRESSION</DefineConstants>
</PropertyGroup>
<PropertyGroup
@ -154,9 +92,7 @@
</PropertyGroup>
<PropertyGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCore' And '$(TargetPlatformIdentifier)' == 'UAP') Or
('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And
'$(TargetPlatformIdentifier)' == 'Windows' And
'$(TargetPlatformVersion)' != '' And
$([MSBuild]::VersionGreaterThanOrEquals($(TargetPlatformVersion), '8.0'))) Or
@ -165,20 +101,6 @@
<DefineConstants>$(DefineConstants);SUPPORTS_WINDOWS_RUNTIME</DefineConstants>
</PropertyGroup>
<!--
Note: Entity Framework Core 2.x references System.Interactive.Async 3.x, that includes
its own IAsyncEnumerable. To work around collisions between this type and the new type
now included in the BCL (System.Runtime), an alias is added to System.Interactive.Async.
-->
<Target Name="AddAssemblyAliasToReactiveAsync" AfterTargets="ResolveAssemblyReferences">
<ItemGroup>
<ReferencePath Condition=" '%(FileName)' == 'System.Interactive.Async' ">
<Aliases>reactive</Aliases>
</ReferencePath>
</ItemGroup>
</Target>
<!--
Note: metapackages don't include any build output. To ensure the TFM-specific folders under
/lib are preserved, a placeholder file is added for each supported target framework moniker.
@ -212,12 +134,4 @@
Encoding="Unicode" />
</Target>
<!--
Note: the built-in _CalculateXbfSupport target cannot be used when building a UWP project using
the .NET version of MSBuild. To work around this limitation, a fake target is defined here.
-->
<Target Name="_CalculateXbfSupport"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' And '$(TargetPlatformIdentifier)' == 'UAP' " />
</Project>

309
Directory.Packages.props

@ -4,104 +4,12 @@
Note: to cover as many platforms as possible and reduce the number of package references,
OpenIddict extensively uses multi-targeting and per-framework package references. As such,
package versions must be carefully chosen to ensure they are consistent and compatible with
the TFMs supported by OpenIddict (e.g for .NET 8, only Microsoft.AspNetCore.* packages within
the [8.0.0,9.0.0) range are allowed). Special care must also be taken when selecting versions
to ensure that transitive references also respect the same constraints (e.g for the .NET 8 TFM,
a package must only depend on Microsoft.Extensions.* packages within the [8.0.0,9.0.0) range).
the TFMs supported by OpenIddict (e.g for .NET 10, only Microsoft.AspNetCore.* packages within
the [10.0.0,11.0.0) range are allowed). Special care must also be taken when selecting versions
to ensure that transitive references also respect the same constraints (e.g for the .NET 10 TFM,
a package must only depend on Microsoft.Extensions.* packages within the [10.0.0,11.0.0) range).
-->
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄████ ▄▄▄██ ▄▄▀█ ▄▄▀██ ▄▀▄ ██ ▄▄▄██ ███ ██ ▄▄▄ ██ ▄▄▀██ █▀▄████ ▄ █████▀▄▄▀████ ▄ ██
█▀▀██ █ █ ██ ▄▄▄███ ██████ ▄▄███ ▀▀▄█ ▀▀ ██ █ █ ██ ▄▄▄██ █ █ ██ ███ ██ ▀▀▄██ ▄▀████ ▀▀ ▀█▀▀█ ▀▀██▀▀██▀▄██
█▄▄██ ██▄ ██ ▀▀▀███ ██████ █████ ██ █ ██ ██ ███ ██ ▀▀▀██▄▀▄▀▄██ ▀▀▀ ██ ██ ██ ██ ██████ ██▄▄█▄▀▀▄█▄▄█ ▀▀██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for .NET Framework 4.6.2"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '4.6.2')) ">
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.Abstractions" Version="2.3.9" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.Owin.Security" Version="4.2.3" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.17763.1000" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Interactive.Async" Version="3.2.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄████ ▄▄▄██ ▄▄▀█ ▄▄▀██ ▄▀▄ ██ ▄▄▄██ ███ ██ ▄▄▄ ██ ▄▄▀██ █▀▄████ ▄ █████▄▄▄ ████ ▄ ██
█▀▀██ █ █ ██ ▄▄▄███ ██████ ▄▄███ ▀▀▄█ ▀▀ ██ █ █ ██ ▄▄▄██ █ █ ██ ███ ██ ▀▀▄██ ▄▀████ ▀▀ ▀█▀▀███ ██▀▀██▀▄██
█▄▄██ ██▄ ██ ▀▀▀███ ██████ █████ ██ █ ██ ██ ███ ██ ▀▀▀██▄▀▄▀▄██ ▀▀▀ ██ ██ ██ ██ ██████ ██▄▄██▌▐██▄▄█ ▀▀██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for .NET Framework 4.7.2"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '4.7.2')) ">
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.Abstractions" Version="2.3.9" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.Owin.Security" Version="4.2.3" />
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.17763.1000" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Interactive.Async" Version="3.2.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
<!--
Note: the following references are exclusively used in the test projects:
-->
<PackageVersion Include="AngleSharp" Version="1.4.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.7.1" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="2.3.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Owin.Testing" Version="4.2.3" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄████ ▄▄▄██ ▄▄▀█ ▄▄▀██ ▄▀▄ ██ ▄▄▄██ ███ ██ ▄▄▄ ██ ▄▄▀██ █▀▄████ ▄ █████▀▄▄▀██
@ -113,19 +21,17 @@
<ItemGroup Label="Package versions for .NET Framework 4.8"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '4.8.0')) ">
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.Abstractions" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="10.0.7" />
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="10.0.7" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="10.0.7" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="10.0.7" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
@ -133,21 +39,21 @@
<PackageVersion Include="Microsoft.Windows.SDK.Contracts" Version="10.0.17763.1000" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="MSBuild.Microsoft.VisualStudio.Web.targets" Version="14.0.0.3" />
<PackageVersion Include="NuGet.Build.Tasks.Pack" Version="5.10.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Interactive.Async" Version="3.2.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
<PackageVersion Include="System.Collections.Immutable" Version="10.0.7" />
<PackageVersion Include="System.Net.Http.Json" Version="10.0.7" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="10.0.7" />
<PackageVersion Include="System.Text.Json" Version="10.0.7" />
<!--
Note: the following references are exclusively used in the test projects:
-->
<PackageVersion Include="AngleSharp" Version="1.4.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.7.1" />
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="2.3.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.7" />
<PackageVersion Include="Microsoft.Owin.Testing" Version="4.2.3" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
@ -168,15 +74,8 @@
<PackageVersion Include="Microsoft.AspNet.Mvc" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Owin" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Identity" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.9" />
<PackageVersion Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.7" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.14.0" />
<PackageVersion Include="Microsoft.Owin.Host.SystemWeb" Version="4.2.3" />
<PackageVersion Include="Microsoft.Owin.Security.Cookies" Version="4.2.3" />
@ -184,93 +83,13 @@
<PackageVersion Include="Microsoft.Web.Infrastructure" Version="2.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.15.1" />
<PackageVersion Include="SourceGear.sqlite3" Version="3.50.4.5" />
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
<PackageVersion Include="SQLite.CodeFirst" Version="1.7.0.36" />
<PackageVersion Include="System.Data.SQLite.EF6" Version="2.0.3" />
<PackageVersion Include="WebGrease" Version="1.6.0" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄███▀▄▄▀████ ▄▄ ██
█▀▀██ █ █ ██ ▄▄▄███ █████▀▄▄▀█▀▀█ ▀▄ ██
█▄▄██ ██▄ ██ ▀▀▀███ █████▄▀▀▄█▄▄█ ▀▀ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for .NET 8.0"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) ">
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="8.0.26" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="8.10.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
<PackageVersion Include="Xamarin.AndroidX.Browser" Version="1.9.0.2" />
<!--
Note: the following references are exclusively used in the test projects:
-->
<PackageVersion Include="AngleSharp" Version="1.4.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.7.1" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄███▀▄▄▀████ ▄▄ ██
█▀▀██ █ █ ██ ▄▄▄███ █████▄▀▀ █▀▀█ ▀▄ ██
█▄▄██ ██▄ ██ ▀▀▀███ ██████▀▀▄█▄▄█ ▀▀ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for .NET 9.0"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '9.0')) ">
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="9.0.15" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.10.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="9.0.15" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="9.0.15" />
<PackageVersion Include="Xamarin.AndroidX.Browser" Version="1.9.0.2" />
<!--
Note: the following references are exclusively used in the test projects:
-->
<PackageVersion Include="AngleSharp" Version="1.4.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.7.1" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="9.0.15" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.15" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄███▀ ██ ▄▄ ████ ▄▄ ██
@ -335,33 +154,6 @@
<ItemGroup Label="Package versions for .NET Standard 2.0"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '2.0')) ">
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="2.3.9" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="NamedPipeServerStream.NetFrameworkVersion" Version="1.1.13" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Interactive.Async" Version="3.2.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
<!--
Note: the following references are exclusively used in the source generators:
-->
@ -371,57 +163,6 @@
<PackageVersion Include="System.Interactive" Version="6.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█████ ▀██ ██ ▄▄▄█▄▄ ▄▄████ ▄▄▄ █▄▄ ▄▄█ ▄▄▀██ ▀██ ██ ▄▄▀█ ▄▄▀██ ▄▄▀██ ▄▄▀███ ▄ ████▀ ███
█▀▀██ █ █ ██ ▄▄▄███ ██████▄▄▄▀▀███ ███ ▀▀ ██ █ █ ██ ██ █ ▀▀ ██ ▀▀▄██ ██ ████▀▄█▀▀██ ███
█▄▄██ ██▄ ██ ▀▀▀███ ██████ ▀▀▀ ███ ███ ██ ██ ██▄ ██ ▀▀ █ ██ ██ ██ ██ ▀▀ ███ ▀▀█▄▄█▀ ▀██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for .NET Standard 2.1"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '2.1')) ">
<PackageVersion Include="EntityFramework" Version="6.5.1" />
<PackageVersion Include="Microsoft.AspNetCore.DataProtection" Version="2.3.9" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="8.0.26" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.WebEncoders" Version="8.0.26" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols" Version="8.16.0" />
<PackageVersion Include="Microsoft.IdentityModel.Tokens" Version="8.16.0" />
<PackageVersion Include="MongoDB.Bson" Version="3.6.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
<PackageVersion Include="NamedPipeServerStream.NetFrameworkVersion" Version="1.1.13" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.15.1" />
<PackageVersion Include="System.Buffers" Version="4.6.1" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Interactive.Async" Version="3.2.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
</ItemGroup>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██ █ ▄▄▀██ ▄▄ ███▀ ██ ▄▄ ████ ▄▄ ████▀ ██▄▄▄ █▄▄▄ █▀▄▄▀█ ▄▄ ██
██ ██ █ ▀▀ ██ ▀▀ ████ ██ ▀▄ █▀▀█ ▀▄ █▀▀██ ████ ████ ██ ▀▀████▄▀██
██▄▀▀▄█ ██ ██ ██████▀ ▀█ ▀▀ █▄▄█ ▀▀ █▄▄█▀ ▀██▌▐███▌▐██▄▀▀▄█ ▀▀ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<ItemGroup Label="Package versions for Universal Windows Platform 10.0.17763"
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '5.0')) And
'$(TargetPlatformIdentifier)' == 'UAP' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '10.0.17763')) ">
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="NamedPipeServerStream.NetFrameworkVersion" Version="1.1.7" />
</ItemGroup>
<!--
Note: OpenIddict uses Meziantou.Polyfill to dynamically generate polyfills for types that are not available
on some of the targeted TFMs (e.g Index, Range or nullable attributes on .NET Framework/.NET Standard).

3
OpenIddict.slnx

@ -1,7 +1,6 @@
<Solution>
<Folder Name="/eng/">
<File Path="eng/AfterTargetFrameworkInference.targets" />
<File Path="eng/Build.props" />
<File Path="eng/key.snk" />
<File Path="eng/Signing.props" />
@ -69,10 +68,10 @@
<Project Path="src/OpenIddict.MongoDb/OpenIddict.MongoDb.csproj" />
<Project Path="src/OpenIddict.Owin/OpenIddict.Owin.csproj" />
<Project Path="src/OpenIddict.Quartz/OpenIddict.Quartz.csproj" />
<Project Path="src/OpenIddict.Server/OpenIddict.Server.csproj" />
<Project Path="src/OpenIddict.Server.AspNetCore/OpenIddict.Server.AspNetCore.csproj" />
<Project Path="src/OpenIddict.Server.DataProtection/OpenIddict.Server.DataProtection.csproj" />
<Project Path="src/OpenIddict.Server.Owin/OpenIddict.Server.Owin.csproj" />
<Project Path="src/OpenIddict.Server/OpenIddict.Server.csproj" />
<Project Path="src/OpenIddict.Validation/OpenIddict.Validation.csproj" />
<Project Path="src/OpenIddict.Validation.AspNetCore/OpenIddict.Validation.AspNetCore.csproj" />
<Project Path="src/OpenIddict.Validation.DataProtection/OpenIddict.Validation.DataProtection.csproj" />

13
eng/AfterTargetFrameworkInference.targets

@ -1,13 +0,0 @@
<Project>
<!--
Note: the language targets necessary to build UWP applications are not included in the .NET SDK and require
installing Visual Studio. To work around this limitation, a local copy of these targets is embedded and used here.
-->
<PropertyGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' And '$(TargetPlatformIdentifier)' == 'UAP' ">
<LanguageTargets>$(MSBuildThisFileDirectory)msbuild\uwp\Microsoft.Windows.UI.Xaml.CSharp.targets</LanguageTargets>
</PropertyGroup>
</Project>

6
eng/Tools.props

@ -1,6 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="MSBuild.Microsoft.VisualStudio.Web.targets" Version="14.0.0.3" IsImplicitlyDefined="true" />
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="5.10.0" IsImplicitlyDefined="true" />
</ItemGroup>
@ -41,6 +42,11 @@
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Exec Command='"$(DotNetTool)" workload install maui-android --skip-manifest-update'
WorkingDirectory="$(RepoRoot)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
<Exec Command='"$(DotNetTool)" workload install maui-maccatalyst --skip-manifest-update'
WorkingDirectory="$(RepoRoot)" ConsoleToMSBuild="true"
Condition=" $([System.OperatingSystem]::IsMacOS()) Or $([System.OperatingSystem]::IsWindows()) ">

BIN
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll

Binary file not shown.

181
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.CPP.targets

@ -1,181 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Cpp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BeforeClCompileTargets>
MarkupCompilePass1;
$(BeforeClCompileTargets)
</BeforeClCompileTargets>
<ComputeCompileInputsTargets>
ComputeXamlGeneratedCompileInputs;
$(ComputeCompileInputsTargets)
</ComputeCompileInputsTargets>
<AfterBuildCompileTargets>
$(ComputeLinkInputsTargets);
CreateWinMD;
ComputeGeneratedWinMD;
MarkupCompilePass2;
ComputeInvalidXamlGenerated;
CompileXamlGeneratedFiles;
$(AfterBuildCompileTargets)
</AfterBuildCompileTargets>
<XamlPreLinkDependsOn>
$(XamlPreLinkDependsOn);
ComputeXamlGeneratedCLOutputs
</XamlPreLinkDependsOn>
<GenerateProjectionAssembly>True</GenerateProjectionAssembly>
<OnlyCreateWinMD>true</OnlyCreateWinMD>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
</PropertyGroup>
<PropertyGroup>
<ValidatePresenceOfAppxManifestItemsDependsOn>
$(ValidatePresenceOfAppxManifestItemsDependsOn);
_CreateContentItemOutOfCustomAppxManifest
</ValidatePresenceOfAppxManifestItemsDependsOn>
</PropertyGroup>
<ItemGroup>
<PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\Xaml.xml" />
</ItemGroup>
<!-- This is a proxy target that holds stuff that runs before the final Link -->
<Target Name="XamlPreLink" BeforeTargets="Link" DependsOnTargets="$(XamlPreLinkDependsOn)" />
<Target Name="ComputeGeneratedWinMD" >
<PropertyGroup>
<LocalAssembly Condition="'$(LocalAssembly)' == '' and '%(Link.WindowsMetadataFile)' != ''">%(Link.WindowsMetadataFile)</LocalAssembly>
</PropertyGroup>
</Target>
<!-- Change AppxManifest.xml override item to be of Content type. -->
<Target Name="_CreateContentItemOutOfCustomAppxManifest">
<ItemGroup>
<Content Include="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
<Xml Remove="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
</ItemGroup>
</Target>
<PropertyGroup>
<GeneratedFilesDir Condition=" '$(GeneratedFilesDir)' == ''">Generated Files\</GeneratedFilesDir>
<XamlGeneratedOutputPath>$(GeneratedFilesDir)</XamlGeneratedOutputPath>
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.g.h;*.g.cpp;*.xaml</ExtensionsToDeleteOnClean>
</PropertyGroup>
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\Cpp.ProjectItemsSchema.xaml"/>
</ItemGroup>
<!-- Generated files output group population -->
<PropertyGroup>
<GeneratedFilesOutputGroupDependsOn>XamlGeneratedFilesOutputGroup;$(GeneratedFilesOutputGroupDependsOn)</GeneratedFilesOutputGroupDependsOn>
</PropertyGroup>
<Target Name="XamlGeneratedFilesOutputGroup"
DependsOnTargets="$(XamlGeneratedFilesOutputGroupDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
</ItemGroup>
</Target>
<Target Name="ComputeXamlGeneratedCompileInputs"
DependsOnTargets="$(ComputeXamlGeneratedCompileInputsDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<ClCompile Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" >
<CompilerIteration>XamlGenerated</CompilerIteration>
</ClCompile>
<ClCompile Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" >
<CompilerIteration>XamlGenerated</CompilerIteration>
</ClCompile>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.g.cpp" >
<CompilerIteration>XamlGenerated</CompilerIteration>
</ClCompile>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.Impl.g.cpp" />
<ClCompile Condition="'$(OutputType)' == 'Library'" Include="$(XamlGeneratedOutputPath)XamlLibMetadataProvider.g.cpp" />
</ItemGroup>
<!-- The build only wants to generate winmd once, either during Link target or Createwinmd target, not both.
Link and Createwinmd targets will execute link.exe, so it is best to run link.exe only once.
However, there are two cases where that isn't possible.
1) when build is building XAML and
2) when building in passes. -->
<PropertyGroup>
<GenerateBuildCompilePassWinMD Condition="'$(GenerateBuildCompilePassWinMD)' == ''">true</GenerateBuildCompilePassWinMD>
</PropertyGroup>
</Target>
<Target Name="ComputeInvalidXamlGenerated" >
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!-- Add CL generates .obj files to Obj item group, it will be used by lib or link -->
<Target Name="ComputeXamlGeneratedCLOutputs"
DependsOnTargets="ComputeXamlGeneratedCompileInputs;ComputeInvalidXamlGenerated"
Condition="'@(ClCompile)' != ''">
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
<!-- No object file name defined: filename.obj -->
<Obj Condition="'%(ClCompile.ObjectFileName)'=='' and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(Filename).obj')" />
<!-- Object file name is a directory (has trailing slash): ofn\filename.obj -->
<Obj Condition="HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)%(Filename).obj')" />
<!-- Object file name is a file (does not has trailing slash): ofn -->
<Obj Condition="'%(ClCompile.ObjectFileName)' != '' and !HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)')" />
<Link Include="@(Obj->WithMetadataValue('CompilerIteration', 'XamlGenerated')->ClearMetadata())" />
</ItemGroup>
</Target>
<!-- Enable design time build as well as selected file(s) compile support -->
<PropertyGroup>
<EnableDesignTimeBuild>true</EnableDesignTimeBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<Page>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</Page>
<ApplicationDefinition>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</ApplicationDefinition>
</ItemDefinitionGroup>
<PropertyGroup>
<MarkupCompilePass1DependsOn>CppDesignTimeMarkupCompilation;$(MarkupCompilePass1DependsOn)</MarkupCompilePass1DependsOn>
</PropertyGroup>
<Target Name="CppDesignTimeMarkupCompilation"
DependsOnTargets="_SelectedFiles;SelectCustomBuild;ResolveReferences">
<!-- Ideally we'd like to be able to build just the requested files (if it makes sense). -->
<!--<ItemGroup Condition="'@(SelectedFiles)'!=''">
<Page Remove="@(Page)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
<ApplicationDefinition Remove="@(ApplicationDefinition)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
</ItemGroup>-->
</Target>
</Project>

47
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.CSharp.targets

@ -1,47 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.CSharp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<!-- Supress the warnings in the 1st pass so that warnings are not repeated twice -->
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\CSharp.ProjectItemsSchema.xaml"/>
</ItemGroup>
</Project>

664
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.Common.targets

@ -1,664 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Common.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="ImportBefore\*"/>
<!-- Need the path to vcmeta.dll -->
<PropertyGroup>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSWinExpress\14.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VSWinExpress\14.0\Setup\VC@ProductDir)</VCInstallDir>
<XAMLFingerprint Condition="'$(XAMLFingerprint)' == ''">true</XAMLFingerprint>
<DisableXbfGeneration Condition="'$(DisableXbfGeneration)' == '' AND '$(TargetPlatformVersion)' == '8.0'">true</DisableXbfGeneration>
<DisableXbfGeneration Condition="'$(DisableXbfGeneration)' == ''">false</DisableXbfGeneration>
<XamlSavedStateFileName Condition="'$(XamlSavedStateFileName)' == ''">XamlSaveStateFile.xml</XamlSavedStateFileName>
<XamlSavedStateFilePath>$(IntermediateOutputPath)\$(XamlSavedStateFileName)</XamlSavedStateFilePath>
<XAMLFingerprintIgnorePaths Condition="'$(XAMLFingerprintIgnorePaths)'==''">
@(ReferenceAssemblyPaths);
$(WindowsSDK80Path)
</XAMLFingerprintIgnorePaths>
</PropertyGroup>
<ItemGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
<AvailableItemName Include="PRIResource" />
<AvailableItemName Include="AppxManifest" />
<AvailableItemName Include="ApplicationDefinition" />
<AvailableItemName Include="Page" />
<AvailableItemName Include="DesignData" />
<AvailableItemName Include="DesignDataWithDesignTimeCreatableTypes" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="WindowsXaml"/>
<ProjectCapability Include="WindowsXamlPage"/>
<ProjectCapability Include="WindowsXamlCodeBehind"/>
<ProjectCapability Include="WindowsXamlResourceDictionary"/>
<ProjectCapability Include="WindowsXamlUserControl"/>
</ItemGroup>
<!-- For Managed Assemblies Create a XAML Roots Log -->
<PropertyGroup Condition="'$(ManagedAssembly)' != 'false'">
<XamlRootsLog>$(AssemblyName).xr.xml</XamlRootsLog>
</PropertyGroup>
<!-- Setting PRI index name. The XAML compiler use this in the LoadComponent() string.
It must match the name of the directoy the AppX Packaging system uses -->
<PropertyGroup>
<!-- Exe's don't have an PriIndexName -->
<PriIndexName Condition="'$(AppxPackage)' == 'true'"></PriIndexName>
<!-- Managed Dll's use the "safe" name of the project as the App Package Name -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' != 'false' and '$(OutputType)' != 'winmdobj'">$(TargetName)</PriIndexName>
<!-- Winmd library targets (managed or native) use the default root namespace of the project for the App package name -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' != 'false' and '$(OutputType)' == 'winmdobj'">$(RootNamespace)</PriIndexName>
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' == 'false' and '$(RootNamespace)' != ''">$(RootNamespace)</PriIndexName>
<!-- If RootNamespace is empty fall back to TargetName -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and $(PriIndexName) == ''">$(TargetName)</PriIndexName>
</PropertyGroup>
<PropertyGroup>
<AvailablePlatforms>$(AvailablePlatforms),ARM</AvailablePlatforms>
<!-- this Property is used only for the Managed build.
See Microsoft.Windows.UI.Xaml.Cpp.targets for Native build rules -->
<PrepareResourcesDependsOn>
ResolveKeySource;
MarkupCompilePass1;
XamlPreCompile;
MarkupCompilePass2;
$(PrepareResourcesDependsOn)
</PrepareResourcesDependsOn>
<Prefer32Bit Condition="'$(Prefer32Bit)' == '' and ('$(OutputType)' == 'exe' or '$(OutputType)' == 'winexe' or '$(OutputType)' == 'appcontainerexe')">true</Prefer32Bit>
<HighEntropyVA Condition="'$(HighEntropyVA)' == ''">true</HighEntropyVA>
<SubsystemVersion Condition="'$(SubsystemVersion)' == '' and ('$(PlatformTarget)' == 'ARM' or '$(OutputType)' == 'appcontainerexe' or '$(OutputType)' == 'winmdobj')">6.02</SubsystemVersion>
<SubsystemVersion Condition="'$(SubsystemVersion)' == ''">6.00</SubsystemVersion>
<OnXamlPreCompileErrorTarget Condition="'$(OnXamlPreCompileErrorTarget)' == ''">_OnXamlPreCompileError</OnXamlPreCompileErrorTarget>
<!-- Use Intermediate dir if XamlGeneratedOutputPath is not defined -->
<XamlGeneratedOutputPath Condition="'$(XamlGeneratedOutputPath)' == ''">$(IntermediateOutputPath)</XamlGeneratedOutputPath>
</PropertyGroup>
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.CompileXaml" AssemblyFile="Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.AddDefaultXamlLinkMetadata" AssemblyFile="Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.GetXamlCppIncludeDirectories" AssemblyFile="Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll" />
<PropertyGroup>
<!--If the path to the sign tool is not set, assume the SDK path -->
<SignToolPath Condition="'$(SignToolPath)' == ''">$(FrameworkSDKRoot)bin</SignToolPath>
<!--Integration with packaging for GeneratedXamlFilesOutputGroupOutput -->
<IncludeCustomOutputGroupForPackaging>true</IncludeCustomOutputGroupForPackaging>
</PropertyGroup>
<ItemGroup>
<XamlIntermediateAssembly Condition="'$(ManagedAssembly)'!='false'" Include="$(XamlGeneratedOutputPath)intermediatexaml\$(TargetName)$(TargetExt)"/>
<XamlIntermediateAssembly Condition="'$(ManagedAssembly)'=='false'" Include="$(OutputPath)\$(TargetName).winmd"/>
</ItemGroup>
<!--
============================================================
Adds all XAML Pages to the $(Resource) collection
============================================================
-->
<ItemGroup Condition=" '$(ManagedAssembly)'=='' ">
<!-- Add XAML Page items to $(Resource) -->
<Resource Include="@(Page)" />
<Resource Include="@(ApplicationDefinition)" />
</ItemGroup>
<!-- Manifest metadata items. -->
<!-- See Microsoft.AppxPackage.targets for details. -->
<ItemGroup Label="AppxManifestMetadata">
<AppxManifestMetadata Include="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\$(TargetPlatformVersion)\Microsoft.Windows.UI.Xaml.81.Build.Tasks.dll" />
</ItemGroup>
<PropertyGroup>
<MarkupCompilePass1DependsOn>
GetXamlCppIncludeDirectories;
$(GetXamlCppIncludeDirectories)
</MarkupCompilePass1DependsOn>
<MarkupCompilePass2DependsOn>
GetXamlCppIncludeDirectories;
$(GetXamlCppIncludeDirectories)
</MarkupCompilePass2DependsOn>
<Prep_ComputeProcessXamlFilesDependsOn>
GetXamlCppIncludeDirectories;
$(Prep_ComputeProcessXamlFilesDependsOn)
</Prep_ComputeProcessXamlFilesDependsOn>
</PropertyGroup>
<!-- In order for the XAML compiler to generated the correct relative paths for #includes in
the generated C++ code it needs to know the AdditionalIncludeDirectories of all the .cpp
files are DependentUpon XAML files.-->
<Target Name="GetXamlCppIncludeDirectories" Condition="'$(ManagedAssembly)'=='false' and '$(XamlCppIncludeDirectories)' == ''">
<GetXamlCppIncludeDirectories ClCompile="@(ClCompile)">
<Output PropertyName="XamlCppIncludeDirectories" TaskParameter="ComputedIncludeDirectories" />
</GetXamlCppIncludeDirectories>
</Target>
<!--
================================================================
DesignTimeMarkupCompilation
Support for the Intellisense build
================================================================
-->
<PropertyGroup>
<CoreCompileDependsOn Condition="'$(BuildingInsideVisualStudio)' == 'true' ">
DesignTimeMarkupCompilation;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="DesignTimeMarkupCompilation">
<!-- BuildingProject is used in Managed builds (always true in Native) -->
<!-- DesignTimeBuild is used in Native builds (always false in Managed) -->
<CallTarget Condition="'$(BuildingProject)' != 'true' Or $(DesignTimeBuild) == 'true'" Targets="DesignTimeMarkupCompilationCT" />
</Target>
<!-- A copy of the first pass, without the WarningLevel manipulation -->
<Target Name="DesignTimeMarkupCompilationCT"
DependsOnTargets="$(MarkupCompilePass1DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<MakeDir Condition="'$(ManagedAssembly)'!='false'" Directories="$(XamlGeneratedOutputPath)intermediatexaml\" />
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="True"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
ProjectPath="$(MSBuildProjectFullPath)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(ReferencePath)"
ForceSharedStateShutdown="False"
ContinueOnError="True"
CompileMode="DesignTimeBuild"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
SuppressWarnings="$(SuppressXamlWarnings)"
>
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<!--
Add to the list of files written.
It is used in Microsoft.Common.targets for a next clean build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
</ItemGroup>
<Message Text="(Out) ISenseCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) ISenseXamlFiles: '@(_GeneratedXamlFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'%(ClCompile.CompilerIteration)' != 'XamlGenerated'"/>
<Message Text="(Out) Compile: '@(Compile)'" />
</Target>
<!--
================================================================
MarkupCompilePass1
================================================================
-->
<Target Name="MarkupCompilePass1"
DependsOnTargets="$(MarkupCompilePass1DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<MakeDir Condition="'$(ManagedAssembly)'!='false'" Directories="$(XamlGeneratedOutputPath)intermediatexaml\" />
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="True"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
ProjectPath="$(MSBuildProjectFullPath)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(ReferencePath)"
ForceSharedStateShutdown="False"
CompileMode="RealBuildPass1"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
SuppressWarnings="$(SuppressXamlWarnings)"
>
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<!--
FileWrites is used in Microsoft.Common.targets for "Clean" build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXbfFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
</ItemGroup>
<Message Text="(Out) GeneratedCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'$(ManagedAssembly)'=='false' and '%(ClCompile.CompilerIteration)'!='XamlGenerated'"/>
<Message Text="(Out) Compile: '@(Compile)'" Condition="'$(ManagedAssembly)'!='false'"/>
<PropertyGroup>
<PrevWarningLevel>$(WarningLevel)</PrevWarningLevel>
<WarningLevel Condition="'$(SuppressWarningsInPass1)'=='true'">0</WarningLevel>
</PropertyGroup>
</Target>
<!--
================================================================
MarkupCompilePass2
================================================================
-->
<Target Name="MarkupCompilePass2"
DependsOnTargets="$(MarkupCompilePass2DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<PropertyGroup>
<WarningLevel>$(PrevWarningLevel)</WarningLevel>
<WarningLevel Condition="'$(WarningLevel)' == '' and '$(ExplicitResetWarningSuppression)' == 'true'">1</WarningLevel>
</PropertyGroup>
<!-- The Name of the Local Assembly in Managed and Native -->
<PropertyGroup>
<LocalAssembly Condition="'$(LocalAssembly)' == '' and Exists(@(XamlIntermediateAssembly))">
@(XamlIntermediateAssembly->'%(Identity)')
</LocalAssembly>
</PropertyGroup>
<CallTarget Targets="SDKRedistOutputGroup" Condition="'$(IncludeSDKRedistOutputGroup)' == 'true'">
<Output TaskParameter="TargetOutputs" ItemName="_SDKRedistOutputGroupOutput_xaml"/>
</CallTarget>
<ItemGroup>
<SdkXamlItems Include="@(_SDKRedistOutputGroupOutput_xaml)" Condition="'%(Extension)'=='.xaml'" />
</ItemGroup>
<ItemGroup>
<!-- C++ provides a filtered Item that eliminates any Managed Assemblies on the ReferencePath (from SDKs for example) -->
<XamlReferencesToCompile Condition="'$(Language)'=='C++'" Include="@(WinMDReferenceToCompile)" />
<XamlReferencesToCompile Condition="'$(Language)'!='C++'" Include="@(ReferencePath)" />
</ItemGroup>
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
SdkXamlPages="@(SdkXamlItems)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="False"
DisableXbfGeneration="$(DisableXbfGeneration)"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
ClIncludeFiles="@(ClInclude)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
LocalAssembly="$(LocalAssembly)"
ProjectPath="$(MSBuildProjectFullPath)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(XamlReferencesToCompile)"
ForceSharedStateShutdown="False"
CompileMode="RealBuildPass2"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
RootsLog="$(XamlRootsLog)"
SuppressWarnings="$(SuppressXamlWarnings)"
>
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<Output Condition=" '$(ManagedAssembly)'=='false' " ItemName="XamlGFiles" TaskParameter="GeneratedCodeFiles" />
<!--
FileWrites is used in Microsoft.Common.targets for "Clean" build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXbfFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="_GeneratedXamlFiles" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="_GeneratedXbfFiles" TaskParameter="GeneratedXbfFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
<FileWrites Condition="'$(XamlRootsLog)' != ''" Include="$(XamlRootsLog)" />
</ItemGroup>
<Message Text="(Out) GeneratedCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) GeneratedXamlFiles: '@(_GeneratedXamlFiles)'" />
<Message Text="(Out) GeneratedXbfFiles: '@(_GeneratedXbfFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'$(ManagedAssembly)'=='false'"/>
<Message Text="(Out) Compile: '@(Compile)'" Condition="'$(ManagedAssembly)'!='false'"/>
</Target>
<Target Name="_OnXamlPreCompileError"
DependsOnTargets="$(_OnXamlPrecompileErrorDependsOn)" >
<CompileXaml
ProjectPath="$(MSBuildProjectFullPath)"
Language="$(Language)"
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
OutputPath="$(XamlGeneratedOutputPath)"
ReferenceAssemblies="@(ReferencePath)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
ForceSharedStateShutdown="True"
CompileMode="OnErrorShutdown"
SavedStateFile="$(XamlSavedStateFilePath)"
>
</CompileXaml>
</Target>
<Target Name="Prep_ComputeProcessXamlFiles"
Condition="'@(ApplicationDefinition)'!='' or '@(Page)'!=''"
DependsOnTargets="$(Prep_ComputeProcessXamlFilesDependsOn)" >
<!-- collect all the XAML pages from the Project file into one Item -->
<ItemGroup>
<AllProjectXamlPages Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition)" />
<AllProjectXamlPages Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page)" />
</ItemGroup>
<!-- For ttems are outside the project cone Link metadata tells us what the apparent project path should be.
C++ doesn't use Link data, so for C++ add implied DefaultXamlLink metadata based on the Include Path -->
<AddDefaultXamlLinkMetadata Condition="'$(ManagedAssembly)'=='false'"
ProjectPath="$(ProjectPath)"
XamlPages="@(AllProjectXamlPages)"
CIncludeDirectories ="$(XamlCppIncludeDirectories)">
<Output TaskParameter="OutputItems" ItemName="_Temp" />
</AddDefaultXamlLinkMetadata>
<!-- Remove the Items named in _Temp, then add the actual items from _Temp, then clear _Temp -->
<ItemGroup>
<AllProjectXamlPages Remove="@(_Temp)" />
<AllProjectXamlPages Include="@(_Temp)" />
<_Temp Remove="@(_Temp)" />
</ItemGroup>
<!-- transfer the DefaultXamlLink data to the Link attribute -->
<ItemGroup>
<AllProjectXamlPages Condition="'%(AllProjectXamlPages.DefaultXamlLink)'!=''">
<Link>%(AllProjectXamlPages.DefaultXamlLink)</Link>
</AllProjectXamlPages>
</ItemGroup>
<!-- Compute the Generated XAML source path and the bin dir Destination path -->
<!-- If there is a Link use that, otherwise use the Given path from the Project file Item -->
<ItemGroup>
<GeneratedXamlSrc0 Condition="'%(AllProjectXamlPages.Link)'!=''" Include="@(AllProjectXamlPages->'$(XamlGeneratedOutputPath)%(Link)')" />
<GeneratedXamlSrc0 Condition="'%(AllProjectXamlPages.Link)'==''" Include="@(AllProjectXamlPages->'$(XamlGeneratedOutputPath)%(Identity)')" />
<GeneratedXamlDest0 Condition="'%(AllProjectXamlPages.Link)'!=''" Include="@(AllProjectXamlPages->'$(OutputPath)\%(Link)')" />
<GeneratedXamlDest0 Condition="'%(AllProjectXamlPages.Link)'==''" Include="@(AllProjectXamlPages->'$(OutputPath)\%(Identity)')" />
</ItemGroup>
<!-- Swap in the XBF suffix if appropriate. -->
<ItemGroup Condition="'$(DisableXbfGeneration)' == 'true'">
<GeneratedXamlSrc Include="@(GeneratedXamlSrc0)" />
<GeneratedXamlDest Include="@(GeneratedXamlDest0)" />
</ItemGroup>
<ItemGroup Condition="'$(DisableXbfGeneration)' != 'true'">
<GeneratedXamlSrc Include="%(GeneratedXamlSrc0.RelativeDir)%(GeneratedXamlSrc0.Filename).xbf" />
<GeneratedXamlDest Include="%(GeneratedXamlDest0.RelativeDir)%(GeneratedXamlDest0.Filename).xbf" />
</ItemGroup>
<!-- if we converted SDK XAML into XBF, add the XBF to the list, and remove the XAML from the list -->
<ItemGroup Condition="'$(DisableXbfGeneration)' != 'true' and '@(SdkXamlItems)' != ''">
<GeneratedSdkXamlSrc0 Include="@(SdkXamlItems->'$(XamlGeneratedOutputPath)%(TargetPath)')" />
<GeneratedSdkXamlDest0 Include="@(SdkXamlItems->'$(OutputPath)\%(TargetPath)')" />
<GeneratedXamlSrc Include="%(GeneratedSdkXamlSrc0.RelativeDir)%(GeneratedSdkXamlSrc0.Filename).xbf" />
<GeneratedXamlDest Include="%(GeneratedSdkXamlDest0.RelativeDir)%(GeneratedSdkXamlDest0.Filename).xbf" />
<RemoveSdkFilesFromAppxPackage Include="@(SdkXamlItems)" />
</ItemGroup>
<ItemGroup Condition="'$(XamlRootsLog)' != ''">
<GeneratedXamlSrc Include="$(XamlGeneratedOutputPath)\$(XamlRootsLog)" />
<GeneratedXamlDest Include="$(OutputPath)\$(XamlRootsLog)" />
</ItemGroup>
<Message Importance="low" Text="(Out) Prep_GeneratedXamlSrc == @(GeneratedXamlSrc)" />
<Message Importance="low" Text="(Out) Prep_GeneratedXamlDest == @(GeneratedXamlDest)" />
</Target>
<!-- if $GenerateLibraryLayout is True this is skipped and see the PrepareLibraryLayout target -->
<Target Name="CopyGeneratedXaml" BeforeTargets="CopyFilesToOutputDirectory" DependsOnTargets="Prep_ComputeProcessXamlFiles"
Condition="'$(GenerateLibraryLayout)' != 'true'">
<Copy
SourceFiles="@(GeneratedXamlSrc)"
DestinationFiles="@(GeneratedXamlDest)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
/>
<ItemGroup>
<FileWrites Include="@(GeneratedXamlDest)" />
</ItemGroup>
</Target>
<Target Name="ComputeProcessXamlFiles" Returns="@(ProcessedXamlFiles)" DependsOnTargets="Prep_ComputeProcessXamlFiles">
<ItemGroup >
<!-- In the normal (non-SDK) build, AppX Packaging picks up the files from the bin aka OutputPath folder -->
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' != 'true'" Include="@(GeneratedXamlDest)" />
<!-- In the SDK build, AppX Packaging picks up the files from the XamlGeneratedOutput folder -->
<!-- For SDK builds include both the XAML and XBF -->
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' == 'true'" Include="@(GeneratedXamlSrc)" />
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' == 'true' and '$(DisableXbfGeneration)' != 'true'"
Include="@(GeneratedXamlSrc0)" />
</ItemGroup>
<Message Importance="Low" Text="(Out) GeneratedXamlDest == @(GeneratedXamlDest)" />
<Message Importance="Low" Text="(Out) GeneratedXamlSrc == @(GeneratedXamlSrc)" />
<Message Text="(Out) ProcessedXamlFiles == @(ProcessedXamlFiles)" />
</Target>
<Target Name="CustomOutputGroupForPackaging"
DependsOnTargets="ComputeProcessXamlFiles"
Returns="@(CustomOutputGroupForPackagingOutput)"
>
<ItemGroup>
<ProcessedXamlFilesFullPath Include="@(ProcessedXamlFiles->'%(FullPath)')" />
</ItemGroup>
<PropertyGroup>
<XamlPackagingRootFolder Condition="'$(GenerateLibraryLayout)' == 'true'">$(XamlGeneratedOutputPath)</XamlPackagingRootFolder>
<XamlPackagingRootFolder Condition="'$(GenerateLibraryLayout)' != 'true'">$(OutputPath)\</XamlPackagingRootFolder>
</PropertyGroup>
<AssignTargetPath Files="@(ProcessedXamlFilesFullPath)" RootFolder="$(XamlPackagingRootFolder)">
<Output TaskParameter="AssignedFiles" ItemName="CustomOutputGroupForPackagingOutput" />
</AssignTargetPath>
<Message Text="(Out) Project='$(MsBuildProjectName)' ProcessedXamlFiles == @(ProcessedXamlFiles)" />
<Message Text="(Out) XamlPackagingRootFolder == $(XamlPackagingRootFolder)" />
<Message Text="(Out) ProcessedXamlFilesFullPath == @(ProcessedXamlFilesFullPath)" />
<Message Text="(Out) Project='$(MsBuildProjectName)' CustomOutputGroupForPackagingOutput == @(CustomOutputGroupForPackagingOutput)" />
</Target>
<PropertyGroup>
<PrepareLibraryLayoutDependsOn>
GetPackagingOutputs;
$(PrepareLibraryLayoutDependsOn)
</PrepareLibraryLayoutDependsOn>
</PropertyGroup>
<!-- This builds the Bin Folder for DLL's that wish to have the SDK type layout -->
<Target Name="PrepareLibraryLayout"
Condition="'$(GenerateLibraryLayout)' == 'true'"
DependsOnTargets="$(PrepareLibraryLayoutDependsOn)"
BeforeTargets="CopyFilesToOutputDirectory"
>
<ItemGroup>
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'ContentFilesProjectOutputGroup'" />
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'CustomOutputGroupForPackaging'" />
</ItemGroup>
<Copy SourceFiles="@(_LayoutFile)"
DestinationFiles="@(_LayoutFile->'$(OutputPath)\%(TargetPath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
/>
</Target>
<!--
============================================================
Properties and Targets Common to Managed .NETCore projects
============================================================
-->
<!--
The ImplicitlyExpandTargetFramework target will expand all
of the dll reference assemblies in the TargetFrameworkDirectory
for the project and place the items into the ReferencePath itemgroup
which contains resolved items.
-->
<PropertyGroup>
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
ImplicitlyExpandTargetFramework;
ImplicitlyExpandTargetPlatform
</ResolveReferencesDependsOn>
<ImplicitlyExpandTargetFrameworkDependsOn>
$(ImplicitlyExpandTargetFrameworkDependsOn);
GetReferenceAssemblyPaths
</ImplicitlyExpandTargetFrameworkDependsOn>
</PropertyGroup>
<Target Name="ImplicitlyExpandTargetFramework"
Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'"
DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)"
>
<ItemGroup>
<ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
<ReferencePath Include="%(ReferenceAssemblyPaths.Identity)*.dll">
<WinMDFile>false</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGroupingDisplayName>.NET for Windows Store apps</ReferenceGroupingDisplayName>
<ReferenceGrouping>$(TargetFrameworkMoniker)</ReferenceGrouping>
<ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</ReferencePath>
</ItemGroup>
<Message Importance="Low" Text="TargetMonikerDisplayName: $(TargetFrameworkMonikerDisplayName) ReferenceAssemblyPaths: @(ReferenceAssemblyPaths)"/>
<Message Importance="Low" Text="Including @(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/>
<ItemGroup>
<_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/>
</ItemGroup>
</Target>
<!--
The ImplicitlyExpandTargetPlatform target will expand all
of the winmd files in the windowsSDK and add them the the
ReferencePath item which is the itemgroup which contains
resolved items.
-->
<Target Name="ImplicitlyExpandTargetPlatform"
Condition="'$(ImplicitlyExpandTargetPlatform)' == 'true'"
>
<ItemGroup>
<ReferencePath Include="$(TargetPlatformWinMDLocation)\*.winmd">
<WinMDFile>true</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGrouping>$(TargetPlatformMoniker)</ReferenceGrouping>
<ReferenceGroupingDisplayName>$(TargetPlatformDisplayName)</ReferenceGroupingDisplayName>
<ResolvedFrom>ImplicitlyExpandTargetPlatform</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</ReferencePath>
</ItemGroup>
<Warning Condition="!Exists($(TargetPlatformWinMDLocation))"
Text="The path to the $(TargetPlatformIdentifier) SDK [$(TargetPlatformWinMDLocation)] was not found!"/>
<Message Importance="Low" Text="Including @(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetPlatform'"/>
<ItemGroup>
<_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetPlatform'"/>
</ItemGroup>
</Target>
<!--
Enable warning when referenced projects have higher version than the current project
for Windows Store projects
-->
<PropertyGroup>
<FindInvalidProjectReferences Condition="'$(TargetPlatformIdentifier)' == 'Windows' and
'$(TargetPlatformVersion)' &gt;= '8.0'">true</FindInvalidProjectReferences>
</PropertyGroup>
<!--
Enable warning when referenced ESDKs do not have MaxPlatformVersion
specified for Windows Store projects
-->
<PropertyGroup>
<SDKReferenceWarnOnMissingMaxPlatformVersion Condition="'$(SDKReferenceWarnOnMissingMaxPlatformVersion)' == '' and
'$(TargetPlatformIdentifier)' == 'Windows' and
'$(TargetPlatformVersion)' &gt;= '8.0'">true</SDKReferenceWarnOnMissingMaxPlatformVersion>
</PropertyGroup>
<Import Project="ImportAfter\*"/>
</Project>

52
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.Cps.targets

@ -1,52 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition=" '$(IsCodeSharingProject)' != 'true' ">
<!-- SDK references -->
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\SDKReference.xaml">
<Context>;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ResolvedSDKReference.xaml">
<Context>ProjectCapabilitySubscriptionService;BrowseObject</Context>
</PropertyPageSchema>
<ProjectCapability Include="SDKReferences" />
<!-- WinRT references -->
<!-- No need for WinRTReference.xaml because we share an item type with AssemblyReference.xaml -->
<ProjectCapability Include="WinRTReferences" />
</ItemGroup>
<ItemGroup>
<!-- Xaml item types -->
<PropertyPageSchema Include="
$(MSBuildThisFileDirectory)$(LangName)\PRIResource.xaml;
$(MSBuildThisFileDirectory)$(LangName)\ApplicationDefinition.xaml;
$(MSBuildThisFileDirectory)$(LangName)\Page.xaml;
$(MSBuildThisFileDirectory)$(LangName)\AppxManifest.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignData.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignDataWithDesignTimeCreatableTypes.xaml;
">
<Context>File;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ProjectItemsSchema.xaml"/>
</ItemGroup>
<ItemDefinitionGroup Condition=" '$(DefineExplicitDefaults)' == 'true' ">
<PRIResource>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</PRIResource>
<AppxManifest>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AppxManifest>
<Page>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Page>
<ApplicationDefinition>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</ApplicationDefinition>
<DesignData>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignData>
<DesignDataWithDesignTimeCreatableTypes>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignDataWithDesignTimeCreatableTypes>
</ItemDefinitionGroup>
</Project>

48
eng/msbuild/uwp/8.1/Microsoft.Windows.UI.Xaml.VisualBasic.targets

@ -1,48 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.VisualBasic.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
<ExplicitResetWarningSuppression>true</ExplicitResetWarningSuppression>
<MyType Condition="'$(MyType)' == ''">Empty</MyType>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\VisualBasic.ProjectItemsSchema.xaml"/>
</ItemGroup>
</Project>

BIN
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Build.Tasks.dll

Binary file not shown.

174
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.CPP.targets

@ -1,174 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Cpp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BeforeClCompileTargets>
MarkupCompilePass1;
$(BeforeClCompileTargets)
</BeforeClCompileTargets>
<ComputeCompileInputsTargets>
ComputeXamlGeneratedCompileInputs;
$(ComputeCompileInputsTargets)
</ComputeCompileInputsTargets>
<AfterBuildCompileTargets>
$(ComputeLinkInputsTargets);
CreateWinMD;
ComputeGeneratedWinMD;
MarkupCompilePass2;
ComputeInvalidXamlGenerated;
CompileXamlGeneratedFiles;
$(AfterBuildCompileTargets)
</AfterBuildCompileTargets>
<XamlPreLinkDependsOn>
$(XamlPreLinkDependsOn);
ComputeXamlGeneratedCLOutputs
</XamlPreLinkDependsOn>
<GenerateProjectionAssembly>True</GenerateProjectionAssembly>
<OnlyCreateWinMD>true</OnlyCreateWinMD>
<ImplicitlyExpandTargetPlatform>false</ImplicitlyExpandTargetPlatform>
</PropertyGroup>
<PropertyGroup>
<ValidatePresenceOfAppxManifestItemsDependsOn>
$(ValidatePresenceOfAppxManifestItemsDependsOn);
_CreateContentItemOutOfCustomAppxManifest
</ValidatePresenceOfAppxManifestItemsDependsOn>
</PropertyGroup>
<ItemGroup>
<PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\Xaml.xml" />
</ItemGroup>
<!-- This is a proxy target that holds stuff that runs before the final Link -->
<Target Name="XamlPreLink" BeforeTargets="Link" DependsOnTargets="$(XamlPreLinkDependsOn)" />
<Target Name="ComputeGeneratedWinMD" >
<PropertyGroup>
<LocalAssembly Condition="'$(LocalAssembly)' == '' and '%(Link.WindowsMetadataFile)' != ''">%(Link.WindowsMetadataFile)</LocalAssembly>
</PropertyGroup>
</Target>
<!-- Change AppxManifest.xml override item to be of Content type. -->
<Target Name="_CreateContentItemOutOfCustomAppxManifest">
<ItemGroup>
<Content Include="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
<Xml Remove="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
</ItemGroup>
</Target>
<PropertyGroup>
<GeneratedFilesDir Condition=" '$(GeneratedFilesDir)' == ''">Generated Files\</GeneratedFilesDir>
<XamlGeneratedOutputPath>$(GeneratedFilesDir)</XamlGeneratedOutputPath>
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.g.h;*.g.cpp;*.xaml</ExtensionsToDeleteOnClean>
</PropertyGroup>
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\Cpp.ProjectItemsSchema.xaml"/>
</ItemGroup>
<!-- Generated files output group population -->
<PropertyGroup>
<GeneratedFilesOutputGroupDependsOn>XamlGeneratedFilesOutputGroup;$(GeneratedFilesOutputGroupDependsOn)</GeneratedFilesOutputGroupDependsOn>
</PropertyGroup>
<Target Name="XamlGeneratedFilesOutputGroup"
DependsOnTargets="$(XamlGeneratedFilesOutputGroupDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
</ItemGroup>
</Target>
<Target Name="ComputeXamlGeneratedCompileInputs"
DependsOnTargets="$(ComputeXamlGeneratedCompileInputsDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.g.cpp" >
<CompilerIteration>XamlGenerated</CompilerIteration>
</ClCompile>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.Impl.g.cpp" />
<ClCompile Condition="'$(OutputType)' == 'Library'" Include="$(XamlGeneratedOutputPath)XamlLibMetadataProvider.g.cpp" />
</ItemGroup>
<!-- The build only wants to generate winmd once, either during Link target or Createwinmd target, not both.
Link and Createwinmd targets will execute link.exe, so it is best to run link.exe only once.
However, there are two cases where that isn't possible.
1) when build is building XAML and
2) when building in passes. -->
<PropertyGroup>
<GenerateBuildCompilePassWinMD Condition="'$(GenerateBuildCompilePassWinMD)' == ''">true</GenerateBuildCompilePassWinMD>
</PropertyGroup>
</Target>
<Target Name="ComputeInvalidXamlGenerated" >
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!-- Add CL generates .obj files to Obj item group, it will be used by lib or link -->
<Target Name="ComputeXamlGeneratedCLOutputs"
DependsOnTargets="ComputeXamlGeneratedCompileInputs;ComputeInvalidXamlGenerated"
Condition="'@(ClCompile)' != ''">
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
<!-- No object file name defined: filename.obj -->
<Obj Condition="'%(ClCompile.ObjectFileName)'=='' and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(Filename).obj')" />
<!-- Object file name is a directory (has trailing slash): ofn\filename.obj -->
<Obj Condition="HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)%(Filename).obj')" />
<!-- Object file name is a file (does not has trailing slash): ofn -->
<Obj Condition="'%(ClCompile.ObjectFileName)' != '' and !HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)')" />
<Link Include="@(Obj->WithMetadataValue('CompilerIteration', 'XamlGenerated')->ClearMetadata())" />
</ItemGroup>
</Target>
<!-- Enable design time build as well as selected file(s) compile support -->
<PropertyGroup>
<EnableDesignTimeBuild>true</EnableDesignTimeBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<Page>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</Page>
<ApplicationDefinition>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</ApplicationDefinition>
</ItemDefinitionGroup>
<PropertyGroup>
<MarkupCompilePass1DependsOn>CppDesignTimeMarkupCompilation;$(MarkupCompilePass1DependsOn)</MarkupCompilePass1DependsOn>
</PropertyGroup>
<Target Name="CppDesignTimeMarkupCompilation"
DependsOnTargets="_SelectedFiles;SelectCustomBuild;ResolveReferences">
<!-- Ideally we'd like to be able to build just the requested files (if it makes sense). -->
<!--<ItemGroup Condition="'@(SelectedFiles)'!=''">
<Page Remove="@(Page)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
<ApplicationDefinition Remove="@(ApplicationDefinition)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
</ItemGroup>-->
</Target>
</Project>

61
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.CSharp.targets

@ -1,61 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.CSharp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.2</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'UAP'">
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(SDKIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">
<SDKIdentifier>Windows</SDKIdentifier>
<SDKVersion>10.0</SDKVersion>
</PropertyGroup>
<PropertyGroup>
<UWPNugetRepo Condition="'$(UWPNugetRepo)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</UWPNugetRepo>
<RestoreAdditionalProjectFallbackFolders>$(RestoreAdditionalProjectFallbackFolders);$(UWPNugetRepo)</RestoreAdditionalProjectFallbackFolders>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<!-- Supress the warnings in the 1st pass so that warnings are not repeated twice -->
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\CSharp.ProjectItemsSchema.xaml"/>
</ItemGroup>
</Project>

753
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Common.targets

@ -1,753 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Common.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="ImportBefore\*"/>
<!-- Need the path to vcmeta.dll -->
<PropertyGroup>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSWinExpress\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VSWinExpress\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(VsInstallRoot)\Common7\IDE\VC\</VCInstallDir>
<WindowsSdkPath Condition="'$(WindowsSdkPath)'==''">$(TargetPlatformSdkRootOverride)</WindowsSdkPath>
<WindowsSdkPath Condition="'$(WindowsSdkPath)'==''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\$(SDKIdentifier)\v$(SDKVersion)', 'InstallationFolder', null, RegistryView.Registry32, RegistryView.Default))</WindowsSdkPath>
<XAMLFingerprint Condition="'$(XAMLFingerprint)' == ''">true</XAMLFingerprint>
<DisableXbfGeneration Condition="'$(DisableXbfGeneration)' == '' AND '$(TargetPlatformVersion)' == '8.0'">true</DisableXbfGeneration>
<DisableXbfGeneration Condition="'$(DisableXbfGeneration)' == ''">false</DisableXbfGeneration>
<XamlSavedStateFileName Condition="'$(XamlSavedStateFileName)' == ''">XamlSaveStateFile.xml</XamlSavedStateFileName>
<XamlSavedStateFilePath>$(IntermediateOutputPath)\$(XamlSavedStateFileName)</XamlSavedStateFilePath>
<XAMLFingerprintIgnorePaths Condition="'$(XAMLFingerprintIgnorePaths)'==''">
@(ReferenceAssemblyPaths);
$(WindowsSdkPath)
</XAMLFingerprintIgnorePaths>
<!-- Note that like a few other properties FacadeWinmdPath is used beyond msbuild infrastructure. -->
<FacadeWinmdPath>$(WindowsSdkPath)\UnionMetadata\facade\Windows.winmd</FacadeWinmdPath>
</PropertyGroup>
<ItemGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
<AvailableItemName Include="PRIResource" />
<AvailableItemName Include="AppxManifest" />
<AvailableItemName Include="ApplicationDefinition" />
<AvailableItemName Include="Page" />
<AvailableItemName Include="DesignData" />
<AvailableItemName Include="DesignDataWithDesignTimeCreatableTypes" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="WindowsXaml"/>
<ProjectCapability Include="WindowsXamlPage"/>
<ProjectCapability Include="WindowsXamlCodeBehind"/>
<ProjectCapability Include="WindowsXamlResourceDictionary"/>
<ProjectCapability Include="WindowsXamlUserControl"/>
<ProjectCapability Include="WindowsUniversalMultiViews"/>
</ItemGroup>
<!-- For Managed Assemblies Create a XAML Roots Log -->
<PropertyGroup Condition="'$(ManagedAssembly)' != 'false'">
<XamlRootsLog>$(AssemblyName).xr.xml</XamlRootsLog>
</PropertyGroup>
<!-- Setting PRI index name. The XAML compiler use this in the LoadComponent() string.
It must match the name of the directoy the AppX Packaging system uses -->
<PropertyGroup>
<!-- Exe's don't have an PriIndexName -->
<PriIndexName Condition="'$(AppxPackage)' == 'true'"></PriIndexName>
<!-- Managed Dll's use the "safe" name of the project as the App Package Name -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' != 'false' and '$(OutputType)' != 'winmdobj'">$(TargetName)</PriIndexName>
<!-- Winmd library targets (managed or native) use the default root namespace of the project for the App package name -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' != 'false' and '$(OutputType)' == 'winmdobj'">$(RootNamespace)</PriIndexName>
<PriIndexName Condition="'$(AppxPackage)' != 'true' and '$(ManagedAssembly)' == 'false' and '$(RootNamespace)' != ''">$(RootNamespace)</PriIndexName>
<!-- If RootNamespace is empty fall back to TargetName -->
<PriIndexName Condition="'$(AppxPackage)' != 'true' and $(PriIndexName) == ''">$(TargetName)</PriIndexName>
</PropertyGroup>
<PropertyGroup>
<AvailablePlatforms>$(AvailablePlatforms),ARM</AvailablePlatforms>
<!-- this Property is used only for the Managed build.
See Microsoft.Windows.UI.Xaml.Cpp.targets for Native build rules -->
<PrepareResourcesDependsOn>
ResolveKeySource;
MarkupCompilePass1;
XamlPreCompile;
MarkupCompilePass2;
$(PrepareResourcesDependsOn)
</PrepareResourcesDependsOn>
<Prefer32Bit Condition="'$(Prefer32Bit)' == '' and ('$(OutputType)' == 'exe' or '$(OutputType)' == 'winexe' or '$(OutputType)' == 'appcontainerexe')">true</Prefer32Bit>
<HighEntropyVA Condition="'$(HighEntropyVA)' == ''">true</HighEntropyVA>
<SubsystemVersion Condition="'$(SubsystemVersion)' == '' and ('$(PlatformTarget)' == 'ARM' or '$(OutputType)' == 'appcontainerexe' or '$(OutputType)' == 'winmdobj')">6.02</SubsystemVersion>
<SubsystemVersion Condition="'$(SubsystemVersion)' == ''">6.00</SubsystemVersion>
<OnXamlPreCompileErrorTarget Condition="'$(OnXamlPreCompileErrorTarget)' == ''">_OnXamlPreCompileError</OnXamlPreCompileErrorTarget>
<!-- Use Intermediate dir if XamlGeneratedOutputPath is not defined -->
<XamlGeneratedOutputPath Condition="'$(XamlGeneratedOutputPath)' == ''">$(IntermediateOutputPath)</XamlGeneratedOutputPath>
</PropertyGroup>
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.CompileXaml" AssemblyFile="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.AddDefaultXamlLinkMetadata" AssemblyFile="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.Windows.UI.Xaml.Build.Tasks.GetXamlCppIncludeDirectories" AssemblyFile="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" />
<PropertyGroup>
<!--If the path to the sign tool is not set, assume the SDK path -->
<SignToolPath Condition="'$(SignToolPath)' == ''">$(FrameworkSDKRoot)bin</SignToolPath>
<!--Integration with packaging for GeneratedXamlFilesOutputGroupOutput -->
<IncludeCustomOutputGroupForPackaging>true</IncludeCustomOutputGroupForPackaging>
</PropertyGroup>
<ItemGroup>
<XamlIntermediateAssembly Condition="'$(ManagedAssembly)'!='false'" Include="$(XamlGeneratedOutputPath)intermediatexaml\$(TargetName)$(TargetExt)"/>
<XamlIntermediateAssembly Condition="'$(ManagedAssembly)'=='false'" Include="$(OutputPath)\$(TargetName).winmd"/>
</ItemGroup>
<!--
============================================================
Adds all XAML Pages to the $(Resource) collection
============================================================
-->
<ItemGroup Condition=" '$(ManagedAssembly)'=='' ">
<!-- Add XAML Page items to $(Resource) -->
<Resource Include="@(Page)" />
<Resource Include="@(ApplicationDefinition)" />
</ItemGroup>
<!-- Manifest metadata items. -->
<!-- See Microsoft.AppxPackage.targets for details. -->
<PropertyGroup>
<XAMLCompilerVersion Condition=" '$(TargetPlatformIdentifier)' == 'UAP' ">8.2</XAMLCompilerVersion>
<XAMLCompilerVersion Condition=" '$(XAMLCompilerVersion)' == '' ">$(TargetPlatformVersion)</XAMLCompilerVersion>
</PropertyGroup>
<!-- Project binary needs to be updated after updating xaml page -->
<ItemGroup>
<CustomAdditionalCompileInputs Include="@(Page)" />
</ItemGroup>
<ItemGroup Label="AppxManifestMetadata">
<AppxManifestMetadata Include="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\$(XAMLCompilerVersion)\Microsoft.Windows.UI.Xaml.Build.Tasks.dll" />
</ItemGroup>
<PropertyGroup>
<MarkupCompilePass1DependsOn>
GetXamlCppIncludeDirectories;
$(GetXamlCppIncludeDirectories)
</MarkupCompilePass1DependsOn>
<MarkupCompilePass2DependsOn>
GetXamlCppIncludeDirectories;
$(GetXamlCppIncludeDirectories)
</MarkupCompilePass2DependsOn>
<Prep_ComputeProcessXamlFilesDependsOn>
GetXamlCppIncludeDirectories;
$(Prep_ComputeProcessXamlFilesDependsOn)
</Prep_ComputeProcessXamlFilesDependsOn>
</PropertyGroup>
<!-- In order for the XAML compiler to generated the correct relative paths for #includes in
the generated C++ code it needs to know the AdditionalIncludeDirectories of all the .cpp
files are DependentUpon XAML files.-->
<Target Name="GetXamlCppIncludeDirectories" Condition="'$(ManagedAssembly)'=='false' and '$(XamlCppIncludeDirectories)' == ''">
<GetXamlCppIncludeDirectories ClCompile="@(ClCompile)">
<Output PropertyName="XamlCppIncludeDirectories" TaskParameter="ComputedIncludeDirectories" />
</GetXamlCppIncludeDirectories>
</Target>
<!--
================================================================
DesignTimeMarkupCompilation
Support for the Intellisense build
================================================================
-->
<PropertyGroup>
<CoreCompileDependsOn Condition="'$(BuildingInsideVisualStudio)' == 'true' ">
DesignTimeMarkupCompilation;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="DesignTimeMarkupCompilation">
<!-- BuildingProject is used in Managed builds (always true in Native) -->
<!-- DesignTimeBuild is used in Native builds (always false in Managed) -->
<CallTarget Condition="'$(BuildingProject)' != 'true' Or $(DesignTimeBuild) == 'true'" Targets="DesignTimeMarkupCompilationCT" />
</Target>
<!-- A copy of the first pass, without the WarningLevel manipulation -->
<Target Name="DesignTimeMarkupCompilationCT"
DependsOnTargets="$(MarkupCompilePass1DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<MakeDir Condition="'$(ManagedAssembly)'!='false'" Directories="$(XamlGeneratedOutputPath)intermediatexaml\" />
<ItemGroup>
<ReferencePath Condition="'$(Language)'=='C++' and Exists($(FacadeWinmdPath))" Include="$(FacadeWinmdPath)" />
</ItemGroup>
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="True"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
ProjectPath="$(MSBuildProjectFullPath)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(ReferencePath)"
ForceSharedStateShutdown="False"
ContinueOnError="True"
CompileMode="DesignTimeBuild"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
SuppressWarnings="$(SuppressXamlWarnings)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"
WindowsSdkPath="$(WindowsSdkPath)"
>
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<!--
Add to the list of files written.
It is used in Microsoft.Common.targets for a next clean build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
</ItemGroup>
<Message Text="(Out) ISenseCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) ISenseXamlFiles: '@(_GeneratedXamlFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'%(ClCompile.CompilerIteration)' != 'XamlGenerated'"/>
<Message Text="(Out) Compile: '@(Compile)'" />
</Target>
<!--
================================================================
MarkupCompilePass1
================================================================
-->
<Target Name="MarkupCompilePass1"
DependsOnTargets="$(MarkupCompilePass1DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<MakeDir Condition="'$(ManagedAssembly)'!='false'" Directories="$(XamlGeneratedOutputPath)intermediatexaml\" />
<ItemGroup>
<ReferencePath Condition="'$(Language)'=='C++' and Exists($(FacadeWinmdPath))" Include="$(FacadeWinmdPath)" />
</ItemGroup>
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="True"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
ProjectPath="$(MSBuildProjectFullPath)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(ReferencePath)"
ForceSharedStateShutdown="False"
CompileMode="RealBuildPass1"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
SavedStateFile="$(XamlSavedStateFilePath)"
SuppressWarnings="$(SuppressXamlWarnings)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"
WindowsSdkPath="$(WindowsSdkPath)"
>
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<!--
FileWrites is used in Microsoft.Common.targets for "Clean" build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXbfFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
</ItemGroup>
<Message Text="(Out) GeneratedCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'$(ManagedAssembly)'=='false' and '%(ClCompile.CompilerIteration)'!='XamlGenerated'"/>
<Message Text="(Out) Compile: '@(Compile)'" Condition="'$(ManagedAssembly)'!='false'"/>
<PropertyGroup>
<PrevWarningLevel>$(WarningLevel)</PrevWarningLevel>
<WarningLevel Condition="'$(SuppressWarningsInPass1)'=='true'">0</WarningLevel>
</PropertyGroup>
</Target>
<!--
================================================================
MarkupCompilePass2
================================================================
-->
<Target Name="MarkupCompilePass2"
DependsOnTargets="$(MarkupCompilePass2DependsOn)"
Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != '' " >
<PropertyGroup>
<WarningLevel>$(PrevWarningLevel)</WarningLevel>
<WarningLevel Condition="'$(WarningLevel)' == '' and '$(ExplicitResetWarningSuppression)' == 'true'">1</WarningLevel>
</PropertyGroup>
<!-- The Name of the Local Assembly in Managed and Native -->
<PropertyGroup>
<LocalAssembly Condition="'$(LocalAssembly)' == '' and Exists(@(XamlIntermediateAssembly))">
@(XamlIntermediateAssembly->'%(Identity)')
</LocalAssembly>
</PropertyGroup>
<CallTarget Targets="SDKRedistOutputGroup" Condition="'$(IncludeSDKRedistOutputGroup)' == 'true'">
<Output TaskParameter="TargetOutputs" ItemName="_SDKRedistOutputGroupOutput_xaml"/>
</CallTarget>
<ItemGroup>
<SdkXamlItems Include="@(_SDKRedistOutputGroupOutput_xaml)" Condition="'%(Extension)'=='.xaml'" />
</ItemGroup>
<ItemGroup>
<!-- C++ provides a filtered Item that eliminates any Managed Assemblies on the ReferencePath (from SDKs for example) -->
<XamlReferencesToCompile Condition="'$(Language)'=='C++'" Include="@(WinMDReferenceToCompile)" />
<XamlReferencesToCompile Condition="'$(Language)'=='C++' and Exists($(FacadeWinmdPath))" Include="$(FacadeWinmdPath)" />
<XamlReferencesToCompile Condition="'$(Language)'!='C++'" Include="@(ReferencePath)" />
</ItemGroup>
<CompileXaml
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
Language="$(Language)"
RootNamespace="$(RootNamespace)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
SdkXamlPages="@(SdkXamlItems)"
PriIndexName="$(PriIndexName)"
ProjectName="$(MsBuildProjectName)"
IsPass1="False"
DisableXbfGeneration="$(DisableXbfGeneration)"
CodeGenerationControlFlags="$(XamlCodeGenerationControlFlags)"
ClIncludeFiles="@(ClInclude)"
CIncludeDirectories="$(XamlCppIncludeDirectories)"
LocalAssembly="$(LocalAssembly)"
ProjectPath="$(MSBuildProjectFullPath)"
OutputPath="$(XamlGeneratedOutputPath)"
OutputType="$(OutputType)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
ReferenceAssemblies="@(XamlReferencesToCompile)"
ForceSharedStateShutdown="False"
CompileMode="RealBuildPass2"
XAMLFingerprint="$(XAMLFingerprint)"
FingerprintIgnorePaths="$(XAMLFingerprintIgnorePaths)"
VCInstallDir="$(VCInstallDir)"
WindowsSdkPath="$(WindowsSdkPath)"
SavedStateFile="$(XamlSavedStateFilePath)"
RootsLog="$(XamlRootsLog)"
SuppressWarnings="$(SuppressXamlWarnings)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"
BuildConfiguration="$(Configuration)"
DisableXbfLineInfo="$(DisableXbfLineInfo)">
<Output Condition=" '$(ManagedAssembly)'!='false' " ItemName="Compile" TaskParameter="GeneratedCodeFiles" />
<Output Condition=" '$(ManagedAssembly)'=='false' " ItemName="XamlGFiles" TaskParameter="GeneratedCodeFiles" />
<!--
FileWrites is used in Microsoft.Common.targets for "Clean" build
-->
<Output ItemName="FileWrites" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="FileWrites" TaskParameter="GeneratedXbfFiles" />
<Output ItemName="_GeneratedCodeFiles" TaskParameter="GeneratedCodeFiles" />
<Output ItemName="_GeneratedXamlFiles" TaskParameter="GeneratedXamlFiles" />
<Output ItemName="_GeneratedXbfFiles" TaskParameter="GeneratedXbfFiles" />
</CompileXaml>
<ItemGroup>
<FileWrites Include="$(XamlSavedStateFilePath)" />
<FileWrites Condition="'$(XamlRootsLog)' != ''" Include="$(XamlRootsLog)" />
</ItemGroup>
<Message Text="(Out) GeneratedCodeFiles: '@(_GeneratedCodeFiles)'" />
<Message Text="(Out) GeneratedXamlFiles: '@(_GeneratedXamlFiles)'" />
<Message Text="(Out) GeneratedXbfFiles: '@(_GeneratedXbfFiles)'" />
<Message Text="(Out) ClCompile: '@(ClCompile)'" Condition="'$(ManagedAssembly)'=='false'"/>
<Message Text="(Out) Compile: '@(Compile)'" Condition="'$(ManagedAssembly)'!='false'"/>
</Target>
<Target Name="_OnXamlPreCompileError"
DependsOnTargets="$(_OnXamlPrecompileErrorDependsOn)" >
<CompileXaml
ProjectPath="$(MSBuildProjectFullPath)"
Language="$(Language)"
LanguageSourceExtension="$(DefaultLanguageSourceExtension)"
OutputPath="$(XamlGeneratedOutputPath)"
ReferenceAssemblies="@(ReferencePath)"
ReferenceAssemblyPaths="@(ReferenceAssemblyPaths)"
XamlPages="@(Page)"
XamlApplications="@(ApplicationDefinition)"
ForceSharedStateShutdown="True"
CompileMode="OnErrorShutdown"
SavedStateFile="$(XamlSavedStateFilePath)"
TargetPlatformMinVersion="$(TargetPlatformMinVersion)"
>
</CompileXaml>
</Target>
<Target Name="Prep_ComputeProcessXamlFiles"
Condition="'@(ApplicationDefinition)'!='' or '@(Page)'!=''"
DependsOnTargets="$(Prep_ComputeProcessXamlFilesDependsOn)" >
<!-- collect all the XAML pages from the Project file into one Item -->
<ItemGroup>
<AllProjectXamlPages Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition)" />
<AllProjectXamlPages Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page)" />
</ItemGroup>
<!-- For items are outside the project core Link metadata tells us what the apparent project path should be.
C++ doesn't use Link data, so for C++ add implied DefaultXamlLink metadata based on the Include Path -->
<AddDefaultXamlLinkMetadata Condition="'$(ManagedAssembly)'=='false'"
ProjectPath="$(ProjectPath)"
XamlPages="@(AllProjectXamlPages)"
CIncludeDirectories ="$(XamlCppIncludeDirectories)">
<Output TaskParameter="OutputItems" ItemName="_Temp" />
</AddDefaultXamlLinkMetadata>
<!-- Remove the Items named in _Temp, then add the actual items from _Temp, then clear _Temp -->
<ItemGroup>
<AllProjectXamlPages Remove="@(_Temp)" />
<AllProjectXamlPages Include="@(_Temp)" />
<_Temp Remove="@(_Temp)" />
</ItemGroup>
<!-- transfer the DefaultXamlLink data to the Link attribute -->
<ItemGroup>
<AllProjectXamlPages Condition="'%(AllProjectXamlPages.DefaultXamlLink)'!=''">
<Link>%(AllProjectXamlPages.DefaultXamlLink)</Link>
</AllProjectXamlPages>
</ItemGroup>
<!-- Compute the Generated XAML source path and the bin dir Destination path -->
<!-- If there is a Link use that, otherwise use the Given path from the Project file Item -->
<ItemGroup>
<GeneratedXamlSrc0 Condition="'%(AllProjectXamlPages.Link)'!=''" Include="@(AllProjectXamlPages->'$(XamlGeneratedOutputPath)%(Link)')" />
<GeneratedXamlSrc0 Condition="'%(AllProjectXamlPages.Link)'==''" Include="@(AllProjectXamlPages->'$(XamlGeneratedOutputPath)%(Identity)')" />
<GeneratedXamlDest0 Condition="'%(AllProjectXamlPages.Link)'!=''" Include="@(AllProjectXamlPages->'$(OutputPath)\%(Link)')" />
<GeneratedXamlDest0 Condition="'%(AllProjectXamlPages.Link)'==''" Include="@(AllProjectXamlPages->'$(OutputPath)\%(Identity)')" />
</ItemGroup>
<!-- Swap in the XBF suffix if appropriate. -->
<ItemGroup Condition="'$(DisableXbfGeneration)' == 'true'">
<GeneratedXamlSrc Include="@(GeneratedXamlSrc0)" />
<GeneratedXamlDest Include="@(GeneratedXamlDest0)" />
</ItemGroup>
<ItemGroup Condition="'$(DisableXbfGeneration)' != 'true'">
<GeneratedXamlSrc Include="%(GeneratedXamlSrc0.RelativeDir)%(GeneratedXamlSrc0.Filename).xbf" />
<GeneratedXamlDest Include="%(GeneratedXamlDest0.RelativeDir)%(GeneratedXamlDest0.Filename).xbf" />
</ItemGroup>
<!-- if we converted SDK XAML into XBF, add the XBF to the list, and remove the XAML from the list -->
<ItemGroup Condition="'$(DisableXbfGeneration)' != 'true' and '@(SdkXamlItems)' != ''">
<GeneratedSdkXamlSrc0 Include="@(SdkXamlItems->'$(XamlGeneratedOutputPath)%(TargetPath)')" />
<GeneratedSdkXamlDest0 Include="@(SdkXamlItems->'$(OutputPath)\%(TargetPath)')" />
<GeneratedXamlSrc Include="%(GeneratedSdkXamlSrc0.RelativeDir)%(GeneratedSdkXamlSrc0.Filename).xbf" >
<ReferenceSourceTarget>ExpandSDKReference</ReferenceSourceTarget>
</GeneratedXamlSrc>
<GeneratedXamlDest Include="%(GeneratedSdkXamlDest0.RelativeDir)%(GeneratedSdkXamlDest0.Filename).xbf" >
<ReferenceSourceTarget>ExpandSDKReference</ReferenceSourceTarget>
</GeneratedXamlDest>
<RemoveSdkFilesFromAppxPackage Include="@(SdkXamlItems)" />
</ItemGroup>
<ItemGroup Condition="'$(XamlRootsLog)' != ''">
<GeneratedXamlSrc Include="$(XamlGeneratedOutputPath)\$(XamlRootsLog)" />
<GeneratedXamlDest Include="$(OutputPath)\$(XamlRootsLog)" />
</ItemGroup>
<Message Importance="low" Text="(Out) Prep_GeneratedXamlSrc == @(GeneratedXamlSrc)" />
<Message Importance="low" Text="(Out) Prep_GeneratedXamlDest == @(GeneratedXamlDest)" />
</Target>
<!-- if $GenerateLibraryLayout is True this is skipped and see the PrepareLibraryLayout target -->
<Target Name="CopyGeneratedXaml" BeforeTargets="CopyFilesToOutputDirectory" DependsOnTargets="Prep_ComputeProcessXamlFiles"
Condition="'$(GenerateLibraryLayout)' != 'true'">
<Copy
SourceFiles="@(GeneratedXamlSrc)"
DestinationFiles="@(GeneratedXamlDest)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
/>
<ItemGroup>
<FileWrites Include="@(GeneratedXamlDest)" />
</ItemGroup>
</Target>
<Target Name="ComputeProcessXamlFiles" Returns="@(ProcessedXamlFiles)" DependsOnTargets="Prep_ComputeProcessXamlFiles">
<ItemGroup >
<!-- In the normal (non-SDK) build, AppX Packaging picks up the files from the bin aka OutputPath folder -->
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' != 'true'" Include="@(GeneratedXamlDest)" />
<!-- In the SDK build, AppX Packaging picks up the files from the XamlGeneratedOutput folder -->
<!-- For SDK builds include both the XAML and XBF -->
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' == 'true'" Include="@(GeneratedXamlSrc)" />
<ProcessedXamlFiles Condition="'$(GenerateLibraryLayout)' == 'true' and '$(DisableXbfGeneration)' != 'true'"
Include="@(GeneratedXamlSrc0)" />
</ItemGroup>
<Message Importance="Low" Text="(Out) GeneratedXamlDest == @(GeneratedXamlDest)" />
<Message Importance="Low" Text="(Out) GeneratedXamlSrc == @(GeneratedXamlSrc)" />
<Message Text="(Out) ProcessedXamlFiles == @(ProcessedXamlFiles)" />
</Target>
<Target Name="CustomOutputGroupForPackaging"
DependsOnTargets="ComputeProcessXamlFiles"
Returns="@(CustomOutputGroupForPackagingOutput)"
>
<ItemGroup>
<ProcessedXamlFilesFullPath Include="@(ProcessedXamlFiles->'%(FullPath)')" />
</ItemGroup>
<PropertyGroup>
<XamlPackagingRootFolder Condition="'$(GenerateLibraryLayout)' == 'true'">$(XamlGeneratedOutputPath)</XamlPackagingRootFolder>
<XamlPackagingRootFolder Condition="'$(GenerateLibraryLayout)' != 'true'">$(OutputPath)\</XamlPackagingRootFolder>
</PropertyGroup>
<AssignTargetPath Files="@(ProcessedXamlFilesFullPath)" RootFolder="$(XamlPackagingRootFolder)">
<Output TaskParameter="AssignedFiles" ItemName="CustomOutputGroupForPackagingOutput" />
</AssignTargetPath>
<Message Text="(Out) Project='$(MsBuildProjectName)' ProcessedXamlFiles == @(ProcessedXamlFiles)" />
<Message Text="(Out) XamlPackagingRootFolder == $(XamlPackagingRootFolder)" />
<Message Text="(Out) ProcessedXamlFilesFullPath == @(ProcessedXamlFilesFullPath)" />
<Message Text="(Out) Project='$(MsBuildProjectName)' CustomOutputGroupForPackagingOutput == @(CustomOutputGroupForPackagingOutput)" />
</Target>
<PropertyGroup>
<PrepareLibraryLayoutDependsOn>
GetPackagingOutputs;
$(PrepareLibraryLayoutDependsOn)
</PrepareLibraryLayoutDependsOn>
</PropertyGroup>
<!-- This builds the Bin Folder for DLL's that wish to have the SDK type layout -->
<Target Name="PrepareLibraryLayout"
Condition="'$(GenerateLibraryLayout)' == 'true'"
DependsOnTargets="$(PrepareLibraryLayoutDependsOn)"
BeforeTargets="CopyFilesToOutputDirectory"
>
<ItemGroup>
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'ContentFilesProjectOutputGroup'" />
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'CustomOutputGroupForPackaging'" />
</ItemGroup>
<Copy SourceFiles="@(_LayoutFile)"
DestinationFiles="@(_LayoutFile->'$(OutDir)\%(TargetPath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
/>
</Target>
<!--
============================================================
Properties and Targets Common to Managed .NETCore projects
============================================================
-->
<!--
The ImplicitlyExpandTargetFramework target will expand all
of the dll reference assemblies in the TargetFrameworkDirectory
for the project and place the items into the ReferencePath itemgroup
which contains resolved items.
-->
<PropertyGroup>
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
ImplicitlyExpandTargetFramework;
ImplicitlyExpandTargetPlatform
</ResolveReferencesDependsOn>
<ImplicitlyExpandTargetFrameworkDependsOn>
$(ImplicitlyExpandTargetFrameworkDependsOn);
GetReferenceAssemblyPaths
</ImplicitlyExpandTargetFrameworkDependsOn>
</PropertyGroup>
<Target Name="ImplicitlyExpandTargetFramework"
Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'"
DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)"
>
<ItemGroup>
<ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
<ReferencePath Include="%(ReferenceAssemblyPaths.Identity)*.dll">
<WinMDFile>false</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGroupingDisplayName>.NET for Windows Store apps</ReferenceGroupingDisplayName>
<ReferenceGrouping>$(TargetFrameworkMoniker)</ReferenceGrouping>
<ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</ReferencePath>
</ItemGroup>
<Message Importance="Low" Text="TargetMonikerDisplayName: $(TargetFrameworkMonikerDisplayName) ReferenceAssemblyPaths: @(ReferenceAssemblyPaths)"/>
<Message Importance="Low" Text="Including @(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/>
<ItemGroup>
<_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandTargetFramework'"/>
</ItemGroup>
</Target>
<!--
The ImplicitlyExpandTargetPlatform target will find the
appropriate platform in the requested SDK, gather the
list of references for that platform, and add them to the
ReferencePath item which is the ItemGroup which contains
resolved paths to pass to e.g. the compiler.
-->
<Target Name="ImplicitlyExpandTargetPlatform"
Condition="'$(ImplicitlyExpandTargetPlatform)' == 'true'"
>
<ItemGroup>
<_TargetPlatformWinMDs Condition="'$(TargetPlatformSdkRootOverride)' != ''" Include="$(TargetPlatformSdkRootOverride)\References\**\*.winmd">
<WinMDFile>true</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGrouping>$(TargetPlatformMoniker)</ReferenceGrouping>
<ReferenceGroupingDisplayName>$(TargetPlatformDisplayName)</ReferenceGroupingDisplayName>
<ResolvedFrom>ImplicitlyExpandTargetPlatform</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</_TargetPlatformWinMDs>
<_TargetPlatformWinMDs Condition="'$(TargetPlatformSdkRootOverride)' == ''" Include="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetTargetPlatformReferences($(SDKIdentifier), $(SDKVersion), $(TargetPlatformIdentifier), $(TargetPlatformMinVersion), $(TargetPlatformVersion)))">
<WinMDFile>true</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGrouping>$(TargetPlatformMoniker)</ReferenceGrouping>
<ReferenceGroupingDisplayName>$(TargetPlatformDisplayName)</ReferenceGroupingDisplayName>
<ResolvedFrom>ImplicitlyExpandTargetPlatform</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</_TargetPlatformWinMDs>
</ItemGroup>
<Warning Condition="'@(_TargetPlatformWinMDs)' == ''"
Text="Could not find target platform winmds for the SDK specified by [$(SDKIdentifier), $(SDKVersion), $(TargetPlatformIdentifier), $(TargetPlatformMinVersion), $(TargetPlatformVersion)]"/>
<Message Importance="Low" Text="Including @(_TargetPlatformWinMDs)" />
<ItemGroup>
<ReferencePath Include="@(_TargetPlatformWinMDs)" />
<ReferencePath Include="$(FacadeWinmdPath)" Condition="Exists($(FacadeWinmdPath))">
<WinMDFile>true</WinMDFile>
<CopyLocal>false</CopyLocal>
<ReferenceGrouping>$(TargetPlatformMoniker)</ReferenceGrouping>
<ReferenceGroupingDisplayName>$(TargetPlatformDisplayName)</ReferenceGroupingDisplayName>
<ResolvedFrom>ImplicitlyExpandTargetPlatform</ResolvedFrom>
<IsSystemReference>True</IsSystemReference>
</ReferencePath>
<_ResolveAssemblyReferenceResolvedFiles Include="@(_TargetPlatformWinMDs)" />
<!-- Clear out 'temporary' variable -->
<_TargetPlatformWinMDs Remove="@(_TargetPlatformWinMDs)" />
</ItemGroup>
</Target>
<!--
Enable warning when referenced projects have higher version than the current project
for Windows Store projects
-->
<PropertyGroup>
<FindInvalidProjectReferences Condition="'$(TargetPlatformIdentifier)' == 'Windows' and
'$(TargetPlatformVersion)' &gt;= '8.0'">true</FindInvalidProjectReferences>
</PropertyGroup>
<!--
Enable warning when referenced ESDKs do not have MaxPlatformVersion
specified for Windows Store projects
-->
<PropertyGroup>
<SDKReferenceWarnOnMissingMaxPlatformVersion Condition="'$(SDKReferenceWarnOnMissingMaxPlatformVersion)' == '' and
'$(TargetPlatformIdentifier)' == 'Windows' and
'$(TargetPlatformVersion)' &gt;= '8.0'">true</SDKReferenceWarnOnMissingMaxPlatformVersion>
</PropertyGroup>
<!--
Ensure that UAP headless applications' WINMDs are resolved so that GenerateAppxManifest has the required
metadata to generate activatableClass extensions. This should only execute for non-EXE projects that have
<ContainsStartupTask>true</ContainsStartupTask> and create APPX packages.
-->
<Target Name="_ResolvePrimaryProjectWinmdFiles"
BeforeTargets="BeforeGenerateAppxManifest"
AfterTargets="_GetPackagingOutputs"
Condition="'$(OutputType)' != 'exe' and '$(AppxPackage)' == 'true' AND '$(ContainsStartupTask)' == 'true'">
<ItemGroup>
<_AppxWinmdFilesToHarvest Include="@(PackagingOutputs)"
Condition="'%(PackagingOutputs.Extension)' == '.winmd'
and '%(PackagingOutputs.ProjectName)' == '$(ProjectName)'
and '%(PackagingOutputs.ResolvedFrom)' != 'GetSDKReferenceFiles'">
<!-- This covers the Managed Background Application winmd which does NOT have a WinMDFileType value set -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''">WindowsRuntime 1.4;CLR v4.0.30319</ImageRuntime>
<!-- This covers the C++ Background Application winmd which does NOT have a WinMDFileType value set -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '@(Language)' == 'C++'">WindowsRuntime 1.4</ImageRuntime>
<!-- This covers Managed Windows Runtime Component winmds -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.WinMDFileType)' == 'Managed'">WindowsRuntime 1.4;CLR v4.0.30319</ImageRuntime>
<!-- This covers Native Windows Runtime Component winmds -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.WinMDFileType)' == 'Native'">WindowsRuntime 1.4</ImageRuntime>
<!-- This covers Native Windows Runtime Component winmds for DynamicLibrary projects -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.ProjectType)' == 'DynamicLibrary'">WindowsRuntime 1.4</ImageRuntime>
<!-- This provides an override -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' != ''">$(PrimaryProjectWinmdImageRuntimeOverride)</ImageRuntime>
</_AppxWinmdFilesToHarvest>
</ItemGroup>
</Target>
<Import Project="ImportAfter\*"/>
</Project>

52
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.Cps.targets

@ -1,52 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition=" '$(IsCodeSharingProject)' != 'true' ">
<!-- SDK references -->
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\SDKReference.xaml">
<Context>;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ResolvedSDKReference.xaml">
<Context>ProjectCapabilitySubscriptionService;BrowseObject</Context>
</PropertyPageSchema>
<ProjectCapability Include="SDKReferences" />
<!-- WinRT references -->
<!-- No need for WinRTReference.xaml because we share an item type with AssemblyReference.xaml -->
<ProjectCapability Include="WinRTReferences" />
</ItemGroup>
<ItemGroup>
<!-- Xaml item types -->
<PropertyPageSchema Include="
$(MSBuildThisFileDirectory)$(LangName)\PRIResource.xaml;
$(MSBuildThisFileDirectory)$(LangName)\ApplicationDefinition.xaml;
$(MSBuildThisFileDirectory)$(LangName)\Page.xaml;
$(MSBuildThisFileDirectory)$(LangName)\AppxManifest.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignData.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignDataWithDesignTimeCreatableTypes.xaml;
">
<Context>File;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ProjectItemsSchema.xaml"/>
</ItemGroup>
<ItemDefinitionGroup Condition=" '$(DefineExplicitDefaults)' == 'true' ">
<PRIResource>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</PRIResource>
<AppxManifest>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AppxManifest>
<Page>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Page>
<ApplicationDefinition>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</ApplicationDefinition>
<DesignData>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignData>
<DesignDataWithDesignTimeCreatableTypes>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignDataWithDesignTimeCreatableTypes>
</ItemDefinitionGroup>
</Project>

73
eng/msbuild/uwp/8.2/Microsoft.Windows.UI.Xaml.VisualBasic.targets

@ -1,73 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.VisualBasic.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.2</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'UAP'">
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(SDKIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">
<SDKIdentifier>Windows</SDKIdentifier>
<SDKVersion>10.0</SDKVersion>
</PropertyGroup>
<PropertyGroup>
<UWPNugetRepo Condition="'$(UWPNugetRepo)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</UWPNugetRepo>
<RestoreAdditionalProjectFallbackFolders>$(RestoreAdditionalProjectFallbackFolders);$(UWPNugetRepo)</RestoreAdditionalProjectFallbackFolders>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
<ExplicitResetWarningSuppression>true</ExplicitResetWarningSuppression>
<MyType Condition="'$(MyType)' == ''">Empty</MyType>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\VisualBasic.ProjectItemsSchema.xaml"/>
</ItemGroup>
<Target
Name="_VBDesignTimePdbFile"
BeforeTargets="CoreCompile"
Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(BuildingProject)' == 'false'">
<PropertyGroup>
<PdbFile>$(IntermediateOutputPath)$(TargetName).pdb</PdbFile>
</PropertyGroup>
</Target>
</Project>

204
eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.CPP.targets

@ -1,204 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Cpp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BeforeClCompileTargets>
MarkupCompilePass1;
$(BeforeClCompileTargets)
</BeforeClCompileTargets>
<ComputeCompileInputsTargets>
ComputeXamlGeneratedCompileInputs;
$(ComputeCompileInputsTargets)
</ComputeCompileInputsTargets>
</PropertyGroup>
<Choose>
<When Condition="'$(ConfigurationType)'=='StaticLibrary'">
<PropertyGroup>
<AfterClCompileTargets>
$(ComputeLinkInputsTargets);
CreateWinMD;
ComputeGeneratedWinMD;
MarkupCompilePass2;
ComputeInvalidXamlGenerated;
CompileXamlGeneratedFiles;
$(AfterClCompileTargets)
</AfterClCompileTargets>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<AfterBuildCompileTargets>
$(ComputeLinkInputsTargets);
CreateWinMD;
ComputeGeneratedWinMD;
MarkupCompilePass2;
ComputeInvalidXamlGenerated;
CompileXamlGeneratedFiles;
$(AfterBuildCompileTargets)
</AfterBuildCompileTargets>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<XamlPreLinkDependsOn>
$(XamlPreLinkDependsOn);
ComputeXamlGeneratedCLOutputs
</XamlPreLinkDependsOn>
<XamlPreLibDependsOn>
$(XamlPreLibDependsOn);
ComputeXamlGeneratedCLOutputs
</XamlPreLibDependsOn>
<GenerateProjectionAssembly>True</GenerateProjectionAssembly>
<OnlyCreateWinMD>true</OnlyCreateWinMD>
<ImplicitlyExpandTargetPlatform>false</ImplicitlyExpandTargetPlatform>
</PropertyGroup>
<PropertyGroup>
<ValidatePresenceOfAppxManifestItemsDependsOn>
$(ValidatePresenceOfAppxManifestItemsDependsOn);
_CreateContentItemOutOfCustomAppxManifest
</ValidatePresenceOfAppxManifestItemsDependsOn>
</PropertyGroup>
<ItemGroup>
<PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\Xaml.xml" />
</ItemGroup>
<!-- This is a proxy target that holds stuff that runs before the final Link -->
<Target Name="XamlPreLink" BeforeTargets="Link" DependsOnTargets="$(XamlPreLinkDependsOn)" />
<!-- This is a proxy target that holds stuff that runs before the final Link -->
<Target Name="XamlPreLib" BeforeTargets="Lib" DependsOnTargets="$(XamlPreLibDependsOn)" />
<Target Name="ComputeGeneratedWinMD" >
<PropertyGroup>
<LocalAssembly Condition="'$(LocalAssembly)' == '' and '%(Link.WindowsMetadataFile)' != ''">%(Link.WindowsMetadataFile)</LocalAssembly>
</PropertyGroup>
</Target>
<!-- Change AppxManifest.xml override item to be of Content type. -->
<Target Name="_CreateContentItemOutOfCustomAppxManifest">
<ItemGroup>
<Content Include="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
<Xml Remove="@(Xml)" Condition="'%(Identity)' == 'AppxManifest.xml'" />
</ItemGroup>
</Target>
<PropertyGroup>
<GeneratedFilesDir Condition=" '$(GeneratedFilesDir)' == ''">Generated Files\</GeneratedFilesDir>
<XamlGeneratedOutputPath>$(GeneratedFilesDir)</XamlGeneratedOutputPath>
<ExtensionsToDeleteOnClean>$(ExtensionsToDeleteOnClean);*.g.h;*.g.cpp;*.xaml</ExtensionsToDeleteOnClean>
</PropertyGroup>
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\Cpp.ProjectItemsSchema.xaml"/>
</ItemGroup>
<!-- Generated files output group population -->
<PropertyGroup>
<GeneratedFilesOutputGroupDependsOn>XamlGeneratedFilesOutputGroup;$(GeneratedFilesOutputGroupDependsOn)</GeneratedFilesOutputGroupDependsOn>
</PropertyGroup>
<Target Name="XamlGeneratedFilesOutputGroup"
DependsOnTargets="$(XamlGeneratedFilesOutputGroupDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(Page.ExcludedFromBuild)'!='true'" Include="@(Page->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.h')" />
<GeneratedFilesOutputGroup Condition="'%(ApplicationDefinition.ExcludedFromBuild)'!='true'" Include="@(ApplicationDefinition->'$(XamlGeneratedOutputPath)%(Filename).g.cpp')" />
</ItemGroup>
</Target>
<Target Name="ComputeXamlGeneratedCompileInputs"
DependsOnTargets="$(ComputeXamlGeneratedCompileInputsDependsOn)"
Condition="'@(Page)@(ApplicationDefinition)' != ''">
<ItemGroup>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.g.cpp" >
<CompilerIteration>XamlGenerated</CompilerIteration>
</ClCompile>
<ClCompile Include="$(XamlGeneratedOutputPath)XamlTypeInfo.Impl.g.cpp" />
<ClCompile Condition="'$(OutputType)' == 'Library'" Include="$(XamlGeneratedOutputPath)XamlLibMetadataProvider.g.cpp" />
</ItemGroup>
<!-- The build only wants to generate winmd once, either during Link target or Createwinmd target, not both.
Link and Createwinmd targets will execute link.exe, so it is best to run link.exe only once.
However, there are two cases where that isn't possible.
1) when build is building XAML and
2) when building in passes. -->
<PropertyGroup>
<GenerateBuildCompilePassWinMD Condition="'$(GenerateBuildCompilePassWinMD)' == ''">true</GenerateBuildCompilePassWinMD>
</PropertyGroup>
</Target>
<Target Name="ComputeInvalidXamlGenerated" >
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!-- Add CL generates .obj files to Obj item group, it will be used by lib or link -->
<Target Name="ComputeXamlGeneratedCLOutputs"
DependsOnTargets="ComputeXamlGeneratedCompileInputs;ComputeInvalidXamlGenerated"
Condition="'@(ClCompile)' != ''">
<ItemGroup>
<!-- Some files dont exists because XAML files do not always generate .g.cpp -->
<ClCompile Remove="@(ClCompile)" Condition="'%(ClCompile.CompilerIteration)' == 'XamlGenerated' and !Exists('%(Identity)')"/>
<!-- No object file name defined: filename.obj -->
<Obj Condition="'%(ClCompile.ObjectFileName)'=='' and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(Filename).obj')" />
<!-- Object file name is a directory (has trailing slash): ofn\filename.obj -->
<Obj Condition="HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)%(Filename).obj')" />
<!-- Object file name is a file (does not has trailing slash): ofn -->
<Obj Condition="'%(ClCompile.ObjectFileName)' != '' and !HasTrailingSlash('%(ClCompile.ObjectFileName)') and '%(ClCompile.ExcludedFromBuild)'!='true'" Include="@(ClCompile->'%(ObjectFileName)')" />
<Lib Include="@(Obj->WithMetadataValue('CompilerIteration', 'XamlGenerated')->ClearMetadata())" />
<Link Include="@(Obj->WithMetadataValue('CompilerIteration', 'XamlGenerated')->ClearMetadata())" />
</ItemGroup>
</Target>
<!-- Enable design time build as well as selected file(s) compile support -->
<PropertyGroup>
<EnableDesignTimeBuild>true</EnableDesignTimeBuild>
</PropertyGroup>
<ItemDefinitionGroup>
<Page>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</Page>
<ApplicationDefinition>
<GeneratorTarget>DesignTimeMarkupCompilation</GeneratorTarget>
</ApplicationDefinition>
</ItemDefinitionGroup>
<PropertyGroup>
<MarkupCompilePass1DependsOn>CppDesignTimeMarkupCompilation;$(MarkupCompilePass1DependsOn)</MarkupCompilePass1DependsOn>
</PropertyGroup>
<Target Name="CppDesignTimeMarkupCompilation"
DependsOnTargets="_SelectedFiles;SelectCustomBuild;ResolveReferences">
<!-- Ideally we'd like to be able to build just the requested files (if it makes sense). -->
<!--<ItemGroup Condition="'@(SelectedFiles)'!=''">
<Page Remove="@(Page)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
<ApplicationDefinition Remove="@(ApplicationDefinition)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
</ItemGroup>-->
</Target>
</Project>

61
eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.CSharp.targets

@ -1,61 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.CSharp.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.2</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'UAP'">
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(SDKIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">
<SDKIdentifier>Windows</SDKIdentifier>
<SDKVersion>10.0</SDKVersion>
</PropertyGroup>
<PropertyGroup>
<UWPNugetRepo Condition="'$(UWPNugetRepo)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</UWPNugetRepo>
<RestoreAdditionalProjectFallbackFolders>$(RestoreAdditionalProjectFallbackFolders);$(UWPNugetRepo)</RestoreAdditionalProjectFallbackFolders>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<!-- Supress the warnings in the 1st pass so that warnings are not repeated twice -->
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\CSharp.ProjectItemsSchema.xaml"/>
</ItemGroup>
</Project>

142
eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.Common.targets

@ -1,142 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.Common.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="ImportBefore\*"/>
<PropertyGroup>
<AvailablePlatforms>$(AvailablePlatforms),ARM64</AvailablePlatforms>
</PropertyGroup>
<!-- Need the path to vcmeta.dll -->
<PropertyGroup>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSWinExpress\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VSWinExpress\15.0\Setup\VC@ProductDir)</VCInstallDir>
<VCInstallDir Condition="'$(VCInstallDir)' == ''">$(VsInstallRoot)\Common7\IDE\VC\</VCInstallDir>
<WindowsKitsPath Condition="'$(WindowsKitsPath)' == '' and '$(TargetPlatformSdkRootOverride)' != ''">$(TargetPlatformSdkRootOverride)\</WindowsKitsPath>
<WindowsKitsPath Condition="'$(WindowsKitsPath)'==''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot10', null, RegistryView.Registry32, RegistryView.Default))</WindowsKitsPath>
<!--
if (TPV > RS2(10.0.15063.0) && TPMinV > TH2(10.0.10587.0)), use TPV XAML Compiler
else, use TPMinV XAML Compiler
-->
<WindowsKitsXamlCompilerTargetsPath Condition="'$(TargetPlatformVersion)' &gt; '10.0.15064.0' AND '$(TargetPlatformMinVersion)' &gt; '10.0.14392.0'">$(WindowsKitsPath)bin\$(TargetPlatformVersion)\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets</WindowsKitsXamlCompilerTargetsPath>
<WindowsKitsXamlCompilerTargetsPath Condition="'$(WindowsKitsXamlCompilerTargetsPath)' == ''">$(WindowsKitsPath)bin\$(TargetPlatformMinVersion)\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets</WindowsKitsXamlCompilerTargetsPath>
</PropertyGroup>
<!-- Import the targets SDK -->
<Import Condition="Exists($(WindowsKitsXamlCompilerTargetsPath)) AND ('$(IsWinUIAlpha)' != 'true') AND ('$(DefaultXamlRuntime)' != 'WinUI')" Project="$(WindowsKitsXamlCompilerTargetsPath)"/>
<!--
Ensure that UAP headless applications' WINMDs are resolved so that GenerateAppxManifest has the required
metadata to generate activatableClass extensions. This should only execute for non-EXE projects that have
<ContainsStartupTask>true</ContainsStartupTask> and create APPX packages.
-->
<Target Name="_ResolvePrimaryProjectWinmdFiles"
BeforeTargets="BeforeGenerateAppxManifest"
AfterTargets="_GetPackagingOutputs"
Condition="'$(OutputType)' != 'exe' and '$(AppxPackage)' == 'true' AND '$(ContainsStartupTask)' == 'true'">
<ItemGroup>
<_AppxWinmdFilesToHarvest Include="@(PackagingOutputs)"
Condition="'%(PackagingOutputs.Extension)' == '.winmd'
and '%(PackagingOutputs.ProjectName)' == '$(ProjectName)'
and '%(PackagingOutputs.ResolvedFrom)' != 'GetSDKReferenceFiles'">
<!-- This covers the Managed Background Application winmd which does NOT have a WinMDFileType value set -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''">WindowsRuntime 1.4;CLR v4.0.30319</ImageRuntime>
<!-- This covers the C++ Background Application winmd which does NOT have a WinMDFileType value set -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '@(Language)' == 'C++'">WindowsRuntime 1.4</ImageRuntime>
<!-- This covers Managed Windows Runtime Component winmds -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.WinMDFileType)' == 'Managed'">WindowsRuntime 1.4;CLR v4.0.30319</ImageRuntime>
<!-- This covers Native Windows Runtime Component winmds -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.WinMDFileType)' == 'Native'">WindowsRuntime 1.4</ImageRuntime>
<!-- This covers Native Windows Runtime Component winmds for DynamicLibrary projects -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' == ''
and '%(PackagingOutputs.ProjectType)' == 'DynamicLibrary'">WindowsRuntime 1.4</ImageRuntime>
<!-- This provides an override -->
<ImageRuntime Condition="'$(PrimaryProjectWinmdImageRuntimeOverride)' != ''">$(PrimaryProjectWinmdImageRuntimeOverride)</ImageRuntime>
</_AppxWinmdFilesToHarvest>
</ItemGroup>
</Target>
<PropertyGroup>
<AddProcessedXamlFilesToCopyLocalDependsOn>
ContentFilesProjectOutputGroup;
Prep_ComputeProcessXamlFiles;
$(AddProcessedXamlFilesToCopyLocalDependsOn)
</AddProcessedXamlFilesToCopyLocalDependsOn>
<AddProcessedXamlFilesToCopyLocalDependsOn Condition="'$(WindowsAppContainer)' == 'true'">
_CalculateXbfSupport;
$(AddProcessedXamlFilesToCopyLocalDependsOn)
</AddProcessedXamlFilesToCopyLocalDependsOn>
</PropertyGroup>
<Target Name="AddProcessedXamlFilesToCopyLocal" Condition="'$(AppxPackage)' != 'true'" DependsOnTargets="$(AddProcessedXamlFilesToCopyLocalDependsOn)" BeforeTargets="GetCopyToOutputDirectoryItems">
<ItemGroup>
<_ProcessedXamlFilesToCopyLocal Include="@(GeneratedXamlSrc->'%(FullPath)')" />
<_ProcessedXamlFilesToCopyLocal Condition="'$(GenerateLibraryLayout)' == 'true' and '$(DisableXbfGeneration)' != 'true'" Include="@(GeneratedXamlSrc0->'%(FullPath)')" />
</ItemGroup>
<AssignTargetPath Files="@(_ProcessedXamlFilesToCopyLocal)" RootFolder="$(XamlGeneratedOutputPath)">
<Output TaskParameter="AssignedFiles" ItemName="_ProcessedXamlFilesToCopyLocalWithTargetPath" />
</AssignTargetPath>
<ItemGroup>
<_AllChildProjectItemsWithTargetPath Include="@(_ProcessedXamlFilesToCopyLocalWithTargetPath)" Condition="'%(Extension)' != '.xbf' OR ('%(Extension)' == '.xbf' AND '$(_SupportXbfAsEmbedFileResources)' != 'true')">
<TargetPath Condition="'$(AppxPriInitialPath)' != ''">$(AppxPriInitialPath)\%(_ProcessedXamlFilesToCopyLocalWithTargetPath.TargetPath)</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</_AllChildProjectItemsWithTargetPath>
</ItemGroup>
<ItemGroup>
<_AllChildProjectItemsWithTargetPath Include="@(ContentFilesProjectOutputGroupOutput)">
<TargetPath Condition="'$(AppxPriInitialPath)' != ''">$(AppxPriInitialPath)\%(ContentFilesProjectOutputGroupOutput.TargetPath)</TargetPath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</_AllChildProjectItemsWithTargetPath>
</ItemGroup>
<Message Importance="Low" Text="(Out) _ProcessedXamlFilesToCopyLocal == @(_ProcessedXamlFilesToCopyLocal)" />
<Message Importance="Low" Text="(Out) _XamlFilesToCopyLocal == @(_XamlFilesToCopyLocal)" />
</Target>
<!--
This builds the Bin Folder for DLL's that wish to have the SDK type layout
This needs to be imported after the Microsoft.Windows.UI.Xaml.Common.targets project as we are overriding it there due to a bug in the DestinationFiles using $(OutputPath) instead of $(OutDir)
-->
<Target Name="PrepareLibraryLayout"
Condition="'$(GenerateLibraryLayout)' == 'true'"
DependsOnTargets="GetPackagingOutputs"
BeforeTargets="CopyFilesToOutputDirectory">
<ItemGroup>
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'ContentFilesProjectOutputGroup'" />
<_LayoutFile Include="@(PackagingOutputs)" Condition="'%(OutputGroup)' == 'CustomOutputGroupForPackaging'" />
</ItemGroup>
<Copy SourceFiles="@(_LayoutFile)"
DestinationFiles="@(_LayoutFile->'$(OutDir)\%(TargetPath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)" />
</Target>
<Import Project="ImportAfter\*"/>
</Project>

52
eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.Cps.targets

@ -1,52 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition=" '$(IsCodeSharingProject)' != 'true' ">
<!-- SDK references -->
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\SDKReference.xaml">
<Context>;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ResolvedSDKReference.xaml">
<Context>ProjectCapabilitySubscriptionService;BrowseObject</Context>
</PropertyPageSchema>
<ProjectCapability Include="SDKReferences" />
<!-- WinRT references -->
<!-- No need for WinRTReference.xaml because we share an item type with AssemblyReference.xaml -->
<ProjectCapability Include="WinRTReferences" />
</ItemGroup>
<ItemGroup>
<!-- Xaml item types -->
<PropertyPageSchema Include="
$(MSBuildThisFileDirectory)$(LangName)\PRIResource.xaml;
$(MSBuildThisFileDirectory)$(LangName)\ApplicationDefinition.xaml;
$(MSBuildThisFileDirectory)$(LangName)\Page.xaml;
$(MSBuildThisFileDirectory)$(LangName)\AppxManifest.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignData.xaml;
$(MSBuildThisFileDirectory)$(LangName)\DesignDataWithDesignTimeCreatableTypes.xaml;
">
<Context>File;BrowseObject</Context>
</PropertyPageSchema>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\ProjectItemsSchema.xaml"/>
</ItemGroup>
<ItemDefinitionGroup Condition=" '$(DefineExplicitDefaults)' == 'true' ">
<PRIResource>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</PRIResource>
<AppxManifest>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AppxManifest>
<Page>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Page>
<ApplicationDefinition>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</ApplicationDefinition>
<DesignData>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignData>
<DesignDataWithDesignTimeCreatableTypes>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</DesignDataWithDesignTimeCreatableTypes>
</ItemDefinitionGroup>
</Project>

73
eng/msbuild/uwp/8.21/Microsoft.Windows.UI.Xaml.VisualBasic.targets

@ -1,73 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Windows.UI.Xaml.VisualBasic.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) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'WindowsPhoneApp' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.1</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">WindowsPhoneApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v8.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'windows' OR '$(TargetPlatformIdentifier)' == '' ">
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">8.2</TargetPlatformVersion>
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == 'UAP'">
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v5.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(SDKIdentifier)' == '' and '$(TargetPlatformIdentifier)' == 'UAP'">
<SDKIdentifier>Windows</SDKIdentifier>
<SDKVersion>10.0</SDKVersion>
</PropertyGroup>
<PropertyGroup>
<UWPNugetRepo Condition="'$(UWPNugetRepo)' == ''">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\NuGet\Repository', 'UWPNugetPackages', null, RegistryView.Registry32, RegistryView.Default))</UWPNugetRepo>
<RestoreAdditionalProjectFallbackFolders>$(RestoreAdditionalProjectFallbackFolders);$(UWPNugetRepo)</RestoreAdditionalProjectFallbackFolders>
</PropertyGroup>
<PropertyGroup>
<ImplicitlyExpandTargetPlatform Condition="'$(ImplicitlyExpandTargetPlatform)' == '' ">true</ImplicitlyExpandTargetPlatform>
<ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
<NoStdLib Condition="'$(NoStdLib)' == ''">true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<WindowsAppContainer>true</WindowsAppContainer>
<AppxPackage Condition="'$(OutputType)' == 'AppContainerExe'">True</AppxPackage>
<SuppressWarningsInPass1 Condition="'$(SuppressWarningsInPass1)' == '' ">true</SuppressWarningsInPass1>
<ExplicitResetWarningSuppression>true</ExplicitResetWarningSuppression>
<MyType Condition="'$(MyType)' == ''">Empty</MyType>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets" />
<Import Project="Microsoft.Windows.UI.Xaml.Cps.targets" />
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangName)\VisualBasic.ProjectItemsSchema.xaml"/>
</ItemGroup>
<Target
Name="_VBDesignTimePdbFile"
BeforeTargets="CoreCompile"
Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(BuildingProject)' == 'false'">
<PropertyGroup>
<PdbFile>$(IntermediateOutputPath)$(TargetName).pdb</PdbFile>
</PropertyGroup>
</Target>
</Project>

38
eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.CPP.targets

@ -1,38 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsCppProject>True</IsCppProject>
</PropertyGroup>
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets"/>
<Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.Cpp.targets" Condition="Exists('$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.Cpp.targets')" />
<PropertyGroup Condition="'$(DesignTimeBuild)' != 'true'">
<MarkupCompilePass1DependsOn>$(MarkupCompilePass1DependsOn);_WriteXamlTlogs</MarkupCompilePass1DependsOn>
</PropertyGroup>
<Target Name="_WriteXamlTlogs"
Condition="'@(SelectedFiles)' == ''">
<ItemGroup Condition="'@(Page)' != ''">
<_XamlReadTlog Include="^%(Page.FullPath)"
Condition="'%(Page.ExcludedFromBuild)' != 'true'"/>
</ItemGroup>
<ItemGroup Condition="'@(ApplicationDefinition)' != ''">
<_XamlReadTlog Include="^%(ApplicationDefinition.FullPath)"
Condition="'%(ApplicationDefinition.ExcludedFromBuild)' != 'true'"/>
</ItemGroup>
<WriteLinesToFile
Condition="'@(_XamlReadTlog)' != ''"
File="$(TLogLocation)Xaml.read.1u.tlog"
Lines="@(_XamlReadTlog->MetaData('Identity')->ToUpperInvariant());"
Overwrite="true"
Encoding="Unicode"/>
<Delete Condition="'@(_XamlReadTlog)' == '' and Exists('$(TLogLocation)Xaml.read.1u.tlog')"
Files="$(TLogLocation)Xaml.read.1u.tlog" />
<ItemGroup>
<_XamlReadTlog Remove="@(_XamlReadTlog)" />
</ItemGroup>
</Target>
</Project>

5
eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.CSharp.targets

@ -1,5 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets"/>
<Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="Exists('$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets')"/>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition="!Exists('$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets')"/>
</Project>

49
eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.Common.targets

@ -1,49 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(TargetPlatformVersion)'==''">
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP' And '$(TargetPlatformMinVersion)' != '' And '$(TargetPlatformMinVersion)' &gt; '10.0.10587.0'">
<RedirectionTarget>8.21</RedirectionTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP' And '$(RedirectionTarget)' == ''">
<RedirectionTarget>8.2</RedirectionTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(RedirectionTarget)' == ''">
<RedirectionTarget>$(TargetPlatformVersion)</RedirectionTarget>
</PropertyGroup>
<!-- Direct 8.0 projects to 8.1 targets to enable retargeting -->
<PropertyGroup Condition="'$(RedirectionTarget)' == '8.0'">
<RedirectionTarget>8.1</RedirectionTarget>
</PropertyGroup>
<!-- UnitTest SDKs always match VS Versions -->
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP' And '$(UnitTestPlatformVersion)' != ''">
<UnitTestPlatformVersion>$(VisualStudioVersion)</UnitTestPlatformVersion>
</PropertyGroup>
<!-- User Sets this property in csproj -->
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP' And '$(UnitTestPlatformVersion)' == '17.0'">
<!-- Needed to drop PDB's inside Appx -->
<AppxPackageIncludePrivateSymbols Condition="'$(AppxPackageIncludePrivateSymbols)' == ''">true</AppxPackageIncludePrivateSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(UwpUnitTestSdkPkgVersion)' == ''">
<UwpUnitTestSdkPkgVersion>16.11.0</UwpUnitTestSdkPkgVersion>
</PropertyGroup>
<!-- Tpv2 needs following packages at runtime -->
<Choose>
<When Condition="'$(TargetPlatformIdentifier)' == 'UAP' And '$(UnitTestPlatformVersion)' == '17.0' And '$(RestoreProjectStyle)' == 'PackageReference' And '$(IsCppProject)' != 'True' ">
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" IsImplicitlyDefined="true">
<Version>$(UwpUnitTestSdkPkgVersion)</Version>
</PackageReference>
</ItemGroup>
</When>
</Choose>
</Project>

5
eng/msbuild/uwp/Microsoft.Windows.UI.Xaml.VisualBasic.targets

@ -1,5 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.Windows.UI.Xaml.Common.targets"/>
<Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.VisualBasic.targets" Condition="Exists('$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.VisualBasic.targets')"/>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" Condition="!Exists('$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.VisualBasic.targets')"/>
</Project>

181
eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.AllFilesInProjectFolder.targets

@ -1,181 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.AllFilesInProjectFolder.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for collecting all files in the project folder.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="CollectFilesinFolder" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="EscapeTextForRegularExpressions" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInProjectFolderTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInProjectFolderTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInProjectFolderTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInProjectFolderTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<PropertyGroup>
<PublishPipelineCollectFilesCore>
$(PublishPipelineCollectFilesCore);
CollectFilesFromProjectFolder;
</PublishPipelineCollectFilesCore>
<_CollectFiles_IncludeIgnorableFile Condition="'$(_CollectFiles_IncludeIgnorableFile)'==''">False</_CollectFiles_IncludeIgnorableFile>
<!--Overwrite the default behavior. Don't remove the web.debug.config -->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">False</ExcludeTransformAssistFilesFromPublish>
<CollectFilesFromProjectFolder_ExcludeSccFiles Condition="'$(CollectFilesFromProjectFolder_ExcludeSccFiles)'==''">True</CollectFilesFromProjectFolder_ExcludeSccFiles>
</PropertyGroup>
<!--********************************************************************-->
<!-- Task SetExcludeFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<SetExcludeFromProjectFolderDependsOn Condition="'$(SetExcludeFromProjectFolderDependsOn)'==''">
</SetExcludeFromProjectFolderDependsOn>
</PropertyGroup>
<Target Name="SetExcludeFromProjectFolder"
DependsOnTargets="$(SetExcludeFromProjectFolderDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeIntermediateOutputFolderMessage"
LogType="Message" />
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeFileExtentionOutMessage"
LogType="Message" />
<GetPublishingLocalizedString
ID="PublishLocalizedString_DefaultExcludeSourceControlItems"
LogType="Message" />
<!--Maybe we need to introduce @(_ExcludeFromProjectFolder)-->
<ItemGroup>
<!--Split item to _KnowProjectItems is to keep the metadata for item collection.
Please see http://msdn.microsoft.com/en-us/library/bb629388.aspx for known Project item collection.-->
<_KnownProjectItems Include="@(EmbeddedResource)" />
<_KnownProjectItems Include="@(None)" />
<_KnownProjectItems Include="@(Content)" />
<_KnownProjectItems Include="@(Compile)" />
<!--Explicit exclude all files under the obj folder -->
<_ProjectBaseIntermediateOutputPath Include="$(BaseIntermediateOutputPath)"/>
</ItemGroup>
<!--Create the rgulare expression to exclude all root folder *.out, all folder *.scc and all folder*.vspscc file-->
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>^[^\\]*\.out$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>
<!--Create the rgulare expression to exclude all Intermedidate output path.-->
<EscapeTextForRegularExpressions Text="@(_ProjectBaseIntermediateOutputPath->'%(FullPath)')">
<Output TaskParameter="Result" PropertyName="_ExcludeFullPathFromProjectFolder" />
</EscapeTextForRegularExpressions>
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder_ExcludeSccFiles -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn>
$(OnBeforeCollectFilesFromProjectFolder_ExcludeSccFiles);
$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn);
SetExcludeFromProjectFolder;
</CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder_ExcludeSccFiles"
DependsOnTargets="$(CollectFilesFromProjectFolder_ExcludeSccFilesDependsOn)"
Condition="$(CollectFilesFromProjectFolder_ExcludeSccFiles)">
<!--Note split by semicolon (;)-->
<PropertyGroup>
<_ExcludeRelativePathFromProjectFolder>$(_ExcludeRelativePathFromProjectFolder);[^\\]*\.scc$;[^\\]*\.vssscc$;[^\\]*\.vspscc$</_ExcludeRelativePathFromProjectFolder>
</PropertyGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder_ExcludeSccFiles)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFolder -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromProjectFolderDependsOn>
$(OnBeforeCollectFilesFromProjectFolder);
$(CollectFilesFromProjectFolderDependsOn);
SetExcludeFromProjectFolder;
CollectFilesFromProjectFolder_ExcludeSccFiles;
</CollectFilesFromProjectFolderDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFolder"
DependsOnTargets="$(CollectFilesFromProjectFolderDependsOn)" >
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherAllFilesInProjectFolderExceptExclusion"
LogType="Message" />
<CollectFilesinFolder RootPath="$(WebPublishPipelineProjectDirectory)"
ExcludeFullPathMatchs="$(_ExcludeFullPathFromProjectFolder)"
ExcludeRelativePathMatchs="$(_ExcludeRelativePathFromProjectFolder)"
SkipHiddenItems="$(_SkipHiddenItems)">
<Output TaskParameter="Result" ItemName="_AllFilesUnderProjectFolderNoMetadata" />
</CollectFilesinFolder>
<!--The first two lines keeps the _KnowProjectItem's item metadata-->
<FilterByItems PipelineItems="@(_AllFilesUnderProjectFolderNoMetadata)"
Filter="@(_KnownProjectItems)">
<Output TaskParameter="OutFilter" ItemName="_AllFilesUnderProjectFolderExceptKnownProjectItems"/>
</FilterByItems>
<ItemGroup>
<!--Readd _KnowProjectItem's to keep item metadata. First for non-Link file -->
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'==''">
<DestinationRelativePath>%(_KnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_KnownProjectItems)" Condition="'%(_KnownProjectItems.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(_KnownProjectItems.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.KonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(_AllFilesUnderProjectFolderExceptKnownProjectItems)" >
<DestinationRelativePath>%(_AllFilesUnderProjectFolderExceptKnownProjectItems.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFolder.ExceptKonwnProjectItems</FromTarget>
<Category>AllFilesInProjectFolder</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFolder)" RunEachTargetSeparately="false" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingAllFilesInProjectFolderTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingAllFilesInProjectFolderTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingAllFilesInProjectFolderTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingAllFilesInProjectFolderTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

242
eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.AllFilesInTheProject.targets

@ -1,242 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.AllFilesInTheProject.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for collecting only project files .
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInTheProjectTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInTheProjectTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInTheProjectTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingAllFilesInTheProjectTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<!--The following property need to set before import of Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets or it will set the property first-->
<PropertyGroup>
<!--Overwrite the default behavior. Don't remove the web.debug.config -->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">False</ExcludeTransformAssistFilesFromPublish>
</PropertyGroup>
<!--We need all of the item in the minimum run web needed-->
<Import Project="Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets"/>
<PropertyGroup>
<PublishPipelineCollectFilesCore>
$(PublishPipelineCollectFilesCore);
CollectFilesFromCompile;
CollectFilesFromEmbeddedResource;
CollectFilesFromNone;
CollectFilesFromBaseApplicationManifest;
CollectFilesFromProjectFile;
</PublishPipelineCollectFilesCore>
</PropertyGroup>
<!--MSBuild target does not have a good way to identify all item in the project yet.
MSBuild team is working on this. At the same time, we are working backward from only known common item collection from
The following is base on http://msdn.microsoft.com/en-us/library/bb629388.aspx for common project item.
Note that Content Collection is already in the Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets-->
<!--********************************************************************-->
<!-- Task CollectFilesFromCompile -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromCompileDependsOn>
$(OnBeforeCollectFilesFromCompile);
$(CollectFilesFromCompileDependsOn);
</CollectFilesFromCompileDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromCompile"
DependsOnTargets="$(CollectFilesFromCompileDependsOn)"
Condition="'@(Compile)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="Compile"
LogType="Message" />
<Message Text="@(Compile)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(Compile)" Condition="'%(Compile.Link)'==''">
<DestinationRelativePath>%(Compile.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromCompile</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(Compile)" Condition="'%(Compile.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(Compile.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromCompile</FromTarget>
<Category>ProjectNotRunRequired</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromCompile)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromEmbeddedResource -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromEmbeddedResourceDependsOn>
$(OnBeforeCollectFilesFromEmbeddedResource);
$(CollectFilesFromEmbeddedResourceDependsOn);
</CollectFilesFromEmbeddedResourceDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromEmbeddedResource"
DependsOnTargets="$(CollectFilesFromEmbeddedResourceDependsOn)"
Condition="'@(EmbeddedResource)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="EmbeddedResource"
LogType="Message" />
<Message Text="@(EmbeddedResource)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.Link)'==''">
<DestinationRelativePath>%(EmbeddedResource.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromEmbeddedResource</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(EmbeddedResource)" Condition="'%(EmbeddedResource.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(EmbeddedResource.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromEmbeddedResource</FromTarget>
<Category>ProjectNotRunRequired</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromEmbeddedResource)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromNone -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromNoneDependsOn>
$(OnBeforeCollectFilesFromNone);
$(CollectFilesFromNoneDependsOn);
</CollectFilesFromNoneDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromNone"
DependsOnTargets="$(CollectFilesFromNoneDependsOn)"
Condition="'@(None)'!=''">
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="None"
LogType="Message" />
<Message Text="@(None)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(None)" Condition="'%(None.Link)'==''">
<DestinationRelativePath>%(None.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromNone</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(None)" Condition="'%(None.Link)'!='' And $(EnableCollectLinkFilesInProject)" >
<DestinationRelativePath>%(None.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromNone</FromTarget>
<Category>ProjectNotRunRequired</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromNone)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromBaseApplicationManifest -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromBaseApplicationManifestDependsOn>
$(OnBeforeCollectFilesFromBaseApplicationManifest);
$(CollectFilesFromBaseApplicationManifestDependsOn);
</CollectFilesFromBaseApplicationManifestDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromBaseApplicationManifest"
DependsOnTargets="$(CollectFilesFromBaseApplicationManifestDependsOn)"
Condition="'@(BaseApplicationManifest)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="BaseApplicationManifest"
LogType="Message" />
<Message Text="@(BaseApplicationManifest)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(BaseApplicationManifest)" Condition="'%(BaseApplicationManifest.Link)'==''">
<DestinationRelativePath>%(BaseApplicationManifest.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromBaseApplicationManifest</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(BaseApplicationManifest)" Condition="'%(BaseApplicationManifest.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(BaseApplicationManifest.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromBaseApplicationManifest</FromTarget>
<Category>ProjectNotRunRequired</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromBaseApplicationManifest)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromProjectFile -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromProjectFileDependsOn>
$(OnBeforeCollectFilesFromProjectFile);
$(CollectFilesFromProjectFileDependsOn);
</CollectFilesFromProjectFileDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromProjectFile"
DependsOnTargets="$(CollectFilesFromProjectFileDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="ProjectFiles"
LogType="Message" />
<Message Text="$(MSBuildProjectFile);$(MSBuildProjectFile).user" />
<ItemGroup>
<FilesForPackagingFromProject Include="$(MSBuildProjectFile)">
<DestinationRelativePath>$(MSBuildProjectFile)</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFile</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="$(MSBuildProjectFile).user" Condition="Exists('$(MSBuildProjectFile).user')">
<DestinationRelativePath>$(MSBuildProjectFile).user</DestinationRelativePath>
<FromTarget>CollectFilesFromProjectFile</FromTarget>
<Category>ProjectNotRunRequired</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromProjectFile)" RunEachTargetSeparately="false" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingAllFilesInTheProjectTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingAllFilesInTheProjectTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingAllFilesInTheProjectTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingAllFilesInTheProjectTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

445
eng/msbuild/web/Web/CollectFiles/Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets

@ -1,445 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.OnlyFilesToRunTheApp.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for collecting only files to run the web appliation.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingOnlyFilesToRunTheAppTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingOnlyFilesToRunTheAppTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingOnlyFilesToRunTheAppTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingOnlyFilesToRunTheAppTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<PropertyGroup>
<PublishPipelineCollectFilesCore>
$(PublishPipelineCollectFilesCore);
CollectFilesFromIntermediateAssembly;
CollectFilesFromContent;
CollectFilesFromAddModules;
CollectFilesFrom_SGenDllCreated;
CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath;
CollectFilesFromReference;
CollectFilesFromAllExtraReferenceFiles;
CollectFilesFrom_SourceItemsToCopyToOutputDirectory;
CollectFilesFromDocFileItem;
CollectFilesFrom_WebApplicationSilverlightXapFiles;
CollectFilesFrom_binDeployableAssemblies;
</PublishPipelineCollectFilesCore>
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">True</ExcludeTransformAssistFilesFromPublish>
</PropertyGroup>
<!--***************************************************************-->
<!-- Task CollectFilesFromIntermediateAssembly -->
<!-- Note $(OutDir) can be not in the bin like in Team build system -->
<!--***************************************************************-->
<PropertyGroup>
<CollectFilesFromIntermediateAssemblyDependsOn>
$(OnBeforeCollectFilesFromIntermediateAssembly);
$(CollectFilesFromIntermediateAssemblyDependsOn);
</CollectFilesFromIntermediateAssemblyDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromIntermediateAssembly"
DependsOnTargets="$(CollectFilesFromIntermediateAssemblyDependsOn)"
Condition="'@(IntermediateAssembly)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="IntermediateAssembly"
LogType="Message" />
<Message Text="@(IntermediateAssembly->'$(OutDir)%(FileName)%(Extension) to bin\%(FileName)%(Extension)')" />
<ItemGroup>
<FilesForPackagingFromProject
Include="@(IntermediateAssembly->'$(OutDir)%(FileName)%(Extension)')">
<DestinationRelativePath>bin\%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromIntermediateAssembly</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<Message Text="@(IntermediateAssembly->'$(OutDir)%(FileName).pdb to bin\%(FileName).pdb')"
Condition="$(_DebugSymbolsProduced) AND !$(ExcludeGeneratedDebugSymbol) AND Exists(@(IntermediateAssembly->'$(OutDir)%(FileName).pdb')) "/>
<ItemGroup Condition="$(_DebugSymbolsProduced) AND !$(ExcludeGeneratedDebugSymbol) AND Exists(@(IntermediateAssembly->'$(OutDir)%(FileName).pdb'))">
<FilesForPackagingFromProject
Include="@(IntermediateAssembly->'$(OutDir)%(FileName).pdb')"
Condition="Exists(@(IntermediateAssembly->'$(OutDir)%(FileName).pdb'))">
<DestinationRelativePath>bin\%(FileName).pdb</DestinationRelativePath>
<FromTarget>CollectFilesFromIntermediateAssembly</FromTarget>
<Category>Debug</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromIntermediateAssembly)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromContent -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromContentDependsOn>
$(OnBeforeCollectFilesFromContent);
$(CollectFilesFromContentDependsOn);
</CollectFilesFromContentDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromContent"
DependsOnTargets="$(CollectFilesFromContentDependsOn)"
Condition="'@(Content)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="Content"
LogType="Message" />
<Message Text="@(Content)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(Content)" Condition="'%(Content.Link)'==''">
<DestinationRelativePath>%(Content.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFromContent</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="@(Content)" Condition="'%(Content.Link)'!='' And $(EnableCollectLinkFilesInProject)">
<DestinationRelativePath>%(Content.Link)</DestinationRelativePath>
<FromTarget>CollectFilesFromContent</FromTarget>
<Category>Run</Category>
<Exclude>$(ExcludeLinkFilesInProject)</Exclude>
<ProjectFileType>Link</ProjectFileType>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromContent)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromAddModules -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromAddModulesDependsOn>
$(OnBeforeCollectFilesFromAddModulesDependsOn);
$(CollectFilesFromAddModulesDependsOn);
</CollectFilesFromAddModulesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromAddModules"
DependsOnTargets="$(CollectFilesFromAddModulesDependsOn)"
Condition="'@(AddModules)'!=''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificOutputsFromProject"
ArgumentCount="1"
Arguments="AddModules"
LogType="Message" />
<Message Text="@(AddModules->'$(OutDir)%(FileName)%(Extension) to bin\%(FileName)%(Extension)')"/>
<ItemGroup>
<FilesForPackagingFromProject Include="@(AddModules->'$(OutDir)%(FileName)%(Extension)')">
<DestinationRelativePath>bin\%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromAddModules</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromAddModulesDependsOn)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFrom_SGenDllCreated -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFrom_SGenDllCreatedDependsOn>
$(OnBeforeCollectFilesFrom_SGenDllCreated);
$(CollectFilesFrom_SGenDllCreatedDependsOn);
</CollectFilesFrom_SGenDllCreatedDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFrom_SGenDllCreated"
DependsOnTargets="$(CollectFilesFrom_SGenDllCreatedDependsOn)"
Condition="$(_SGenDllCreated)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificOutputsFromProject"
ArgumentCount="1"
Arguments="_SGenDllName"
LogType="Message" />
<Message Text="bin\$(_SGenDllName)" />
<ItemGroup>
<FilesForPackagingFromProject Include="$(OutDir)$(_SGenDllName)">
<DestinationRelativePath>bin\$(_SGenDllName)</DestinationRelativePath>
<FromTarget>CollectFilesFrom_SGenDllCreated</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFrom_SGenDllCreated)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromIntermediateSatelliteAssembliesWithTargetPathDependsOn>
$(OnBeforeCollectFilesFromIntermediateSatelliteAssembliesWithTargetPath);
$(CollectFilesFromIntermediateSatelliteAssembliesWithTargetPathDependsOn);
</CollectFilesFromIntermediateSatelliteAssembliesWithTargetPathDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath"
DependsOnTargets="$(CollectFilesFromIntermediateSatelliteAssembliesWithTargetPathDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificOutputsFromProject"
ArgumentCount="1"
Arguments="IntermediateSatelliteAssembliesWithTargetPath"
LogType="Message" />
<Message Text="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(TargetPath) to bin\%(TargetPath)')"
Condition="Exists('$(OutDir)\%(TargetPath)')"/>
<ItemGroup>
<FilesForPackagingFromProject
Include="@(IntermediateSatelliteAssembliesWithTargetPath->'$(OutDir)%(TargetPath)')">
<DestinationRelativePath>bin\%(IntermediateSatelliteAssembliesWithTargetPath.TargetPath)</DestinationRelativePath>
<FromTarget>CollectFilesFromIntermediateSatelliteAssembliesWithTargetPath</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromIntermediateSatelliteAssembliesWithTargetPath)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromReference -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromReferenceDependsOn>
$(OnBeforeCollectFilesFromReference);
$(CollectFilesFromReferenceDependsOn);
ResolveProjectReferences;
ResolveAssemblyReferences;
</CollectFilesFromReferenceDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromReference"
DependsOnTargets="$(CollectFilesFromReferenceDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProjectNoDetail"
ArgumentCount="1"
Arguments="ReferenceCopyLocalPaths,ReferenceComWrappersToCopyLocal,ResolvedIsolatedComModules,_DeploymentLooseManifestFile,NativeReferenceFile"
LogType="Message" />
<ItemGroup>
<FilesForPackagingFromProject
Include="@(ReferenceCopyLocalPaths)">
<DestinationRelativePath>bin\%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromReference</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<ItemGroup>
<FilesForPackagingFromProject
Include="@(ReferenceComWrappersToCopyLocal);
@(ResolvedIsolatedComModules);
@(_DeploymentLooseManifestFile);
@(NativeReferenceFile)">
<DestinationRelativePath>bin\%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromReference</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromReference)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromAllExtraReferenceFiles -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromAllExtraReferenceFilesDependsOn>
$(OnBeforeCollectFilesFromAllExtraReferenceFiles);
$(CollectFilesFromAllExtraReferenceFilesDependsOn);
</CollectFilesFromAllExtraReferenceFilesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromAllExtraReferenceFiles"
DependsOnTargets="$(CollectFilesFromAllExtraReferenceFilesDependsOn)">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="AllExtraReferenceFiles"
LogType="Message" />
<Message Text="@(AllExtraReferenceFiles->'$(OutDir)%(FileName)%(Extension)')" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(AllExtraReferenceFiles->'$(OutDir)%(FileName)%(Extension)')">
<DestinationRelativePath>bin\%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromAllExtraReferenceFiles</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromAllExtraReferenceFiles)" RunEachTargetSeparately="false"/>
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFrom_SourceItemsToCopyToOutputDirectory -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFrom_SourceItemsToCopyToOutputDirectoryDependsOn>
$(OnBeforeCollectFilesFrom_SourceItemsToCopyToOutputDirectory);
$(CollectFilesFrom_SourceItemsToCopyToOutputDirectoryDependsOn);
</CollectFilesFrom_SourceItemsToCopyToOutputDirectoryDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFrom_SourceItemsToCopyToOutputDirectory"
DependsOnTargets="$(CollectFilesFrom_SourceItemsToCopyToOutputDirectoryDependsOn)"
Condition="'@(_SourceItemsToCopyToOutputDirectoryAlways)' != '' or '@(_SourceItemsToCopyToOutputDirectory)' != ''">
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="_SourceItemsToCopyToOutputDirectoryAlways,_SourceItemsToCopyToOutputDirectory"
LogType="Message" />
<ItemGroup>
<_TempSourceItemsToCopyToOutputDirectory Include="@(_SourceItemsToCopyToOutputDirectoryAlways); @(_SourceItemsToCopyToOutputDirectory)" />
</ItemGroup>
<Message Text="@(_TempSourceItemsToCopyToOutputDirectory->'bin\%(TargetPath)')" />
<ItemGroup>
<FilesForPackagingFromProject
Include="@(_TempSourceItemsToCopyToOutputDirectory)">
<DestinationRelativePath>bin\%(_TempSourceItemsToCopyToOutputDirectory.TargetPath)</DestinationRelativePath>
<FromTarget>CollectFilesFrom_SourceItemsToCopyToOutputDirectory</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFrom_SourceItemsToCopyToOutputDirectory)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFromDocFileItem -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFromDocFileItemDependsOn>
$(OnBeforeCollectFilesFromDocFileItem);
$(CollectFilesFromDocFileItemDependsOn);
</CollectFilesFromDocFileItemDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFromDocFileItem"
DependsOnTargets="$(CollectFilesFromDocFileItemDependsOn)"
Condition="$(_DocumentationFileProduced)" >
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="DocFileItem"
LogType="Message" />
<Message Text="@(DocFileItem->'bin\%(FileName)%(Extension)')" />
<ItemGroup>
<FilesForPackagingFromProject
Include="@(DocFileItem)">
<DestinationRelativePath>bin\%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFromDocFileItem</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFromDocFileItem)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFrom_WebApplicationSilverlightXapFiles -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFrom_WebApplicationSilverlightXapFilesDependsOn>
$(OnBeforeCollectFilesFrom_WebApplicationSilverlightXapFiles);
$(CollectFilesFrom_WebApplicationSilverlightXapFilesDependsOn);
</CollectFilesFrom_WebApplicationSilverlightXapFilesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFrom_WebApplicationSilverlightXapFiles"
DependsOnTargets="$(CollectFilesFrom_WebApplicationSilverlightXapFilesDependsOn)"
Condition="'@(_WebApplicationSilverlightXapFiles)'!=''">
<FilterByItems PipelineItems="@(_WebApplicationSilverlightXapFiles)"
Filter="@(Content)">
<Output TaskParameter="OutFilter" ItemName="_WebApplicationSilverlightXapFilesNotInContent"/>
</FilterByItems>
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="_WebApplicationSilverlightXapFilesNotInContent"
LogType="Message" />
<Message Text="@(_WebApplicationSilverlightXapFilesNotInContent)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(_WebApplicationSilverlightXapFilesNotInContent)">
<DestinationRelativePath>%(_WebApplicationSilverlightXapFiles.Identity)</DestinationRelativePath>
<FromTarget>CollectFilesFrom_WebApplicationSilverlightXapFiles</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFrom_WebApplicationSilverlightXapFiles)" RunEachTargetSeparately="false" />
</Target>
<!--********************************************************************-->
<!-- Task CollectFilesFrom_binDeployableAssemblies -->
<!--********************************************************************-->
<PropertyGroup>
<CollectFilesFrom_binDeployableAssembliesDependsOn>
$(OnBeforeCollectFilesFrom_binDeployableAssemblies);
$(CollectFilesFrom_binDeployableAssembliesDependsOn);
_CopyBinDeployableAssemblies;
</CollectFilesFrom_binDeployableAssembliesDependsOn>
</PropertyGroup>
<Target Name="CollectFilesFrom_binDeployableAssemblies"
DependsOnTargets="$(CollectFilesFrom_binDeployableAssembliesDependsOn)">
<!--Make sure binDeployableAssemblies is in None group. This is mainly for the dev10-->
<FilterByItems PipelineItems="@(_binDeployableAssemblies)"
SourceMetadataName="FullPath"
Filter="@(None)"
FilterMetadataName="FullPath">
<Output TaskParameter="InFilter" ItemName="_binDeployableAssemblies_None"/>
</FilterByItems>
<!--Get Localized string before display message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_GatherSpecificItemsFromProject"
ArgumentCount="1"
Arguments="_binDeployableAssemblies"
LogType="Message" />
<Message Text="@(_binDeployableAssemblies_None)" />
<ItemGroup>
<FilesForPackagingFromProject Include="@(_binDeployableAssemblies_None)" Condition="'%(_binDeployableAssemblies_None.DestinationRelPath)'==''">
<DestinationRelativePath>bin\%(RecursiveDir)%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFrom_binDeployableAssemblies_NoDestinationRelPath</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
<!--VS11, _binDeployAssembly begin to have %(DestinationRelPath), we should honer that instead of %(recursiveDir)-->
<FilesForPackagingFromProject Include="@(_binDeployableAssemblies_None)" Condition="'%(_binDeployableAssemblies_None.DestinationRelPath)'!=''">
<DestinationRelativePath>bin\%(_binDeployableAssemblies_None.DestinationRelPath)%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>CollectFilesFrom_binDeployableAssemblies_WithDestinationRelPath</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
<CallTarget Targets="$(OnAfterCollectFilesFrom_binDeployableAssemblies)" RunEachTargetSeparately="false" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingOnlyFilesToRunTheAppTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingOnlyFilesToRunTheAppTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingOnlyFilesToRunTheAppTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingOnlyFilesToRunTheAppTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

59
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FPSE.targets

@ -1,59 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.Deploy.FPSE.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Deploy
Currently
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--Append WebFTPPublish to the supported list.-->
<PropertyGroup>
<_WPPWebPublishMethodSupports>$(_WPPWebPublishMethodSupports);WebFPSEPublish</_WPPWebPublishMethodSupports>
</PropertyGroup>
<!--********************************************************************-->
<!--Target WebFPSEPublish -->
<!--********************************************************************-->
<PropertyGroup>
<WebFPSEPublishDependsOn>
$(OnBeforeWebFPSEPublish);
$(WebFPSEPublishDependsOn);
</WebFPSEPublishDependsOn>
</PropertyGroup>
<Target Name="WebFPSEPublish"
DependsOnTargets="$(WebFPSEPublishDependsOn)"
Condition="'$(WebFPSEPublish)' != 'False'">
<!--This is not yet implemented through the command line for now error it out-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishMethodIsNotSupportedInCmdLine"
ArgumentCount="1"
Arguments="$(WebPublishMethod)"
LogType="Error" />
<Error Text ="Target WebFPSEPublish Failed" />
<CallTarget Targets="$(OnAfterWebFPSEPublish)" RunEachTargetSeparately="False" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingDeployFPSETargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFPSETargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingDeployFPSETargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFPSETargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

60
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FTP.targets

@ -1,60 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.Deploy.FTP.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Deploy
Currently
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--Append WebFTPPublish to the supported list.-->
<PropertyGroup>
<_WPPWebPublishMethodSupports>$(_WPPWebPublishMethodSupports);WebFTPPublish</_WPPWebPublishMethodSupports>
</PropertyGroup>
<!--********************************************************************-->
<!--Target WebFTPPublish -->
<!--Current this is not supported through the command line, show the error message.-->
<!--********************************************************************-->
<PropertyGroup>
<WebFTPPublishDependsOn>
$(OnBeforeWebFTPPublish);
$(WebFTPPublishDependsOn);
</WebFTPPublishDependsOn>
</PropertyGroup>
<Target Name="WebFTPPublish"
DependsOnTargets="$(WebFTPPublishDependsOn)"
Condition="'$(WebFTPPublish)' != 'False'">
<!--This is not yet implemented through the command line for Log the error -->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishMethodIsNotSupportedInCmdLine"
ArgumentCount="1"
Arguments="$(WebPublishMethod)"
LogType="Error" />
<Error Text ="Target WebFTPPublish Failed" />
<CallTarget Targets="$(OnAfterWebFTPPublish)" RunEachTargetSeparately="False" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingDeployFTPTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFTPTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingDeployFTPTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFTPTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

116
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.FileSystem.targets

@ -1,116 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.Deploy.FPSE.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Deploy
Currently
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CopyPipelineFiles" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--Append WebFTPPublish to the supported list.-->
<PropertyGroup>
<_WPPWebPublishMethodSupports>$(_WPPWebPublishMethodSupports);WebFileSystemPublish</_WPPWebPublishMethodSupports>
</PropertyGroup>
<!--********************************************************************-->
<!--Target WebFileSystemPublish -->
<!--********************************************************************-->
<PropertyGroup>
<WebFileSystemPublishDependsOn>
$(OnBeforeWebFileSystemPublish);
$(WebFileSystemPublishDependsOn);
</WebFileSystemPublishDependsOn>
<WebFileSystemPublishDependsOn>
$(WebFileSystemPublishDependsOn);
PipelinePreDeployCopyAllFilesToOneFolder;
</WebFileSystemPublishDependsOn>
</PropertyGroup>
<Target Name="WebFileSystemPublish"
DependsOnTargets="$(WebFileSystemPublishDependsOn)"
Condition="'$(WebFileSystemPublish)' != 'False'">
<PropertyGroup>
<_DoWebFileSystemPublishDeleteExtraFiles>False</_DoWebFileSystemPublishDeleteExtraFiles>
<_DoWebFileSystemPublishDeleteExtraFiles Condition= "'$(DeleteExistingFiles)' == 'True'" >True</_DoWebFileSystemPublishDeleteExtraFiles>
<_HttpHeader>http://</_HttpHeader>
<_DoWebFileSystemPublish>False</_DoWebFileSystemPublish>
<_DoWebFileSystemPublish Condition="'$(PublishUrl)'!='' And '$(PublishUrl.StartsWith($(_HttpHeader), StringComparison.OrdinalIgnoreCase))' == 'False' And '$([System.IO.Path]::GetFullPath($(PublishUrl)))' != ''">True</_DoWebFileSystemPublish>
</PropertyGroup>
<!--This is not yet implemented through the command line for now error it out-->
<GetPublishingLocalizedString
Condition="!$(_DoWebFileSystemPublish)"
ID="PublishLocalizedString_WebPublishMethodIsNotSupportedInCmdLine"
ArgumentCount="1"
Arguments="$(WebPublishMethod)"
LogType="Error" />
<Error Text ="Target WebFileSystemPublish Failed"
Condition="!$(_DoWebFileSystemPublish)"
/>
<ItemGroup Condition="$(_DoWebFileSystemPublish)">
<FilesForFileCopy Remove="$(FilesForFileCopy)" />
</ItemGroup>
<CollectFilesinFolder RootPath="$(WPPAllFilesInSingleFolder)"
Condition="$(_DoWebFileSystemPublish)" >
<Output TaskParameter="Result" ItemName="_AllFilesUnder_WPPAllFilesInSingleFolder" />
</CollectFilesinFolder>
<ItemGroup>
<FilesForFileCopy Include="@(_AllFilesUnder_WPPAllFilesInSingleFolder)" >
<DestinationRelativePath>%(_AllFilesUnder_WPPAllFilesInSingleFolder.Identity)</DestinationRelativePath>
<FromTarget>WebFileSystemPublish</FromTarget>
<Category>AllFilesInFolder</Category>
</FilesForFileCopy>
</ItemGroup>
<!-- In the case of the incremental Packaging/Publish, we need to find out the extra file and delee them-->
<ItemGroup Condition="'$(DeleteExistingFiles)' == 'True'">
<_AllExtraFilesUnderPublishUrl Include="$(PublishUrl)\**" />
<_AllExtraFilesUnderPublishUrl
Remove="@(FilesForFileCopy->'$(PublishUrl)\%(DestinationRelativePath)')" />
</ItemGroup>
<!--Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject-->
<Delete Files="@(_AllExtraFilesUnderPublishUrl)" />
<!-- Make sure the folder exist -->
<MakeDir Directories="$(PublishUrl)" Condition="$(_DoWebFileSystemPublish) And !Exists('$(PublishUrl)')"/>
<!--Force Copy Of all file to the WPPAllFilesInSingleFolder if needed-->
<CopyPipelineFiles Condition="$(_DoWebFileSystemPublish)"
PipelineItems="@(FilesForFileCopy)"
SourceDirectory="$(WPPAllFilesInSingleFolder)"
TargetDirectory="$(PublishUrl)"
SkipMetadataExcludeTrueItems="False"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="False">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForFileCopyAfterFileSystemPublish"/>
</CopyPipelineFiles>
<CallTarget Targets="$(OnAfterWebFileSystemPublish)" RunEachTargetSeparately="False" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingDeployFileSystemTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFileSystemTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingDeployFileSystemTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployFileSystemTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

49
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.MsDeploy.targets

@ -1,49 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.Deploy.MSDeploy.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Deploy
Currently
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingDeployMSDeployTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingDeployMSDeployTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingDeployMSDeployTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingDeployMSDeployTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<!--This only support new /t:WebPublish with the 'WebPublishMethod'=='MSDeploy'-->
<PropertyGroup>
<Microsoft_Web_Publishing_MSDeploy_Common_targets Condition="'$(Microsoft_Web_Publishing_MSDeploy_Common_targets)' == ''">Microsoft.Web.Publishing.MSDeploy.Common.targets</Microsoft_Web_Publishing_MSDeploy_Common_targets>
</PropertyGroup>
<Import Project="$(Microsoft_Web_Publishing_MSDeploy_Common_targets)" Condition="'$(Microsoft_Web_Publishing_MSDeploy_Common_targets_Imported)' != 'true' And Exists($(Microsoft_Web_Publishing_MSDeploy_Common_targets))"/>
<PropertyGroup>
<Microsoft_Web_Publishing_Deploy_MSDeploy_targets_Imported>True</Microsoft_Web_Publishing_Deploy_MSDeploy_targets_Imported>
<PipelineDeployPhaseDependsOn>
$(PipelineDeployPhaseDependsOn);
PipelineMsdeploySpecificTransformPhase;
</PipelineDeployPhaseDependsOn>
</PropertyGroup>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingDeployMSDeployTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployMSDeployTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingDeployMSDeployTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployMSDeployTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

54
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.Deploy.Package.targets

@ -1,54 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.Deploy.Package.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Deploy
Currently
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="MSDeploy" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="VSMSDeploy" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ImportParametersFile" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ExportParametersFile" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="SortParametrsByPriority" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingDeployPackageTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingDeployPackageTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingDeployPackageTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingDeployPackageTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<PropertyGroup>
<Microsoft_Web_Publishing_MSDeploy_Common_targets Condition="'$(Microsoft_Web_Publishing_MSDeploy_Common_targets)' == ''">Microsoft.Web.Publishing.MSDeploy.Common.targets</Microsoft_Web_Publishing_MSDeploy_Common_targets>
</PropertyGroup>
<Import Project="$(Microsoft_Web_Publishing_MSDeploy_Common_targets)" Condition="'$(Microsoft_Web_Publishing_MSDeploy_Common_targets_Imported)' != 'true' And Exists($(Microsoft_Web_Publishing_MSDeploy_Common_targets))"/>
<PropertyGroup>
<Microsoft_Web_Publishing_Deploy_Package_targets_Imported>True</Microsoft_Web_Publishing_Deploy_Package_targets_Imported>
<PipelineDeployPhaseDependsOn>
$(PipelineDeployPhaseDependsOn);
PipelineMsdeploySpecificTransformPhase;
</PipelineDeployPhaseDependsOn>
</PropertyGroup>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingDeployPackageTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployPackageTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingDeployPackageTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingDeployPackageTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

1192
eng/msbuild/web/Web/Deploy/Microsoft.Web.Publishing.MsDeploy.Common.targets

File diff suppressed because it is too large

459
eng/msbuild/web/Web/Microsoft.DNX.Publishing.targets

@ -1,459 +0,0 @@
<!--
***********************************************************************************************
Microsoft.DNX.Publishing.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process to deploy web application projects.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- The build process can be extended in a similar way as MS.Common.targets -->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<!--
***********************************************************************************************
Including the tasks
***********************************************************************************************
-->
<PropertyGroup>
<WebPublishTasksDir Condition=" '$(WebPublishTasksDir)'=='' ">$(MSBuildThisFileDirectory)</WebPublishTasksDir>
<DNXTasksDir Condition=" '$(DNXTasksDir)'=='' ">$(MSBuildThisFileDirectory)..\DNX\</DNXTasksDir>
</PropertyGroup>
<UsingTask TaskName="MSDeploy" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="VSMSDeploy" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="NormalizeServiceUrl" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="InvokePowerShell" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="ValidateParameter" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetAllPublishProperties" AssemblyFile="$(WebPublishTasksDir)Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="Dnu" AssemblyFile="$(DNXTasksDir)Microsoft.DNX.Tasks.dll"/>
<!--
***********************************************************************************************
Import the publish profile
***********************************************************************************************
-->
<PropertyGroup Condition="'$(PublishProfile)' != ''">
<PublishProfileRootFolder Condition="'$(PublishProfileRootFolder)' == '' ">$(MSBuildProjectDirectory)\Properties\PublishProfiles\</PublishProfileRootFolder>
<PublishProfileName Condition="'$(PublishProfileName)' == ''">$([System.IO.Path]::GetFileNameWithoutExtension($(PublishProfile)))</PublishProfileName>
<WebPublishProfileFile Condition="'$(WebPublishProfileFile)' == ''">$(PublishProfileRootFolder)$(PublishProfileName).pubxml</WebPublishProfileFile>
</PropertyGroup>
<Import Project="$(WebPublishProfileFile)" Condition="Exists($(WebPublishProfileFile))"/>
<!--
***********************************************************************************************
Global Properties
***********************************************************************************************
-->
<PropertyGroup>
<PublishOutputPathNoTrailingSlash Condition="'$(PublishOutputPathNoTrailingSlash)' == ''">$([System.IO.Path]::GetTempPath())PublishTemp</PublishOutputPathNoTrailingSlash>
<PublishOutputPath Condition="'$(PublishOutputPath)' == ''">$(PublishOutputPathNoTrailingSlash)\</PublishOutputPath>
</PropertyGroup>
<!--
***********************************************************************************************
TARGET : WebPublish
***********************************************************************************************
-->
<Target Name="WebPublish" AfterTargets="Build" Condition=" '$(DeployOnBuild)'=='true' ">
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="DefaultPublish"
Condition=" '$(WebPublishMethod)'=='' " />
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="FileSystemPublish"
Condition=" '$(WebPublishMethod)'=='FileSystem' " />
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="MSDeployPublish"
Condition=" '$(WebPublishMethod)'=='MSDeploy' " />
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="DockerPublish"
Condition=" '$(WebPublishMethod)'=='Docker' " />
</Target>
<!--
***********************************************************************************************
TARGET: GatherAllFilesToPublish
***********************************************************************************************
-->
<PropertyGroup>
<GatherAllFilesToPublishDependsOn>
$(GatherAllFilesToPublishDependsOn);
GetRuntimeToolingPathTarget
</GatherAllFilesToPublishDependsOn>
</PropertyGroup>
<Target Name="GatherAllFilesToPublish"
DependsOnTargets="$(GatherAllFilesToPublishDependsOn)">
<!-- Dnu bundle arguments -->
<PropertyGroup>
<!-- Dnu bundle arguments begin -->
<KPackWorkingDirectory Condition=" '$(KPackWorkingDirectory)'=='' ">$(MSBuildProjectDirectory)</KPackWorkingDirectory>
<!-- Setting the default webroot in the case of CI build scenarios -->
<WebRoot Condition="'$(WebRoot)' == '' And '$(DeployOnBuild)'=='true'">wwwroot</WebRoot>
<!-- wwwroot-out switch is only provided for web projects. -->
<WebRootOut Condition= "'$(WebRootOut)'=='' and '$(WebRoot)' != ''">$(WebRoot)</WebRootOut>
<!-- If compile source is set, then no-source flag is passed to Dnu bundle -->
<NoSourceFlag Condition=" '$(NoSourceFlag)'=='' And '$(CompileSource)'=='true' ">true</NoSourceFlag>
<QuietFlag Condition=" '$(QuietFlag)'=='' And '$(DeployOnBuild)'!='true' ">true</QuietFlag>
<PublishConfiguration Condition=" '$(PublishConfiguration)'=='' And '$(LastUsedBuildConfiguration)'!='' ">$(LastUsedBuildConfiguration)</PublishConfiguration>
<!-- Setting the default publish configuration to $(Configuration) -->
<PublishConfiguration Condition=" '$(PublishConfiguration)'=='' ">$(Configuration)</PublishConfiguration>
<PublishConfiguration Condition=" '$(PublishConfiguration)'=='' ">Release</PublishConfiguration>
<!-- Dnu bundle arguments end -->
</PropertyGroup>
<!-- If an external tools path has not been set, set it to the default -->
<DefaultExternalToolsPath ProjectFolder="$(MSBuildProjectDirectory)" Condition="'$(ExternalToolsPath)' == ''">
<Output PropertyName="ExternalToolsPath" TaskParameter="ExternalToolsPath"></Output>
</DefaultExternalToolsPath>
<GetRuntimeVersion
RuntimeVersionOverride="$(PublishDNXVersion)"
TargetDNXVersion="$(TargetDNXVersion)"
RuntimeToolingVersion="$(RuntimeToolingVersion)"
Want64Bit="$(Bundle64BitRuntime)"
WantCoreClr="$(BundleCoreClrRuntime)">
<Output PropertyName="FinalPublishVersion" TaskParameter="RuntimeVersion"></Output>
</GetRuntimeVersion>
<Exec
Condition="Exists('$(PublishOutputPath)')"
Command="rmdir /S /Q &quot;$(PublishOutputPath)&quot;"
WorkingDirectory="$(MSBuildProjectDirectory)" />
<Dnu
RuntimeToolingDirectory ="$(RuntimeToolingDirectory)"
ProjectFolder="$(MSBuildProjectDirectory)"
Project="$(KPackWorkingDirectory)"
Command="publish"
Runtime="$(FinalPublishVersion)"
WwwRootOut="$(WebRootOut)"
NoSource="$(NoSourceFlag)"
Quiet="$(QuietFlag)"
Configuration="$(PublishConfiguration)"
Out="$(PublishOutputPathNoTrailingSlash)"
ExternalToolsPath="$(ExternalToolsPath)"
IsFilePreview="$(FilePreview)"
/>
</Target>
<!--
***********************************************************************************************
TARGET: FileSystem Publish
***********************************************************************************************
-->
<PropertyGroup>
<FileSystemPublishDependsOn>
$(FileSystemPublishDependsOn);
GatherAllFilesToPublish;
</FileSystemPublishDependsOn>
</PropertyGroup>
<Target Name="FileSystemPublish"
DependsOnTargets="$(FileSystemPublishDependsOn)">
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="PowerShellPublish" />
</Target>
<!--
***********************************************************************************************
TARGET: Docker Publish
***********************************************************************************************
-->
<PropertyGroup>
<DockerPublishDependsOn>
$(DockerPublishDependsOn);
GatherAllFilesToPublish;
</DockerPublishDependsOn>
</PropertyGroup>
<Target Name="DockerPublish"
DependsOnTargets="$(DockerPublishDependsOn)">
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="PowerShellPublish" />
</Target>
<!--
***********************************************************************************************
TARGET : MSDeploy Publish
***********************************************************************************************
-->
<PropertyGroup>
<MSDeployPublishDependsOn>
$(MSDeployPublishDependsOn);
GatherAllFilesToPublish;
GenerateSkipRuleForAppData
</MSDeployPublishDependsOn>
</PropertyGroup>
<Target Name="MSDeployPublish" DependsOnTargets="$(MSDeployPublishDependsOn)">
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="VSMSDeployPublish" />
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="PowerShellPublish" />
</Target>
<!--
***********************************************************************************************
TARGET : VSMSDeploy Publish
***********************************************************************************************
-->
<Target Name="VSMSDeployPublish" Condition=" '$(FilePreview)' == 'true' Or '$(UsePowerShell)' != 'true'" >
<ValidateParameter
ParameterName="MsDeployServiceUrl"
ParameterValue="$(MsDeployServiceUrl)"/>
<!-- Normalize service url such as convert a server name to format like https://<server>:8172/msdeploy.axd-->
<NormalizeServiceUrl ServiceUrl="$(MsDeployServiceUrl)" UseWMSVC="true" UseRemoteAgent="false">
<Output TaskParameter="ResultUrl" PropertyName="MsDeployServiceUrl" />
</NormalizeServiceUrl>
<!-- Data Passed to MSDeploy -->
<ItemGroup>
<MsDeploySourceProviderSetting Include="IisApp">
<Path>$(PublishOutputPath)$(WebRoot)</Path>
</MsDeploySourceProviderSetting>
<MsDeployDestinationProviderSetting Include="IisApp">
<Path>$(DeployIisAppPath)</Path>
<ComputerName>$(MsDeployServiceUrl)</ComputerName>
<UserName>$(UserName)</UserName>
<Password>$(Password)</Password>
<IncludeAcls>False</IncludeAcls>
<AuthType>Basic</AuthType>
</MsDeployDestinationProviderSetting>
</ItemGroup>
<PropertyGroup>
<PublishEnableLinks Condition=" '$(PublishEnableLinks)' == '' ">contentLibExtension</PublishEnableLinks>
<RetryAttemptsForDeployment Condition=" '$(RetryAttemptsForDeployment)' == '' ">2</RetryAttemptsForDeployment>
<MsDeployDoNotDeleteRule Condition="$(SkipExtraFilesOnServer) == 'true'">DoNotDeleteRule</MsDeployDoNotDeleteRule>
<_EnableRuleList>$(MsDeployDoNotDeleteRule)</_EnableRuleList>
<MSDeployUseChecksum Condition=" '$(MSDeployUseChecksum)' == '' ">false</MSDeployUseChecksum>
<AllowUntrustedCertificate Condition=" '$(AllowUntrustedCertificate)' == '' ">false</AllowUntrustedCertificate>
<!-- UserAgent string sent to msdeploy -->
<_MSDeployUserAgentSource Condition=" '$(BuildingInsideVisualStudio)' != 'true'">$(VisualStudioVersion):CmdLine</_MSDeployUserAgentSource>
<_MSDeployUserAgentSource Condition=" '$(BuildingInsideVisualStudio)' == 'true'">$(VisualStudioVersion):PublishDialog</_MSDeployUserAgentSource>
<_MSDeployUserAgent>VS$(_MSDeployUserAgentSource)</_MSDeployUserAgent>
</PropertyGroup>
<VSMSDeploy
Condition=" '$(FilePreview)' == 'true' Or '$(UsePowerShell)' != 'true'"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
EnableLink="$(PublishEnableLinks)"
AllowUntrustedCertificate="$(AllowUntrustedCertificate)"
BuildingInsideVisualStudio="$(BuildingInsideVisualStudio)"
SkipExtraFilesOnServer="$(SkipExtraFilesOnServer)"
SkipRuleItems="@(MsDeploySkipRules)"
WhatIf="$(FilePreview)"
RetryAttempts="$(RetryAttemptsForDeployment)"
EnableMSDeployBackup="$(EnableMSDeployBackup)"
UseChecksum="$(MSDeployUseChecksum)"
UserAgent="$(_MSDeployUserAgent)"
InvokedByPublish="true">
<Output TaskParameter="Result" PropertyName="_PublishResult" />
</VSMSDeploy>
</Target>
<!--
***********************************************************************************************
TARGET : Package Publish
***********************************************************************************************
-->
<PropertyGroup>
<PackagePublishDependsOn>
$(PackagePublishDependsOn);
FileSystemPublish
</PackagePublishDependsOn>
</PropertyGroup>
<Target Name="PackagePublish" DependsOnTargets="$(PackagePublishDependsOn)">
<PropertyGroup>
<PackagePowerShellScriptFile Condition= "'$(PackagePowerShellScriptFile)'=='' ">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\Web\Powershell\1.0.1\default-publish.ps1))</PackagePowerShellScriptFile>
<PackagePubxmlFile Condition=" '$(PackagePubxmlFile)'=='' ">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\Web\Powershell\1.0.1\package.pubxml))</PackagePubxmlFile>
</PropertyGroup>
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="PowerShellPublish"
Properties="UsePowerShell=true;
FilePreview=false;
PowerShellScriptFile=$(PackagePowerShellScriptFile);
WebPublishProfileFile=$(PackagePubxmlFile);" />
</Target>
<!--
***********************************************************************************************
TARGET : Default Publish
***********************************************************************************************
-->
<PropertyGroup>
<DefaultPublishDependsOn>
$(DefaultPublishDependsOn);
FileSystemPublish
</DefaultPublishDependsOn>
</PropertyGroup>
<Target Name="DefaultPublish" DependsOnTargets="$(DefaultPublishDependsOn)">
<PropertyGroup>
<DefaultPowerShellScriptFile Condition= "'$(DefaultPowerShellScriptFile)'=='' ">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\Web\Powershell\1.0.1\default-publish.ps1))</DefaultPowerShellScriptFile>
<DefaultPubxmlFile Condition=" '$(DefaultPubxmlFile)'=='' ">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\Web\Powershell\1.0.1\FileSystem.pubxml))</DefaultPubxmlFile>
</PropertyGroup>
<MSBuild Projects ="$(MSBuildProjectFullPath)"
Targets="PowerShellPublish"
Properties="UsePowerShell=true;
FilePreview=false;
PowerShellScriptFile=$(DefaultPowerShellScriptFile);
WebPublishProfileFile=$(DefaultPubxmlFile);" />
<ItemGroup>
<SourceFiles Include="$(DefaultPowerShellScriptFile)"/>
<SourceFiles Include="$(DefaultPubxmlFile)"/>
<SourceFiles Include="$(MSBuildProjectDirectory)\Properties\PublishProfiles\*.*"/>
</ItemGroup>
<Copy
SourceFiles="@(SourceFiles)"
DestinationFolder="$(OutDir)\$(Configuration)\PublishProfiles\" />
</Target>
<!--
***********************************************************************************************
TARGET : PowerShell Publish
***********************************************************************************************
-->
<Target Name="PowerShellPublish" Condition=" '$(FilePreview)' != 'true' And '$(UsePowerShell)' == 'true' " >
<PropertyGroup>
<PowerShellScriptFile Condition= "'$(PowerShellScriptFile)'=='' ">$([System.String]::Copy('$(WebPublishProfileFile)').Replace('.pubxml','-publish.ps1'))</PowerShellScriptFile>
<!-- If a .ps1 file is present in the PublishProfiles folder with format <publishprofile>-publish.ps1, then the generated powershell script will be overridden with this file -->
<PowerShellScript Condition="Exists('$(PowerShellScriptFile)')" >$([System.IO.File]::ReadAllText($(PowerShellScriptFile)))</PowerShellScript>
</PropertyGroup>
<GetAllPublishProperties
PublishProfilePath="$(WebPublishProfileFile)" >
<Output TaskParameter="AllPublishProperties" ItemName="_PublishProperties" />
</GetAllPublishProperties>
<ItemGroup>
<PublishPropertiesOverride Include="%(_PublishProperties.Identity)">
<Value>$(%(_PublishProperties.Identity))</Value>
</PublishPropertiesOverride>
</ItemGroup>
<InvokePowerShell
Script="$(PowerShellScript)"
PublishProfilePath="$(WebPublishProfileFile)"
PackOutput="$(PublishOutputPath)"
ProjectPath="$(MSBuildProjectDirectory)"
Password ="$(Password)"
MSDeployPath ="$(MSDeployPath)"
PublishPropertiesOverride ="@(PublishPropertiesOverride)"/>
</Target>
<!--================================================-->
<!--Create skip rules used in sample script generation as well as publish-->
<!--================================================-->
<Target Name="GenerateSkipRuleForAppData" Condition="$(ExcludeApp_Data) == 'true'">
<EscapeTextForRegularExpressions Text="$(PublishOutputPath)">
<Output TaskParameter="Result" PropertyName="_Escaped_PublishOutputPath" />
</EscapeTextForRegularExpressions>
<ItemGroup>
<MsDeploySkipRules Include="SkipAppDataOnDeploy">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_Escaped_PublishOutputPath)\\App_Data$</AbsolutePath>
<Apply>Source</Apply>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
<!--
***********************************************************************************************
Item Definitions
***********************************************************************************************
-->
<ItemDefinitionGroup>
<MsDeploySourceProviderSetting>
<Path></Path>
<ComputerName></ComputerName>
<!--<Wmsvc></Wmsvc> Not supported yet-->
<UserName></UserName>
<Password></Password>
<EncryptPassword></EncryptPassword>
<IncludeAcls></IncludeAcls>
<authType></authType>
<prefetchPayload></prefetchPayload>
</MsDeploySourceProviderSetting>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<MsDeployDestinationProviderSetting>
<Path></Path>
<ComputerName></ComputerName>
<!--<Wmsvc></Wmsvc> Not supported yet-->
<UserName></UserName>
<Password></Password>
<EncryptPassword></EncryptPassword>
<IncludeAcls></IncludeAcls>
<authType></authType>
<prefetchPayload></prefetchPayload>
</MsDeployDestinationProviderSetting>
</ItemDefinitionGroup>
<!--
DeploymentSkipRule(string skipAction, string objectName, string absolutePath, string XPath);-->
<ItemDefinitionGroup>
<MsDeploySkipRules>
<SkipAction></SkipAction>
<ObjectName></ObjectName>
<AbsolutePath></AbsolutePath>
<XPath></XPath>
<KeyAttribute></KeyAttribute>
<!--Source, Destination, Both(the default)-->
<Apply></Apply>
</MsDeploySkipRules>
</ItemDefinitionGroup>
<!-- The build process can be extended in a similar way as MS.Common.targets -->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

BIN
eng/msbuild/web/Web/Microsoft.Web.Publishing.Tasks.dll

Binary file not shown.

4802
eng/msbuild/web/Web/Microsoft.Web.Publishing.targets

File diff suppressed because it is too large

300
eng/msbuild/web/Web/Microsoft.Web.Publishing/ImportAfter/Microsoft.Web.AzureAD.Publishing.targets

@ -1,300 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.AzureAD.Publishing.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 web deploy projects from the command-line or the IDE.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--********************************************************************-->
<!-- This will create the parameters required when publishing an web app leveraging
Windows Azure Active Directory for auth -->
<PropertyGroup>
<PipelineTransformPhaseDependsOn>$(PipelineTransformPhaseDependsOn);_TransformWebConfigForAzureAuthentication</PipelineTransformPhaseDependsOn>
</PropertyGroup>
<Target Name="_TransformWebConfigForAzureAuthenticationCore">
<PropertyGroup>
<_WebConfigTransformFolderForAzureAuthentication>$(_WPPDefaultIntermediateOutputPath)WebConfigTransformFolderForAzureAuthentication</_WebConfigTransformFolderForAzureAuthentication>
</PropertyGroup>
<ItemGroup>
<_WebConfigsToTransformForAzureAuthentication Include="@(FilesForPackagingFromProject)"
Condition="'%(FilesForPackagingFromProject.Filename)%(FilesForPackagingFromProject.Extension)'=='$(ProjectConfigFileName)'
And !%(FilesForPackagingFromProject.Exclude)
And '%(DestinationRelativePath)' == '$(ProjectConfigFileName)'">
<TransformOriginalFolder>$(_WebConfigTransformFolderForAzureAuthentication)\original</TransformOriginalFolder>
<TransformFileFolder>$(_WebConfigTransformFolderForAzureAuthentication)\assist</TransformFileFolder>
<TransformOutputFile>$(_WebConfigTransformFolderForAzureAuthentication)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$([System.IO.Path]::GetFullPath($(WPPAllFilesInSingleFolder)\%(DestinationRelativePath)))</TransformScope>
</_WebConfigsToTransformForAzureAuthentication>
<_WebConfigsToTransformForAzureAuthenticationOuputFiles Include="@(_WebConfigsToTransformForAzureAuthentication->'%(TransformOutputFile)')">
</_WebConfigsToTransformForAzureAuthenticationOuputFiles>
</ItemGroup>
<PropertyGroup>
<_WebConfigsToTransformForAzureAuthenticationOuputDirectories>@(_WebConfigsToTransformForAzureAuthenticationOuputFiles->'%(RootDir)%(Directory)')</_WebConfigsToTransformForAzureAuthenticationOuputDirectories>
<_WebConfigsToTransformForAzureAuthenticationOuput>@(_WebConfigsToTransformForAzureAuthentication->'%(TransformOutputFile)');</_WebConfigsToTransformForAzureAuthenticationOuput>
</PropertyGroup>
<ItemGroup>
<_WebConfigsToTransformForAzureAuthenticationOuputDirectories Include="$(_WebConfigsToTransformForAzureAuthenticationOuputDirectories)" />
</ItemGroup>
<!-- Make sure required directories exist -->
<MakeDir Directories="@(_WebConfigsToTransformForAzureAuthenticationOuputDirectories)" Condition="!Exists(%(Identity))"/>
<!-- Copy the original web.config -->
<CopyPipelineFiles PipelineItems="@(_WebConfigsToTransformForAzureAuthentication)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="%(TransformOriginalFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="False"
DeleteItemsMarkAsExcludeTrue ="True"
Condition="'@(_WebConfigsToTransformForAzureAuthentication)' != ''">
<Output TaskParameter="UpdatedPipelineItems" ItemName="_UpdatedWebConfigsToTransformForAzureAuthentication"/>
</CopyPipelineFiles>
<!-- Delete those web.config have been updated if existed-->
<Delete Files="@(_WebConfigsToTransformForAzureAuthenticationOuputDirectories->'%(TransformOutputFile)')" />
<ItemGroup>
<MSDeployParameterValue Include="AD_APPIDUri">
<ParameterValue>$(ADAppIDUri)</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
<PropertyGroup>
<RemoveCertValidationElement Condition="'$(RemoveCertValidationElement)'=='' ">false</RemoveCertValidationElement>
<_RemoveCertificateValidationTransform Condition="'$(RemoveCertValidationElement)' == 'true'">&lt;certificateValidation certificateValidationMode=&quot;None&quot; xdt:Transform=&quot;Remove&quot; /&gt;</_RemoveCertificateValidationTransform>
<_RemoveExistingAudienceUrisTransform Condition="'$(PreserveExistingAudienceUris)' != 'true'">&lt;add xdt:Transform=&quot;RemoveAll&quot; /&gt;</_RemoveExistingAudienceUrisTransform>
</PropertyGroup>
<PropertyGroup>
<_ReplaceRealmAndAudienceUriAppSetting Condition="'$(ADWebAPIBased)'!='true' And '$(ADUsesOwinOrOpenIdConnect)'!='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:AudienceUri&quot;
value=&quot;{% parameter='AD_AudienceUriAppSetting' xpathlocator='key' description='AD Audience Uri App Setting' defaultValue='%24(value)' tags='AD_AudienceUriAppSetting' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;add key=&quot;ida:Realm&quot;
value=&quot;{% parameter='AD_RealmAppSetting' xpathlocator='key' description='AD Realm App Setting' defaultValue='%24(value)' tags='AD_RealmAppSetting' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;add key=&quot;ida:FederationMetadataLocation&quot;
value=&quot;{% parameter='AD_MetadataUrl' xpathlocator='key' description='AD MetadataUrl App Setting' defaultValue='%24(value)' tags='AD_MetadataUrlAppSetting' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceRealmAndAudienceUriAppSetting>
<_ReplaceADClientID Condition="'$(ADClientAPPID)'!='' And '$(ADUsesOwinOrOpenIdConnect)'!='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:ClientID&quot;
value=&quot;{% parameter='AD_ClientID' xpathlocator='key' description='AD Client Application ID' defaultValue='%24(value)' tags='AD_ClientAPPID' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADClientID>
<_ReplaceADClientPassword Condition="'$(ADClientPassword)'!='' And '$(ADUsesOwinOrOpenIdConnect)'!='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:Password&quot;
value=&quot;{% parameter='AD_ClientPassword' xpathlocator='key' description='AD Client Password' defaultValue='%24(value)' tags='AD_Password' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADClientPassword>
<_ReplaceADWebAPIAudienceAppSetting Condition="'$(ADWebAPIBased)'=='true' And '$(ADUsesOwinOrOpenIdConnect)'!='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:Audience&quot;
value=&quot;{% parameter='AD_WebAPI_Audience' xpathlocator='key' description='AD Web API Audience' defaultValue='%24(value)' tags='AD_WebAPI_Audience' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADWebAPIAudienceAppSetting>
<_ReplaceADWIFArtifacts Condition="'$(ADWebAPIBased)'!='true' And '$(ADUsesOwinOrOpenIdConnect)'!='true'">
&lt;system.identityModel&gt;
&lt;identityConfiguration&gt;
$(_RemoveCertificateValidationTransform)
&lt;audienceUris&gt;
$(_RemoveExistingAudienceUrisTransform)
&lt;add
value=&quot;APPIDUri&quot;
xdt:Transform=&quot;Insert&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;/audienceUris&gt;
&lt;audienceUris&gt;
&lt;add
value=&quot;{% token='%24(value)' parameter='AD_%24(value)' xpathlocator='value' description='AD AppIDUri' defaultValue='%24(value)' tags='ADrealmUri' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;/audienceUris&gt;
&lt;/identityConfiguration&gt;
&lt;/system.identityModel&gt;
&lt;system.identityModel.services&gt;
&lt;federationConfiguration&gt;
&lt;wsFederation
realm=&quot;{% xpathlocator='requireHttps' parameter='AD_APPIDUri' description='AD AppIDUri' defaultValue='%24(realm)' tags='ADAPPIDUri' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(realm)&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;wsFederation
issuer=&quot;{% xpathlocator='requireHttps' parameter='AD_Issuer' description='AD Issuer' defaultValue='%24(issuer)' tags='ADISSUER' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(issuer)&quot; xdt:SupressWarnings=&quot;True&quot; /&gt;
&lt;/federationConfiguration&gt;
&lt;/system.identityModel.services&gt;
</_ReplaceADWIFArtifacts>
<_ReplaceADClientIDDev14 Condition="'$(ADClientAPPID)'!='' And '$(ADUsesOwinOrOpenIdConnect)'=='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:ClientId&quot;
value=&quot;{% parameter='AD_ClientID' xpathlocator='key' description='AD Client Application ID' defaultValue='%24(value)' tags='AD_ClientAPPID' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADClientIDDev14>
<_ReplaceADClientPasswordDev14 Condition="'$(ADClientPassword)'!='' And '$(ADUsesOwinOrOpenIdConnect)'=='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:ClientSecret&quot;
value=&quot;{% parameter='AD_ClientPassword' xpathlocator='key' description='AD Client Password' defaultValue='%24(value)' tags='AD_Password' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADClientPasswordDev14>
<_ReplaceADTenantIdDev14 Condition="'$(ADTenantId)'!='' And '$(ADUsesOwinOrOpenIdConnect)'=='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:TenantId&quot;
value=&quot;{% parameter='AD_TenantId' xpathlocator='key' description='AD Tenant Id' defaultValue='%24(value)' tags='AD_TenantId' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADTenantIdDev14>
<_ReplaceADDomainDev14 Condition="'$(ADDomain)'!='' And '$(ADUsesOwinOrOpenIdConnect)'=='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:Domain&quot;
value=&quot;{% parameter='AD_Domain' xpathlocator='key' description='AD Domain' defaultValue='%24(value)' tags='AD_Domain' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADDomainDev14>
<_ReplaceADPostLogoutRedirectUriDev14 Condition="'$(ADPostLogoutRedirectUri)'!='' And '$(ADUsesOwinOrOpenIdConnect)'=='true'">
&lt;appSettings&gt;
&lt;add key=&quot;ida:PostLogoutRedirectUri&quot;
value=&quot;{% parameter='AD_PostLogoutRedirectUri' xpathlocator='key' description='AD PostLogoutRedirectUri' defaultValue='%24(value)' tags='AD_PostLogoutRedirectUri' %}&quot;
xdt:Transform=&quot;SetTokenizedAttributes(value)&quot; xdt:SupressWarnings=&quot;True&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;
&lt;/appSettings&gt;
</_ReplaceADPostLogoutRedirectUriDev14>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="AD_ClientID" Condition="'$(ADClientAPPID)'!=''">
<ParameterValue>$(ADClientAPPID)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_Issuer" Condition="'$(ADIssuer)'!=''">
<ParameterValue>$(ADIssuer)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_MetadataUrl" Condition="'$(ADDomain)'!=''">
<ParameterValue>https://login.windows.net/$(ADDomain)/FederationMetadata/2007-06/FederationMetadata.xml</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_ClientPassword" Condition="'$(ADClientPassword)'!=''">
<ParameterValue>$(ADClientPassword)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_WebAPI_Audience" Condition="'$(ADWebAPIBased)'=='true'">
<ParameterValue>$(ADAppIDUri)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_RealmAppSetting" Condition="'$(ADWebAPIBased)'!='true'">
<ParameterValue>$(ADAppIDUri)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_AudienceUriAppSetting" Condition="'$(ADWebAPIBased)'!='true'">
<ParameterValue>$(ADAppIDUri)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_TenantId" Condition="'$(ADTenantId)'!=''">
<ParameterValue>$(ADTenantId)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_Domain" Condition="'$(ADDomain)'!=''">
<ParameterValue>$(ADDomain)</ParameterValue>
</MSDeployParameterValue>
<MSDeployParameterValue Include="AD_PostLogoutRedirectUri" Condition="'$(ADPostLogoutRedirectUri)'!=''">
<ParameterValue>$(ADPostLogoutRedirectUri)</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
<CreateProperty Value="&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;
$(_ReplaceRealmAndAudienceUriAppSetting)
$(_ReplaceADClientID)
$(_ReplaceADClientPassword)
$(_ReplaceADWebAPIAudienceAppSetting)
$(_ReplaceADWIFArtifacts)
$(_ReplaceADClientIDDev14)
$(_ReplaceADClientPasswordDev14)
$(_ReplaceADTenantIdDev14)
$(_ReplaceADDomainDev14)
$(_ReplaceADPostLogoutRedirectUriDev14)
&lt;/configuration&gt;">
<Output TaskParameter="Value" PropertyName="_WebConfigsTransformForAzureAuthentication"/>
</CreateProperty>
<PropertyGroup>
<_WebConfigsToTransformForAzureAuthentication_Identity>%(_WebConfigsToTransformForAzureAuthentication.Identity)</_WebConfigsToTransformForAzureAuthentication_Identity>
<_WebConfigsToTransformForAzureAuthentication_TransformOutputFile>%(_WebConfigsToTransformForAzureAuthentication.TransformOutputFile)</_WebConfigsToTransformForAzureAuthentication_TransformOutputFile>
<_WebConfigsToTransformForAzureAuthentication_TransformScope>%(_WebConfigsToTransformForAzureAuthentication.TransformScope)</_WebConfigsToTransformForAzureAuthentication_TransformScope>
</PropertyGroup>
<ParameterizeTransformXml
Source="$(_WebConfigsToTransformForAzureAuthentication_Identity)"
IsSourceAFile="True"
Transform="$(_WebConfigsTransformForAzureAuthentication)"
IsTransformAFile="False"
Destination="$(_WebConfigsToTransformForAzureAuthentication_TransformOutputFile)"
IsDestinationAFile="True"
Scope="$(_WebConfigsToTransformForAzureAuthentication_TransformScope)"
StackTrace="$(TransformWebConfigStackTraceEnabled)"
EnableTokenizeParameters="True"
SourceRootPath="$(WebPublishPipelineSourceRootDirectory)">
<Output TaskParameter="DeclareParameters" ItemName="_ParamsFromWebConfigsToTransformForAzureAuthentication"/>
</ParameterizeTransformXml>
<PropertyGroup>
<_WebConfigsToTransformForAzureAuthenticationOutputFolder>$(_WPPDefaultIntermediateOutputPath)AzureAuthentication</_WebConfigsToTransformForAzureAuthenticationOutputFolder>
<_WebConfigsToTransformForAzureAuthenticationOutputParametersFile>$(_WebConfigsToTransformForAzureAuthenticationOutputFolder)\TransformForAzureAuthentication.parameters.xml</_WebConfigsToTransformForAzureAuthenticationOutputParametersFile>
</PropertyGroup>
<MakeDir Directories="$(_WebConfigsToTransformForAzureAuthenticationOutputFolder)" Condition="!Exists($(_WebConfigsToTransformForAzureAuthenticationOutputFolder))"/>
<ExportParametersFile
Parameters="@(_ParamsFromWebConfigsToTransformForAzureAuthentication)"
DeclareParameterFile="$(_WebConfigsToTransformForAzureAuthenticationOutputParametersFile)"
GenerateFileEvenIfEmpty="True"
/>
<ImportParametersFile Files="$(_WebConfigsToTransformForAzureAuthenticationOutputParametersFile)"
DisableEscapeMSBuildVariable="$(ImportParametersFile_DisableEscapeMSBuildVariable)"
Condition="!$(DisableAllVSGeneratedMSDeployParameter) And Exists($(_WebConfigsToTransformForAzureAuthenticationOutputParametersFile))" >
<Output TaskParameter="Result" ItemName="_ImportAutoParameterizeAzureAuthenticationWebConfig"/>
</ImportParametersFile>
<ItemGroup>
<MsDeployDeclareParameters Include="@(_ImportAutoParameterizeAzureAuthenticationWebConfig)" Condition="'%(_ImportAutoParameterizeAzureAuthenticationWebConfig.Identity)' !=''">
<Value>%(_ImportAutoParameterizeAzureAuthenticationWebConfig.DefaultValue)</Value>
<Priority>$(VsWebConfigAutoCsParametersPriority)</Priority>
</MsDeployDeclareParameters>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!-- Commit parameterized web.config into pipeline so later phase will pick up-->
<!--********************************************************************-->
<Target Name="_PostTransformWebConfigForAzureAuthentication">
<ItemGroup>
<!--Remove untransformed Web.configs from the pipeline-->
<FilesForPackagingFromProject Remove="@(_WebConfigsToTransformForAzureAuthentication)" Condition="'@(_WebConfigsToTransformForAzureAuthentication)'!='' And !%(_WebConfigsToTransformForAzureAuthentication.Exclude) And Exists(%(_WebConfigsToTransformForAzureAuthentication.TransformOutputFile))"/>
<!--Add the transformed Web.configs at the new loction to the pipeline-->
<FilesForPackagingFromProject Include="@(_WebConfigsToTransformForAzureAuthentication->'%(TransformOutputFile)')" Condition="'@(_WebConfigsToTransformForAzureAuthentication)'!='' And !%(_WebConfigsToTransformForAzureAuthentication.Exclude) And Exists(%(_WebConfigsToTransformForAzureAuthentication.TransformOutputFile))"/>
</ItemGroup>
</Target>
<PropertyGroup>
<_TransformWebConfigForAzureAuthenticationDependsOn>
_TransformWebConfigForAzureAuthenticationCore;
_PostTransformWebConfigForAzureAuthentication;
</_TransformWebConfigForAzureAuthenticationDependsOn>
</PropertyGroup>
<!--********************************************************************-->
<!-- Entry point of parameterizing web.config containing Win Azure Active Directory (WAAD) related artifacts -->
<!--********************************************************************-->
<Target Name="_TransformWebConfigForAzureAuthentication"
DependsOnTargets="$(_TransformWebConfigForAzureAuthenticationDependsOn)"
Condition="('$(WebPublishMethod)' =='MsDeploy' or '$(WebPublishMethod)' =='Package') and '$(EnableADPublish)' =='true'">
</Target>
</Project>

BIN
eng/msbuild/web/Web/Microsoft.Web.XmlTransform.dll

Binary file not shown.

530
eng/msbuild/web/Web/Microsoft.WebSite.Publishing.targets

@ -1,530 +0,0 @@
<!--
***********************************************************************************************
Microsoft.WebDeploy.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process for web deploy projects.
Copyright (C) 2005 Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="FilterByItems" AssemblyFile="$(MSBuildThisFileDirectory)\Microsoft.Web.Publishing.Tasks.dll" Condition="Exists('Microsoft.Web.Publishing.Tasks.dll')"/>
<UsingTask TaskName="CollectFilesinFolder" AssemblyFile="$(MSBuildThisFileDirectory)\Microsoft.Web.Publishing.Tasks.dll" Condition="Exists('Microsoft.Web.Publishing.Tasks.dll')"/>
<UsingTask TaskName="CopyPipelineFiles" AssemblyFile="$(MSBuildThisFileDirectory)\Microsoft.Web.Publishing.Tasks.dll" Condition="Exists('Microsoft.Web.Publishing.Tasks.dll')"/>
<!--***************************************************************-->
<!-- Setting up the property like MS.Common.Targets files has it. -->
<!--This is to handle some project doesn't include the MS.Common.Targets file-->
<!--***************************************************************-->
<PropertyGroup>
<_WebProjectType>WebSite</_WebProjectType>
<OutputPath Condition="'$(OutputPath)' == ''">$([System.IO.Path]::GetTempPath())WebSitePublish\$([System.IO.Path]::GetFileName($(MSBuildProjectDirectory)))-$(MSBuildProjectDirectory.GetHashCode())</OutputPath>
<OutputPath Condition="'$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
<OutDir Condition=" '$(OutDir)' == '' ">$(OutputPath)</OutDir>
<!-- Example, bin\Debug\. Ensure OutDir has a trailing slash, so it can be concatenated -->
<OutDir Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')">$(OutDir)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(BaseIntermediateOutputPath)'=='' ">
<BaseIntermediateOutputPath>$(OutputPath)obj\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath Condition="!HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(IntermediateOutputPath)' == '' ">
<IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' Or '$(PlatformName)' == ''">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
</PropertyGroup>
<Target Name="PrepareResourceNames" />
<Target Name="ComputeIntermediateSatelliteAssemblies" />
<Target Name="GetCopyToOutputDirectoryItems" />
<Target Name="_SGenCheckForOutputs" />
<Target Name="CreateManifestResourceNames" />
<!--
============================================================
Initialial setup
============================================================
-->
<PropertyGroup>
<!-- Make sure OutputPath has a trailing slash on it -->
<WDOutDir Condition="'$(OutDir)' != '$(OutputPath)'">$(OutDir)</WDOutDir>
<CopyBeforeBuildTargetPath Condition="'$(CopyBeforeBuildTargetPath)' == ''">$(IntermediateOutputPath)AspnetCompileMerge\source</CopyBeforeBuildTargetPath>
<_WDPSourceWebPhysicalPath>$(SourceWebPhysicalPath)</_WDPSourceWebPhysicalPath>
<TempBuildDir Condition="'$(TempBuildDir)' == ''" >$(IntermediateOutputPath)TempBuildDir</TempBuildDir>
<_ExcludeAppOffline Condition="'$(_ExcludeAppOffline)' ==''">true</_ExcludeAppOffline>
<_ExcludeWebInfo Condition="'$(_ExcludeWebInfo)' ==''">true</_ExcludeWebInfo>
</PropertyGroup>
<PropertyGroup>
<_SkipHiddenItems Condition="'$(_SkipHiddenItems)'==''">true</_SkipHiddenItems>
</PropertyGroup>
<ItemGroup>
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\App_Data\PublishProfiles\**\*.*"/>
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\*.publishproj"/>
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\app_offline.htm" Condition="'$(_ExcludeAppOffline)'== 'true'"/>
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\Bin\*.refresh" />
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\**\*.exclude" />
<ExcludeFromPackageFiles Include="$(SourceWebPhysicalPath)\**\*.webinfo" Condition="'$(_ExcludeWebInfo)'=='true'" />
</ItemGroup>
<PropertyGroup Condition="'$(SourceWebMetabasePath)' != ''">
<UseIis Condition="'$(UseIis)'==''">True</UseIis>
<IisUrl Condition="'$(IisUrl)'==''">$(SourceWebProjectPath)</IisUrl>
</PropertyGroup>
<PropertyGroup Condition="'$(SourceWebMetabasePath)' == ''">
<UseIis Condition="'$(UseIis)'==''">false</UseIis>
</PropertyGroup>
<!-- Create the output path as an item so that we can use %(FullPath) on it. -->
<!-- _PublishedWebsites folder enables team build scenarios when OutDir is overiden -->
<ItemGroup>
<_WDOutputPathItem Condition="'$(WDOutDir)' != '' and !HasTrailingSlash('$(WDOutDir)')" Include="$(WDOutDir)\_PublishedWebsites\$(MSBuildProjectName)\"/>
<_WDOutputPathItem Condition="'$(WDOutDir)' != '' and HasTrailingSlash('$(WDOutDir)')" Include="$(WDOutDir)_PublishedWebsites\$(MSBuildProjectName)\"/>
<_WDOutputPathItem Condition="'$(WDOutDir)' == ''" Include="$(OutputPath)"/>
<_WDPSourceWebPathItem Include="$(_WDPSourceWebPhysicalPath)"/>
<_KeyFile Include="$(KeyFile)"/>
</ItemGroup>
<!-- AvailablePlatforms is the list of platform targets available. -->
<PropertyGroup>
<AvailablePlatforms>Any CPU</AvailablePlatforms>
</PropertyGroup>
<PropertyGroup>
<WDTargetDir Condition="'$(WDTargetDir)' == ''">$(WDOutDir)\_PublishedWebsites\$(MSBuildProjectName)\</WDTargetDir>
<_FullSourceWebDir>$(_WDPSourceWebPhysicalPath)</_FullSourceWebDir>
<_FullKeyFile Condition="'$(KeyFile)' != ''">@(_KeyFile->'%(FullPath)')</_FullKeyFile>
</PropertyGroup>
<!--
The set of properties passed to the aspnet_compiler when merge is not enabled
-->
<PropertyGroup>
<_AspNetCompilerFixedNames Condition="'$(UseMerge)' != 'true'">$(UseFixedNames)</_AspNetCompilerFixedNames>
<_AspNetCompilerKeyContainer Condition="'$(UseMerge)' != 'true'">$(KeyContainer)</_AspNetCompilerKeyContainer>
<_AspNetCompilerMetabasePath Condition="'$(UseMetabasePath)' == 'true'">$(SourceWebMetabasePath)</_AspNetCompilerMetabasePath>
<_AspNetCompilerSourceWebPath Condition="'$(UseMetabasePath)' != 'true'">$(_FullSourceWebDir)</_AspNetCompilerSourceWebPath>
<_AspNetCompilerVirtualPath Condition="'$(UseMetabasePath)' != 'true'">$(SourceWebVirtualPath)</_AspNetCompilerVirtualPath>
</PropertyGroup>
<PropertyGroup>
<BuildingProject>true</BuildingProject>
</PropertyGroup>
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<!--
============================================================
Basic Hook in for WPP
============================================================
-->
<PropertyGroup>
<WebPublishPipelineProjectDirectory Condition="'$(WebPublishPipelineProjectDirectory)'==''">$(MSBuildProjectDirectory)</WebPublishPipelineProjectDirectory>
<DefaultDeployIisAppPhysicalPath Condition="'$(DefaultDeployIisAppPhysicalPath)'==''">$(MSBuildProjectDirectory)$(DefaultMsDeployAltSuffix)</DefaultDeployIisAppPhysicalPath>
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
<!--We do want to exclude TransformAssistFile-->
<ExcludeTransformAssistFilesFromPublish Condition="'$(ExcludeTransformAssistFilesFromPublish)'==''">True</ExcludeTransformAssistFilesFromPublish>
<ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'=='' And '$(DebugSymbols)' == 'true'">False</ExcludeGeneratedDebugSymbol>
<ProjectParametersXMLFile Condition="'$(ProjectParametersXMLFile)'=='' And Exists('$(MSBuildProjectDirectory)\Parameters.xml')">$(OutputPath)\Parameters.xml</ProjectParametersXMLFile>
<_WDPDefaultIntermediateOutputPathPathRoot Condition="'$(_WPPDefaultIntermediateOutputPathPathRoot)' == ''">$(OutputPath)\</_WDPDefaultIntermediateOutputPathPathRoot>
</PropertyGroup>
<PropertyGroup Condition="'$(_WDPDefaultIntermediateOutputPath)' == ''">
<_WDPDefaultIntermediateOutputPath>$(IntermediateOutputPath)</_WDPDefaultIntermediateOutputPath>
<_WDPDefaultIntermediateOutputPath Condition="!$([System.IO.path]::IsPathRooted($(IntermediateOutputPath)))">$(_WDPDefaultIntermediateOutputPathPathRoot)$(IntermediateOutputPath)</_WDPDefaultIntermediateOutputPath>
</PropertyGroup>
<!--******************************************************-->
<!--Include the WPP targets file-->
<!--******************************************************-->
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />
<Import Project="Microsoft.Web.Publishing.targets" />
<PropertyGroup>
<!--In earlier version of WPP, Web.config transformation doesn't support anthing other than the Msbuild Project project folder to find the web.config-->
<PreTransformWebConfigDependsOn>
$(PreTransformWebConfigDependsOn);
FixupTransformAssistFilesAsExclude;
</PreTransformWebConfigDependsOn>
</PropertyGroup>
<ItemGroup>
<_AllExecutableUnderBin Include="$(SourceWebPhysicalPath)\Bin\*.dll;$(SourceWebPhysicalPath)\Bin\*.exe"/>
<ExcludeFromPackageFiles Include="@(_AllExecutableUnderBin -> '%(RelativeDir)%(FileName).xml')" Condition=" '$(ExcludeXmlAssemblyFiles)'=='true' "/>
</ItemGroup>
<Target Name="FixupTransformAssistFilesAsExclude"
DependsOnTargets="CollectWebConfigsToTransform"
Condition="'$(FixupTransformAssistFilesAsExclude)' != 'False'">
<PropertyGroup>
<_WDP_IdentifyTransformAssistFile>web\.[^\\\.]*\.config$</_WDP_IdentifyTransformAssistFile>
</PropertyGroup>
<!--Find all item with web.*.config-->
<CollectFilesinFolder RootPath="$(WebPublishPipelineProjectDirectory)"
RelativePathMatchs="$(_WDP_IdentifyTransformAssistFile)" >
<Output TaskParameter="Result" ItemName="_WDP_WebConfigAssistFilesToFixupTemp" />
</CollectFilesinFolder>
<FilterByItems PipelineItems="@(FilesForPackagingFromProject)"
Filter="@(_WDP_WebConfigAssistFilesToFixupTemp)">
<Output TaskParameter="InFilter" ItemName="_WDP_WebConfigAssistFilesToFixup"/>
</FilterByItems>
<ItemGroup>
<!--Change all web.*.config to full path and add DependentUpon with Web.config-->
<FilesForPackagingFromProject Remove="@(_WDP_WebConfigAssistFilesToFixup)" />
<FilesForPackagingFromProject Include="@(_WDP_WebConfigAssistFilesToFixup->'$(WebPublishPipelineProjectDirectory)%(Identity)')">
<DependentUpon>Web.config</DependentUpon>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<!--
============================================================
_PrepareForBuild
Sets up variables in preparation to build.
============================================================
-->
<Target Name="_PrepareForBuild">
<!--
Here converting to a property is required because TargetDir and TargetPath are defined
to contain an item list. We want that item list to be expanded so that it can be used
as a regular property value and not as an item-list-with-transform.
-->
<PropertyGroup>
<WDTargetDir>$(WDTargetDir)</WDTargetDir>
</PropertyGroup>
<PropertyGroup>
<_FullSourceWebDir>$(_FullSourceWebDir)</_FullSourceWebDir>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath)" />
</Target>
<!--
============================================================
_CollectFilesForCopyBeforeBuild
Copy the web to a new folder excluding predefined items in @(ExcludeFromBuild)
<ItemGroup>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Test\**\*.*"/>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Images\**\*.*"/>
</ItemGroup>
The following support regular expreesion Exclude For example
<PropertyGroup>
<_WDPExcludeFullPathFromBuildRegEx>$(_WDPExcludeFullPathFromBuildRegEx);C:\\myfoo</_WDPExcludeFullPathFromBuildRegEx>
<_WDPExcludeRelativePathFromBuildRegex>$(_WDPExcludeRelativePathFromBuildRegex);[^\\]*\.scc$;[^\\]*\.vssscc$;[^\\]*\.vspscc$</_WDPExcludeRelativePathFromBuildRegex>
</PropertyGroup>
<CopyBeforeBuildTargetPath Condition="'$(CopyBeforeBuildTargetPath)' == ''">$(IntermediateOutputPath)Source</CopyBeforeBuildTargetPath>
============================================================
-->
<ItemDefinitionGroup>
<_WebFiles>
<DestinationRelativePath></DestinationRelativePath>
<Exclude>False</Exclude>
<FromTarget>Unknown</FromTarget>
<Category>Run</Category>
<ProjectFileType>Default</ProjectFileType>
</_WebFiles>
</ItemDefinitionGroup>
<Target Name="_CollectFilesForCopyBeforeBuild"
DependsOnTargets="$(_CollectFilesForCopyBeforeBuildDependsOn)">
<!--********************************************************************-->
<!-- Enforce that all items have these metadata values -->
<!-- Default for Exclude is False -->
<!--********************************************************************-->
<CollectFilesinFolder RootPath="$(_WDPSourceWebPhysicalPath)"
ExcludeFullPathMatchs="$(_WDPExcludeFullPathFromBuildRegEx)"
ExcludeRelativePathMatchs="$(_WDPExcludeRelativePathFromBuildRegex)">
<Output TaskParameter="Result" ItemName="_WebFilesNoMetadata" />
</CollectFilesinFolder>
<PropertyGroup>
<_OriginalSourceWebPhysicalFullPath>$([System.IO.Path]::GetFullPath($(SourceWebPhysicalPath)))</_OriginalSourceWebPhysicalFullPath>
<_OriginalSourceWebPhysicalFullPath Condition="!HasTrailingSlash('$(_OriginalSourceWebPhysicalFullPath)')">$(_OriginalSourceWebPhysicalFullPath)\</_OriginalSourceWebPhysicalFullPath>
</PropertyGroup>
<!-- For Team Build scenarios when WAP is used the exclude may be different from the source path -->
<ItemGroup Condition ="'$(_WDPSourceWebPhysicalPath)' != '$(SourceWebPhysicalPath)'">
<_WebFilesExclude Include="%(ExcludeFromBuild.Identity)">
<SourceRelativePath Condition="$([System.String]::new(%(ExcludeFromBuild.FullPath)).StartsWith($(_OriginalSourceWebPhysicalFullPath), StringComparison.OrdinalIgnoreCase ))" >$([System.String]::new(%(ExcludeFromBuild.FullPath)).SubString($(_OriginalSourceWebPhysicalFullPath.Length)))</SourceRelativePath>
</_WebFilesExclude>
<_WebFilesExclude Condition="'%(SourceRelativePath)'==''">
<SourceRelativePath>%(Identity)</SourceRelativePath>
</_WebFilesExclude>
<_WebFilesNoMetadata Remove="%(_WebFilesExclude.SourceRelativePath)" Condition="'%(_WebFilesExclude.SourceRelativePath)' != ''"/>
</ItemGroup>
<!-- Log debug for potential issue -->
<WriteLinesToFile Condition ="$(EnablePackageProcessLoggingAndAssert) And '$(_WDPSourceWebPhysicalPath)' != '$(SourceWebPhysicalPath)'"
Encoding="utf-8"
File="$(IntermediateOutputPath)\_WebFilesExclude.txt"
Lines="@(_WebFilesExclude->'
Files:%(Identity)
SourceRelativePath:%(SourceRelativePath)')"
Overwrite="True" />
<!-- _WebFilesNoMetadata doesn't have metadata yet, need to fill the data. Fill in the metadata now for CopyPipelineFiles to use -->
<ItemGroup>
<_WebFiles Include="$([System.IO.Path]::Combine($(_WDPSourceWebPhysicalPath), %(_WebFilesNoMetadata.Identity)))" >
<DestinationRelativePath>%(_WebFilesNoMetadata.Identity)</DestinationRelativePath>
</_WebFiles>
</ItemGroup>
<!-- For backwards compatability -->
<ItemGroup Condition ="'$(_WDPSourceWebPhysicalPath)' == '$(SourceWebPhysicalPath)'">
<_WebFiles Remove="@(ExcludeFromBuild)" />
</ItemGroup>
<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(IntermediateOutputPath)\webfilesToBeCopied.txt"
Lines="@(_WebFiles->'
Files:%(Identity)
FromTarget:%(FromTarget)
DestinationRelativePath:%(DestinationRelativePath)')"
Overwrite="True" />
</Target>
<Target Name="_CopyBeforeBuild"
Condition=" '$(EnableCopyBeforeBuild)' == 'true' or '@(ExcludeFromBuild)' != '' "
DependsOnTargets="_CollectFilesForCopyBeforeBuild">
<ItemGroup>
<_WDPAllExtraFilesUnderTempFolder Condition="'$(CopyBeforeBuildTargetPath)' != ''" Include="$(CopyBeforeBuildTargetPath)\**" />
<_WDPAllExtraFilesUnderTempFolder
Remove="@(FilesForPackagingFromProject->'$(CopyBeforeBuildTargetPath)\%(DestinationRelativePath)')" />
</ItemGroup>
<!-- Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject) -->
<Delete Files="@(_WDPAllExtraFilesUnderTempFolder)" />
<!-- This method supports incremental copy, instead of a full copy everytime -->
<!-- We've already expanded the path as relative path to the project. There is no need for sourceDirectory -->
<CopyPipelineFiles PipelineItems="@(_WebFiles)"
SourceDirectory="$(MSBuildProjectDirectory)"
TargetDirectory="$(CopyBeforeBuildTargetPath)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="False"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="UpdatedPipelineItems" ItemName="_WebFilesCopied"/>
</CopyPipelineFiles>
<PropertyGroup>
<_AspNetCompilerSourceWebPath>$(CopyBeforeBuildTargetPath)</_AspNetCompilerSourceWebPath>
</PropertyGroup>
</Target>
<!--
============================================================
Clean
============================================================
-->
<Target Name="Clean">
<PropertyGroup>
<Clean>true</Clean>
</PropertyGroup>
<RemoveDir Condition="Exists('$(CopyBeforeBuildTargetPath)')" Directories="$(CopyBeforeBuildTargetPath)"/>
<RemoveDir Condition="Exists('$(TempBuildDir)')" Directories="$(TempBuildDir)" />
<RemoveDir Condition="Exists('$(WDTargetDir)')" Directories="$(WDTargetDir)" />
</Target>
<!--
============================================================
Reference Resolving
Updates the bin folder with the lastest .refresh files
============================================================
-->
<Target Name="_ResolveAssemblyReferencesWithRefreshFile" DependsOnTargets="_PrepareForBuild">
<ItemGroup>
<References_RefreshFile Include="$(_FullSourceWebDir)\Bin\*.refresh"/>
</ItemGroup>
<ReadLinesFromFile File="%(References_RefreshFile.Identity)" Condition=" '%(References_RefreshFile.Identity)' != '' ">
<Output TaskParameter="Lines" ItemName="References_ReferenceRelPath" />
</ReadLinesFromFile>
<CombinePath BasePath="$(_FullSourceWebDir)" Paths="@(References_ReferenceRelPath)">
<Output TaskParameter="CombinedPaths" ItemName="References" />
</CombinePath>
<Copy
SourceFiles="@(References->'%(FullPath)')"
DestinationFolder="$(_FullSourceWebDir)\Bin\"
Condition="!Exists('%(References.Identity)')"
ContinueOnError="true"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--
============================================================
AfterResolveReferences
============================================================
-->
<Target Name="AfterResolveReferences">
<Copy SourceFiles="@(ReferencePath->'%(FullPath)')"
DestinationFolder="$(_FullSourceWebDir)\Bin\"
ContinueOnError="true"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
DestinationFolder="$(_FullSourceWebDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceCopyLocalPaths)"
DestinationFiles="@(ReferenceCopyLocalPaths->'$(_FullSourceWebDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--
============================================================
Build
The main build entry point.
============================================================
-->
<PropertyGroup>
<BuildDependsOn>
_PrepareForBuild;
ResolveProjectReferences;
_ResolveAssemblyReferencesWithRefreshFile;
ResolveReferences;
_CopyBeforeBuild;
</BuildDependsOn>
<PipelineDeployPhaseAfterTargets Condition="'$(DeployOnBuild)'=='True'">_CopyBeforeBuild</PipelineDeployPhaseAfterTargets>
</PropertyGroup>
<Target
Name="Build"
DependsOnTargets="$(BuildDependsOn)" />
<!--
============================================================
CopyToOutputDir
From the temp building location copy the output to the actual oput dir
============================================================
-->
<ItemDefinitionGroup>
<_WDPOutputFiles>
<DestinationRelativePath></DestinationRelativePath>
<Exclude>False</Exclude>
<FromTarget>Unknown</FromTarget>
<Category>Run</Category>
<ProjectFileType>Default</ProjectFileType>
</_WDPOutputFiles>
</ItemDefinitionGroup>
<Target Name="_CollectFilesForCopyToOutputDir"
DependsOnTargets="$(_CollectFilesForCopyToOutputDirDependsOn)">
<PropertyGroup>
<_TempDirFullPath>$(MSBuildProjectDirectory)\$(TempBuildDir)</_TempDirFullPath>
</PropertyGroup>
<MakeDir Directories="$(_TempDirFullPath)" />
<!--********************************************************************-->
<!-- Enforce that all items have these metadata values -->
<!-- Default for Exclude is False -->
<!--********************************************************************-->
<CollectFilesinFolder RootPath="$(_TempDirFullPath)"
ExcludeFullPathMatchs="$(_WDPExcludeFullPathToOutputDirRegEx)"
ExcludeRelativePathMatchs="$(_WDPExcludeRelativePathToOutputDirRegex)">
<Output TaskParameter="Result" ItemName="_WDPOutputFilesNoMetadata" />
</CollectFilesinFolder>
<!-- _WDPOutputFilesNoMetadata doesn't have metadata yet, need to fill the data. Fill in the metadata now for CopyPipelineFiles to use -->
<ItemGroup>
<_WDPOutputFiles Include="@(_WDPOutputFilesNoMetadata)" >
<DestinationRelativePath>%(_WDPOutputFilesNoMetadata.Identity)</DestinationRelativePath>
</_WDPOutputFiles>
</ItemGroup>
<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(IntermediateOutputPath)\WDPOutputFilesToBeCopied.txt"
Lines="@(_WDPOutputFiles->'
Files:%(Identity)
FromTarget:%(FromTarget)
DestinationRelativePath:%(DestinationRelativePath)')"
Overwrite="True" />
</Target>
<PropertyGroup>
<_CopyToOutputDirDependsOn>
$(_CopyToOutputDirDependsOn);
CoreCopyToOutputDir;
CleanTempBuildDir
</_CopyToOutputDirDependsOn>
</PropertyGroup>
<Target Name="CopyToOutputDir" DependsOnTargets="$(_CopyToOutputDirDependsOn)"/>
<Target Name="CoreCopyToOutputDir"
Condition=" '$(CopyToOutputDir)' != 'False'"
DependsOnTargets="_CollectFilesForCopyToOutputDir">
<ItemGroup>
<_WDPAllExtraFilesUnderTargetDir Condition="'$(WDTargetDir)' != ''" Include="$(WDTargetDir)\**" />
<_WDPAllExtraFilesUnderTargetDir
Remove="@(_WDPOutputFiles->'$(WDTargetDir)\%(DestinationRelativePath)')" />
</ItemGroup>
<!-- Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject -->
<Delete Files="@(_WDPAllExtraFilesUnderTargetDir)" />
<!-- This method supports incremental copy, instead of a full copy everytime -->
<!-- @(_WDPOutputFiles) contain relative path to $(TempBuildDir), pass in sourceDirectory -->
<CopyPipelineFiles PipelineItems="@(_WDPOutputFiles)"
SourceDirectory="$(TempBuildDir)"
TargetDirectory="$(WDTargetDir)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="False"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="UpdatedPipelineItems" ItemName="_WDPOutputFilesCopied"/>
</CopyPipelineFiles>
</Target>
<!--
============================================================
CleanTempBuildDir
Clean Temp Build Dir
============================================================
-->
<Target Name="CleanTempBuildDir"
Condition="'$(CleanTempBuildDir)' == 'True'">
<RemoveDir Directories="$(TempBuildDir)" />
</Target>
<!--
This is required for setup project support
-->
<Target Name="BuiltProjectOutputGroup" DependsOnTargets="_PrepareForBuild">
<ItemGroup>
<_BuiltProjectOutputGroupOutput Include="$(WDTargetDir)**\*.*"/>
<BuiltProjectOutputGroupOutput Include="@(_BuiltProjectOutputGroupOutput)">
<TargetPath>%(_BuiltProjectOutputGroupOutput.SubFolder)%(_BuiltProjectOutputGroupOutput.RecursiveDir)%(Filename)%(Extension)</TargetPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Target>
</Project>

101
eng/msbuild/web/Web/Powershell/1.0.1/default-publish.ps1

@ -1,101 +0,0 @@
[cmdletbinding(SupportsShouldProcess=$true)]
param($publishProperties, $packOutput, $nugetUrl)
# to learn more about this file visit http://go.microsoft.com/fwlink/?LinkId=524327
$publishModuleVersion = '1.0.1'
function Get-VisualStudio2015InstallPath{
[cmdletbinding()]
param()
process{
$keysToCheck = @('hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0',
'hklm:\SOFTWARE\Microsoft\VisualStudio\14.0',
'hklm:\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\14.0',
'hklm:\SOFTWARE\Microsoft\VWDExpress\14.0'
)
[string]$vsInstallPath=$null
foreach($keyToCheck in $keysToCheck){
if(Test-Path $keyToCheck){
$vsInstallPath = (Get-itemproperty $keyToCheck -Name InstallDir -ErrorAction SilentlyContinue | select -ExpandProperty InstallDir -ErrorAction SilentlyContinue)
}
if($vsInstallPath){
break;
}
}
$vsInstallPath
}
}
$vsInstallPath = Get-VisualStudio2015InstallPath
$publishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath,'1.0.1'
if(!(Test-Path $publishModulePath)){
$publishModulePath = "{0}VWDExpressExtensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath,'1.0.1'
}
$defaultPublishSettings = New-Object psobject -Property @{
LocalInstallDir = $publishModulePath
}
function Enable-PackageDownloader{
[cmdletbinding()]
param(
$toolsDir = "$env:LOCALAPPDATA\Microsoft\Web Tools\Publish\package-downloader-$publishModuleVersion\",
$pkgDownloaderDownloadUrl = 'http://go.microsoft.com/fwlink/?LinkId=524325') # package-downloader.psm1
process{
if(get-module package-downloader){
remove-module package-downloader | Out-Null
}
if(!(get-module package-downloader)){
if(!(Test-Path $toolsDir)){ New-Item -Path $toolsDir -ItemType Directory -WhatIf:$false }
$expectedPath = (Join-Path ($toolsDir) 'package-downloader.psm1')
if(!(Test-Path $expectedPath)){
'Downloading [{0}] to [{1}]' -f $pkgDownloaderDownloadUrl,$expectedPath | Write-Verbose
(New-Object System.Net.WebClient).DownloadFile($pkgDownloaderDownloadUrl, $expectedPath)
}
if(!$expectedPath){throw ('Unable to download package-downloader.psm1')}
'importing module [{0}]' -f $expectedPath | Write-Output
Import-Module $expectedPath -DisableNameChecking -Force
}
}
}
function Enable-PublishModule{
[cmdletbinding()]
param()
process{
if(get-module publish-module){
remove-module publish-module | Out-Null
}
if(!(get-module publish-module)){
$localpublishmodulepath = Join-Path $defaultPublishSettings.LocalInstallDir 'publish-module.psm1'
if(Test-Path $localpublishmodulepath){
'importing module [publish-module="{0}"] from local install dir' -f $localpublishmodulepath | Write-Verbose
Import-Module $localpublishmodulepath -DisableNameChecking -Force
$true
}
}
}
}
try{
if (!(Enable-PublishModule)){
Enable-PackageDownloader
Enable-NuGetModule -name 'publish-module' -version $publishModuleVersion -nugetUrl $nugetUrl
}
'Calling Publish-AspNet' | Write-Verbose
# call Publish-AspNet to perform the publish operation
Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput
}
catch{
"An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error
}

13
eng/msbuild/web/Web/Powershell/1.0.1/filesystem.pubxml

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<WebRoot>wwwroot</WebRoot>
<publishUrl>$(OutDir)\$(Configuration)\PublishOutput</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>

13
eng/msbuild/web/Web/Powershell/1.0.1/package.pubxml

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<WebRoot>wwwroot</WebRoot>
<DesktopBuildPackageLocation>$(OutDir)\$(Configuration)\MSDeployPackage\$(MSBuildProjectName).zip</DesktopBuildPackageLocation>
<DeployIisAppPath>Default Web Site</DeployIisAppPath>
</PropertyGroup>
</Project>

658
eng/msbuild/web/Web/Powershell/1.0.1/publish-module.psm1

@ -1,658 +0,0 @@
[cmdletbinding(SupportsShouldProcess=$true)]
param()
$script:AspNetPublishHandlers = @{}
$global:AspNetPublishSettings = New-Object -TypeName PSCustomObject @{
MsdeployDefaultProperties = @{
'MSDeployUseChecksum'=$false
'WebRoot'='wwwroot'
'SkipExtraFilesOnServer'=$true
'retryAttempts' = 2
'EnableMSDeployBackup' = $false
'DeleteExistingFiles' = $false
'MSDeployPackageContentFoldername'='website\'
}
}
function Register-AspnetPublishHandler{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0)]
$name,
[Parameter(Mandatory=$true,Position=1)]
[ScriptBlock]$handler,
[switch]$force
)
process{
if(!($script:AspNetPublishHandlers[$name]) -or $force ){
'Adding handler for [{0}]' -f $name | Write-Verbose
$script:AspNetPublishHandlers[$name] = $handler
}
elseif(!($force)){
'Ignoring call to Register-AspnetPublishHandler for [name={0}], because a handler with that name exists and -force was not passed.' -f $name | Write-Verbose
}
}
}
function Get-AspnetPublishHandler{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0)]
$name
)
process{
$foundHandler = $script:AspNetPublishHandlers[$name]
if(!$foundHandler){
throw ('AspnetPublishHandler with name "{0}" was not found' -f $name)
}
$foundHandler
}
}
function GetInternal-ExcludeFilesArg{
[cmdletbinding()]
param(
$publishProperties
)
process{
$excludeFiles = $publishProperties['ExcludeFiles']
foreach($exclude in $excludeFiles){
if($exclude){
[string]$objName = $exclude['objectname']
if([string]::IsNullOrEmpty($objName)){
$objName = 'filePath'
}
$excludePath = $exclude['absolutepath']
# output the result to the return list
('-skip:objectName={0},absolutePath={1}' -f $objName, $excludePath)
}
}
}
}
function GetInternal-ReplacementsMSDeployArgs{
[cmdletbinding()]
param(
$publishProperties
)
process{
foreach($replace in ($publishProperties['Replacements'])){
if($replace){
$typeValue = $replace['type']
if(!$typeValue){ $typeValue = 'TextFile' }
$file = $replace['file']
$match = $replace['match']
$newValue = $replace['newValue']
if($file -and $match -and $newValue){
$setParam = ('-setParam:type={0},scope={1},match={2},value={3}' -f $typeValue,$file, $match,$newValue)
'Adding setparam [{0}]' -f $setParam | Write-Verbose
# return it
$setParam
}
else{
'Skipping replacement because its missing a required value.[file="{0}",match="{1}",newValue="{2}"]' -f $file,$match,$newValue | Write-Verbose
}
}
}
}
}
<#
.SYNOPSIS
Returns an array of msdeploy arguments that are used across different providers.
For example this wil handle useChecksum, appOffline, etc.
This will also add default properties if they are missing.
#>
function GetInternal-SharedMSDeployParametersFrom{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0)]
$publishProperties
)
process{
$sharedArgs = New-Object psobject -Property @{
ExtraArgs = @()
DestFragment = ''
}
# add default properties if they are missing
foreach($propName in $global:AspNetPublishSettings.MsdeployDefaultProperties.Keys){
if($publishProperties["$propName"] -eq $null){
$defValue = $global:AspNetPublishSettings.MsdeployDefaultProperties["$propName"]
'Adding default property to publishProperties ["{0}"="{1}"]' -f $propName,$defValue | Write-Verbose
$publishProperties["$propName"] = $defValue
}
}
if($publishProperties['MSDeployUseChecksum'] -eq $true){
$sharedArgs.ExtraArgs += '-usechecksum'
}
if($publishProperties['WebPublishMethod'] -eq 'MSDeploy'){
$offlineArgs = GetInternal-PublishAppOfflineProperties -publishProperties $publishProperties
$sharedArgs.ExtraArgs += $offlineArgs.AdditionalArguments
$sharedArgs.DestFragment += $offlineArgs.DestFragment
if($publishProperties['SkipExtraFilesOnServer'] -eq $true){
$sharedArgs.ExtraArgs += '-enableRule:DoNotDeleteRule'
}
}
if($publishProperties['WebPublishMethod'] -eq 'FileSystem'){
if($publishProperties['DeleteExistingFiles'] -eq $false){
$sharedArgs.ExtraArgs += '-enableRule:DoNotDeleteRule'
}
}
if($publishProperties['retryAttempts']){
$sharedArgs.ExtraArgs += ('-retryAttempts:{0}' -f ([int]$publishProperties['retryAttempts']))
}
if($publishProperties['EncryptWebConfig'] -eq $true){
$sharedArgs.ExtraArgs += '-EnableRule:EncryptWebConfig'
}
if($publishProperties['EnableMSDeployBackup'] -eq $false){
$sharedArgs.ExtraArgs += '-disablerule:BackupRule'
}
# add excludes
$sharedArgs.ExtraArgs += (GetInternal-ExcludeFilesArg -publishProperties $publishProperties)
# add replacements
$sharedArgs.ExtraArgs += (GetInternal-ReplacementsMSDeployArgs -publishProperties $publishProperties)
# return the args
$sharedArgs
}
}
<#
.SYNOPSIS
This will publish the folder based on the properties in $publishProperties
.EXAMPLE
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='MSDeploy'
'MSDeployServiceURL'='contoso.scm.azurewebsites.net:443';`
'DeployIisAppPath'='contoso';'Username'='$contoso';'Password'="$env:PublishPwd"}
.EXAMPLE
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='FileSystem'
'publishUrl'="$publishDest"
}
.EXAMPLE
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='MSDeploy'
'MSDeployServiceURL'='contoso.scm.azurewebsites.net:443';`
'DeployIisAppPath'='contoso';'Username'='$contoso';'Password'="$env:PublishPwd"
'ExcludeFiles'=@(
@{'absolutepath'='wwwroot\\test.txt'},
@{'absolutepath'='wwwroot\\_references.js'}
)}
.EXAMPLE
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='FileSystem'
'publishUrl'="$publishDest"
'ExcludeFiles'=@(
@{'absolutepath'='wwwroot\\test.txt'},
@{'absolutepath'='wwwroot\\_references.js'})
'Replacements' = @(
@{'file'='test.txt$';'match'='REPLACEME';'newValue'='updatedValue'})
}
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='FileSystem'
'publishUrl'="$publishDest"
'ExcludeFiles'=@(
@{'absolutepath'='wwwroot\\test.txt'},
@{'absolutepath'='c:\\full\\path\\ok\\as\\well\\_references.js'})
'Replacements' = @(
@{'file'='test.txt$';'match'='REPLACEME';'newValue'='updatedValue'})
}
.EXAMPLE
Publish-AspNet -packOutput $packOutput -publishProperties @{
'WebPublishMethod'='FileSystem'
'publishUrl'="$publishDest"
'EnableMSDeployAppOffline'='true'
'AppOfflineTemplate'='offline-template.html'
'MSDeployUseChecksum'='true'
}
#>
function Publish-AspNet{
[cmdletbinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
process{
if($publishProperties['WebPublishMethodOverride']){
'Overriding publish method from $publishProperties[''WebPublishMethodOverride''] to [{0}]' -f ($publishProperties['WebPublishMethodOverride']) | Write-Verbose
$publishProperties['WebPublishMethod'] = $publishProperties['WebPublishMethodOverride']
}
if(!([System.IO.Path]::IsPathRooted($packOutput))){
$packOutput = [System.IO.Path]::GetFullPath((Join-Path $pwd $packOutput))
}
$pubMethod = $publishProperties['WebPublishMethod']
'Publishing with publish method [{0}]' -f $pubMethod | Write-Output
# get the handler based on WebPublishMethod, and call it.
&(Get-AspnetPublishHandler -name $pubMethod) $publishProperties $packOutput
}
}
function Publish-AspNetMSDeploy{
[cmdletbinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
process{
if($publishProperties){
$publishPwd = $publishProperties['Password']
<#
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:IisApp='C:\Users\contoso\AppData\Local\Temp\AspNetPublish\WebApplication1\wwwroot'
-dest:IisApp='vramak4',ComputerName='https://contoso.scm.azurewebsites.net/msdeploy.axd',UserName='$contoso',Password='<PWD>',IncludeAcls='False',AuthType='Basic'
-verb:sync
-enableRule:DoNotDeleteRule
-enableLink:contentLibExtension
-retryAttempts=2
-userAgent="VS14.0:PublishDialog:WTE14.0.51027.0"
#>
$sharedArgs = GetInternal-SharedMSDeployParametersFrom -publishProperties $publishProperties
# WebRoot is a required property which has a default
$webroot = $publishProperties['WebRoot']
$webrootOutputFolder = (get-item (Join-Path $packOutput $webroot)).FullName
$publishArgs = @()
$publishArgs += ('-source:IisApp=''{0}''' -f "$webrootOutputFolder")
$publishArgs += ('-dest:IisApp=''{0}'',ComputerName=''{1}'',UserName=''{2}'',Password=''{3}'',IncludeAcls=''False'',AuthType=''Basic''{4}' -f
$publishProperties['DeployIisAppPath'],
(Get-MSDeployFullUrlFor -msdeployServiceUrl $publishProperties['MSDeployServiceURL']),
$publishProperties['UserName'],
$publishPwd,
$sharedArgs.DestFragment)
$publishArgs += '-verb:sync'
$publishArgs += '-enableLink:contentLibExtension'
$publishArgs += $sharedArgs.ExtraArgs
$command = '"{0}" {1}' -f (Get-MSDeploy),($publishArgs -join ' ')
if (! [String]::IsNullOrEmpty($publishPwd)) {
$command.Replace($publishPwd,'{PASSWORD-REMOVED-FROM-LOG}') | Print-CommandString
}
Execute-Command -exePath (Get-MSDeploy) -arguments ($publishArgs -join ' ')
}
else{
throw 'publishProperties is empty, cannot publish'
}
}
}
function Escape-TextForRegularExpressions{
[cmdletbinding()]
param(
[Parameter(Position=0,Mandatory=$true)]
[string]$text
)
process{
# TODO: Get code from EscapeTextForRegularExpressions task
$text.Replace('\','\\')
}
}
function Publish-AspNetMSDeployPackage{
[cmdletbinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
process{
if($publishProperties){
$packageDestFilepah = $publishProperties['DesktopBuildPackageLocation']
if(!$packageDestFilepah){
throw ('The package destination property (DesktopBuildPackageLocation) was not found in the publish properties')
}
if(!([System.IO.Path]::IsPathRooted($packageDestFilepah))){
$packageDestFilepah = [System.IO.Path]::GetFullPath((Join-Path $pwd $packageDestFilepah))
}
# if the dir doesn't exist create it
$pkgDir = ((new-object -typename System.IO.FileInfo($packageDestFilepah)).Directory)
if(!($pkgDir.Exists)) {
$pkgDir.Create() | Out-Null
}
<#
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:IisApp='C:\Users\contoso\AppData\Local\Temp\AspNetPublish\WebApplication1\wwwroot'
-dest:package=c:\temp\path\contosoweb.zip
-verb:sync
-enableRule:DoNotDeleteRule
-enableLink:contentLibExtension
-retryAttempts=2
#>
$sharedArgs = GetInternal-SharedMSDeployParametersFrom -publishProperties $publishProperties
# WebRoot is a required property which has a default
$webroot = $publishProperties['WebRoot']
$webrootOutputFolder = (get-item (Join-Path $packOutput $webroot)).FullName
$publishArgs = @()
$publishArgs += ('-source:IisApp=''{0}''' -f "$webrootOutputFolder")
$publishArgs += ('-dest:package=''{0}''' -f $packageDestFilepah)
$publishArgs += '-verb:sync'
$publishArgs += '-enableLink:contentLibExtension'
$packageContentFolder = $publishProperties['MSDeployPackageContentFoldername']
if(!$packageContentFolder){ $packageContentFolder = 'website' }
$publishArgs += ('-replace:match=''{0}'',replace=''{1}''' -f (Escape-TextForRegularExpressions $packOutput), $packageContentFolder )
$publishArgs += $sharedArgs.ExtraArgs
$command = '"{0}" {1}' -f (Get-MSDeploy),($publishArgs -join ' ')
$command | Print-CommandString
Execute-Command -exePath (Get-MSDeploy) -arguments ($publishArgs -join ' ')
}
else{
throw 'publishProperties is empty, cannot publish'
}
}
}
<#
.SYNOPSIS
If the passed in $publishProperties has values for appOffline the
needed arguments will be in the return object. If there is no such configuraion
then nothing is returned.
#>
function GetInternal-PublishAppOfflineProperties{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0)]
$publishProperties
)
process{
$extraArg = '';
$destFragment = ''
if($publishProperties['EnableMSDeployAppOffline'] -eq $true){
$extraArg = '-enablerule:AppOffline'
$appOfflineTemplate = $publishProperties['AppOfflineTemplate']
if($appOfflineTemplate){
$destFragment = (',appOfflineTemplate="{0}"' -f $appOfflineTemplate)
}
}
# return an object with both the properties that need to be in the command.
New-Object psobject -Property @{
AdditionalArguments = $extraArg
DestFragment = $destFragment
}
}
}
function Publish-AspNetFileSystem{
[cmdletbinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
process{
$pubOut = $publishProperties['publishUrl']
if([string]::IsNullOrWhiteSpace($pubOut)){
throw ('publishUrl is a required property for FileSystem publish but it was empty.')
}
# if it's a relative path then update it to a full path
if(!([System.IO.Path]::IsPathRooted($pubOut))){
$pubOut = [System.IO.Path]::GetFullPath((Join-Path $pwd $pubOut))
$publishProperties['publishUrl'] = "$pubOut"
}
'Publishing files to {0}' -f $pubOut | Write-Output
# we use msdeploy.exe because it supports incremental publish/skips/replacements/etc
# msdeploy.exe -verb:sync -source:contentPath='C:\srcpath' -dest:contentPath='c:\destpath'
$sharedArgs = GetInternal-SharedMSDeployParametersFrom -publishProperties $publishProperties
$publishArgs = @()
$publishArgs += ('-source:contentPath=''{0}''' -f "$packOutput")
$publishArgs += ('-dest:contentPath=''{0}''{1}' -f "$pubOut",$sharedArgs.DestFragment)
$publishArgs += '-verb:sync'
$publishArgs += $sharedArgs.ExtraArgs
$command = '"{0}" {1}' -f (Get-MSDeploy),($publishArgs -join ' ')
$command | Print-CommandString
Execute-Command -exePath (Get-MSDeploy) -arguments ($publishArgs -join ' ')
}
}
function Print-CommandString{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
$command
)
process{
'Executing command [{0}]' -f $command | Write-Output
}
}
function Execute-CommandString{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline=$true)]
[string[]]$command,
[switch]
$useInvokeExpression,
[switch]
$ignoreErrors
)
process{
foreach($cmdToExec in $command){
'Executing command [{0}]' -f $cmdToExec | Write-Verbose
if($useInvokeExpression){
try {
Invoke-Expression -Command $cmdToExec
}
catch {
if(-not $ignoreErrors){
$msg = ('The command [{0}] exited with exception [{1}]' -f $cmdToExec, $_.ToString())
throw $msg
}
}
}
else {
cmd.exe /D /C $cmdToExec
if(-not $ignoreErrors -and ($LASTEXITCODE -ne 0)){
$msg = ('The command [{0}] exited with code [{1}]' -f $cmdToExec, $LASTEXITCODE)
throw $msg
}
}
}
}
}
function Execute-Command {
[cmdletbinding()]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
[String]$exePath,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
[String]$arguments
)
process{
$psi = New-Object -TypeName System.Diagnostics.ProcessStartInfo
$psi.CreateNoWindow = $true
$psi.UseShellExecute = $false
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError=$true
$psi.FileName = $exePath
$psi.Arguments = $arguments
$process = New-Object -TypeName System.Diagnostics.Process
$process.StartInfo = $psi
$process.EnableRaisingEvents=$true
# Register the event handler for error
$stdErrEvent = Register-ObjectEvent -InputObject $process -EventName 'ErrorDataReceived' -Action {
if (! [String]::IsNullOrEmpty($EventArgs.Data)) {
$EventArgs.Data | Write-Error
}
}
# Starting process.
[Void]$process.Start()
$process.BeginErrorReadLine()
$output = $process.StandardOutput.ReadToEnd()
[Void]$process.WaitForExit()
$output | Write-Output
# UnRegister the event handler for error
Unregister-Event -SourceIdentifier $stdErrEvent.Name
}
}
function Get-MSDeploy{
[cmdletbinding()]
param()
process{
$installPath = $env:msdeployinstallpath
if(!$installPath){
$keysToCheck = @('hklm:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3','hklm:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2','hklm:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1')
foreach($keyToCheck in $keysToCheck){
if(Test-Path $keyToCheck){
$installPath = (Get-itemproperty $keyToCheck -Name InstallPath -ErrorAction SilentlyContinue | select -ExpandProperty InstallPath -ErrorAction SilentlyContinue)
}
if($installPath){
break;
}
}
}
if(!$installPath){
throw "Unable to find msdeploy.exe, please install it and try again"
}
[string]$msdInstallLoc = (join-path $installPath 'msdeploy.exe')
"Found msdeploy.exe at [{0}]" -f $msdInstallLoc | Write-Verbose
$msdInstallLoc
}
}
function Get-MSDeployFullUrlFor{
[cmdletbinding()]
param($msdeployServiceUrl)
process{
# Convert contoso.scm.azurewebsites.net:443 to https://contoso.scm.azurewebsites.net/msdeploy.axd
# TODO: This needs to be improved, it only works with Azure Websites currently.
'https://{0}/msdeploy.axd' -f $msdeployServiceUrl.TrimEnd(':443')
}
}
function InternalRegister-AspNetKnownPublishHandlers{
[cmdletbinding()]
param()
process{
'Registering MSDeploy handler' | Write-Verbose
Register-AspnetPublishHandler -name 'MSDeploy' -force -handler {
[cmdletbinding()]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
Publish-AspNetMSDeploy -publishProperties $publishProperties -packOutput $packOutput
}
'Registering MSDeploy package handler' | Write-Verbose
Register-AspnetPublishHandler -name 'Package' -force -handler {
[cmdletbinding()]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
Publish-AspNetMSDeployPackage -publishProperties $publishProperties -packOutput $packOutput
}
'Registering FileSystem handler' | Write-Verbose
Register-AspnetPublishHandler -name 'FileSystem' -force -handler {
[cmdletbinding()]
param(
[Parameter(Mandatory = $true,Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
$publishProperties,
[Parameter(Mandatory = $true,Position=1,ValueFromPipelineByPropertyName=$true)]
$packOutput
)
Publish-AspNetFileSystem -publishProperties $publishProperties -packOutput $packOutput
}
}
}
<#
.SYNOPSIS
Used for testing purposes only.
#>
function InternalReset-AspNetPublishHandlers{
[cmdletbinding()]
param()
process{
$script:AspNetPublishHandlers = @{}
InternalRegister-AspNetKnownPublishHandlers
}
}
Export-ModuleMember -function Get-*,Publish-*,Register-*,Enable-*
if($env:IsDeveloperMachine){
# you can set the env var to expose all functions to importer. easy for development.
# this is required for executing pester test cases, it's set by build.ps1
Export-ModuleMember -function *
}
# register the handlers so that Publish-AspNet can be called
InternalRegister-AspNetKnownPublishHandlers

774
eng/msbuild/web/Web/Transform/Microsoft.Web.Publishing.AspNetCompileMerge.targets

@ -1,774 +0,0 @@
<!--
***********************************************************************************************
Microsoft.Web.Publishing.AspNetCompileMerge.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard package/publish process for Tranform the list of file
through the aspnet_compile and aspnet_merge. It will dramaticaly change the content in the list.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Import task from our dll-->
<UsingTask TaskName="GetPublishingLocalizedString" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CopyPipelineFiles" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll" />
<UsingTask TaskName="AspNetMerge" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GetProjectProperties" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="FilterByItems" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="GenerateAssemblyInfo" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<UsingTask TaskName="CheckItemsCount" AssemblyFile="..\Microsoft.Web.Publishing.Tasks.dll"/>
<!--ImportBefore Extension-->
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftWebPublishingTransformTargets Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingTransformTargets)'==''">true</ImportByWildcardBeforeMicrosoftWebPublishingTransformTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftWebPublishingTransformTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportBefore')"/>
<PropertyGroup>
<Microsoft_Web_Publishing_AspNetCompileMerge_targets_Imported>True</Microsoft_Web_Publishing_AspNetCompileMerge_targets_Imported>
</PropertyGroup>
<!--********************************************************************-->
<!--Enforce all item have these metadata value for all pipeline metadata-->
<!--Default for Exclude is False-->
<!--********************************************************************-->
<ItemDefinitionGroup>
<_AspnetCompileMergePrecompiledOutput>
<DestinationRelativePath></DestinationRelativePath>
<Exclude>False</Exclude>
<FromTarget>AspNetCompilerMergePhase</FromTarget>
<Category>Run</Category>
<ProjectFileType>Default</ProjectFileType>
</_AspnetCompileMergePrecompiledOutput>
</ItemDefinitionGroup>
<PropertyGroup>
<AspnetCompileMergeIntermediateOutputPath Condition="'$(AspnetCompileMergeIntermediateOutputPath)' == ''">$(IntermediateOutputPath)AspnetCompileMerge\</AspnetCompileMergeIntermediateOutputPath>
<AspnetCompileMergeIntermediateAssemblyInfo Condition="'$(AspnetCompileMergeIntermediateAssemblyInfo)' == ''">$(IntermediateOutputPath)AssemblyInfo\</AspnetCompileMergeIntermediateAssemblyInfo>
<CopyBeforeAspnetCompileMergeTargetPath Condition="'$(CopyBeforeAspnetCompileMergeTargetPath)' == ''">$(AspnetCompileMergeIntermediateOutputPath)Source</CopyBeforeAspnetCompileMergeTargetPath>
<AspnetCompileMerge_TempBuildDir Condition="'$(AspnetCompileMerge_TempBuildDir)' == ''" >$(AspnetCompileMergeIntermediateOutputPath)TempBuildDir</AspnetCompileMerge_TempBuildDir>
</PropertyGroup>
<PropertyGroup Condition="'$(UseMerge)' != 'true'">
<_AspNetCompilerFixedNames Condition="'$(_AspNetCompilerFixedNames)' == ''">$(UseFixedNames)</_AspNetCompilerFixedNames>
</PropertyGroup>
<PropertyGroup Condition="'$(UseMetabasePath)' == 'true'">
<_AspNetCompilerMetabasePath Condition ="'$(_AspNetCompilerMetabasePath)' == ''">$(SourceWebMetabasePath)</_AspNetCompilerMetabasePath>
</PropertyGroup>
<PropertyGroup Condition="'$(UseMetabasePath)' != 'true'">
<_AspNetCompilerSourceWebPath Condition="'$(_AspNetCompilerSourceWebPath)' != ''">$(WebPublishPipelineProjectDirectory)</_AspNetCompilerSourceWebPath>
<_AspNetCompilerVirtualPath Condition="'$(_AspNetCompilerVirtualPath)' != ''">$(SourceWebVirtualPath)</_AspNetCompilerVirtualPath>
</PropertyGroup>
<PropertyGroup>
<_WPPCurrentBuildInfo>$(_WPPCurrentBuildInfo);PrecompileBeforePublish=$(PrecompileBeforePublish);WDPMergeOption=$(WDPMergeOption);_AspNetCompilerFixedNames=$(_AspNetCompilerFixedNames);_AspNetCompilerMetabasePath=$(_AspNetCompilerMetabasePath);Microsoft_Web_Publishing_AspNetCompileMerge_targets_Imported=$(Microsoft_Web_Publishing_AspNetCompileMerge_targets_Imported)</_WPPCurrentBuildInfo>
</PropertyGroup>
<!--***************************************************************-->
<!--Hookinto clean target for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<_WPPCleanTargets>
$(_WPPCleanTargets);
CleanAspNetCompileMergeTempDirectories;
</_WPPCleanTargets>
</PropertyGroup>
<!--
============================================================
Clean
Clean target.
============================================================
-->
<PropertyGroup>
<CleanAspNetCompileMergeTempDirectoriesDependsOn Condition="'$(CleanAspNetCompileMergeTempDirectoriesDependsOn)'==''">
</CleanAspNetCompileMergeTempDirectoriesDependsOn>
</PropertyGroup>
<Target Name="CleanAspNetCompileMergeTempDirectories" DependsOnTargets="$(CleanAspNetCompileMergeTempDirectoriesDependsOn)">
<!--
Create a Clean boolean property
-->
<CreateProperty Value="true">
<Output TaskParameter="Value" PropertyName="Clean" />
</CreateProperty>
<RemoveDir Condition="Exists('$(CopyBeforeAspnetCompileMergeTargetPath)')" Directories="$(CopyBeforeAspnetCompileMergeTargetPath)"/>
<RemoveDir Condition="Exists('$(AspnetCompileMerge_TempBuildDir)')" Directories="$(AspnetCompileMerge_TempBuildDir)" />
<RemoveDir Condition="Exists('$(AspnetCompileMergeIntermediateAssemblyInfo)')" Directories="$(AspnetCompileMergeIntermediateAssemblyInfo)" />
<Delete Condition="'$(AssemblyInfoDll)' != '' And Exists($(AssemblyInfoDll))"
DeletedFiles="$(AssemblyInfoDll)" ContinueOnError="true" />
</Target>
<!--
============================================================
GetAspNetMergePath
Get the paths for AspNet_Merge.exe Path.
Use Framework SDK's Path. If not exist, fall back to WDP installpath.
============================================================
-->
<PropertyGroup>
<GetAspNetMergePathDependsOn>
GetFrameworkPaths;
</GetAspNetMergePathDependsOn>
</PropertyGroup>
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
</Target>
<!--********************************************************************-->
<!-- Target GenerateAssemblyInfo -->
<!--********************************************************************-->
<!--
============================================================
GenerateAssemblyInfo
Generates an Assembly with the AssemblyAttributes contained in @(AssebmlyAttributes)
The output is in property AssemblyInfoDll
The assembly attributes can be defined as follows:
<ItemGroup>
<AssebmlyAttributes Include="AssemblyVersion">
<value>3.0.0.0</value>
</AssebmlyAttributes>
<AssebmlyAttributes Include="AssemblyFileVersion">
<value>3.0.0.0</value>
</AssebmlyAttributes>
<AssemblyAttributes Include="AssemblyTitle">
<value>MyCompany MyWeb</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyDescription">
<value>Corporate Site</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCompany">
<value>MyCompany</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCopyright">
<value>Copyright © MyCompany 2005</value>
</AssemblyAttributes>
</ItemGroup>
============================================================
-->
<PropertyGroup>
<GenerateAssemblyInfoFromAssemblyAttributesDependsOn>
$(OnBeforeGenerateAssemblyInfoFromAssemblyAttributes);
$(GenerateAssemblyInfoFromAssemblyAttributesDependsOn);
GetFrameworkPaths;
GetAspNetMergePath;
</GenerateAssemblyInfoFromAssemblyAttributesDependsOn>
</PropertyGroup>
<Target Name="GenerateAssemblyInfoFromAssemblyAttributes"
DependsOnTargets="$(GenerateAssemblyInfoFromAssemblyAttributesDependsOn)"
Condition=" '@(AssemblyAttributes)' != '' ">
<PropertyGroup>
<_AssemblyInfoSource Condition="'$(_AssemblyInfoSource)' == ''" >$(IntermediateOutputPath)AssemblyInfo\AssemblyInfo.cs</_AssemblyInfoSource>
<_AssemblyInfoSourceDirectory>$([System.IO.Path]::GetDirectoryName($(_AssemblyInfoSource)))</_AssemblyInfoSourceDirectory>
<AssemblyInfoDll>$([System.IO.Path]::GetDirectoryName($(_AssemblyInfoSource)))\AssemblyInfo.dll</AssemblyInfoDll>
<_AssemblyInfoDllDirectory>$([System.IO.Path]::GetDirectoryName($(AssemblyInfoDll)))</_AssemblyInfoDllDirectory>
</PropertyGroup>
<GenerateAssemblyInfo
AssemblyAttributes="@(AssemblyAttributes)"
OutputDir="$([System.IO.Path]::GetDirectoryName($(_AssemblyInfoSource)))">
<Output TaskParameter="Regenerated" PropertyName="_AssemblyInfoSourceIsUpdated"/>
</GenerateAssemblyInfo>
<PropertyGroup >
<_GenerateAssemblyInfoDll>false</_GenerateAssemblyInfoDll>
<_GenerateAssemblyInfoDll Condition="'$(_AssemblyInfoSourceIsUpdated)' == 'true' or !Exists($(AssemblyInfoDll))">True</_GenerateAssemblyInfoDll>
</PropertyGroup>
<MakeDir Condition="!Exists($(_AssemblyInfoDllDirectory))" Directories="$(_AssemblyInfoDllDirectory)" ContinueOnError="true" />
<Csc Condition="'$(_GenerateAssemblyInfoDll)'=='true'"
TargetType="library"
Sources="$(_AssemblyInfoSource)"
OutputAssembly="$(AssemblyInfoDll)"
/>
<ItemGroup Condition="$(_GenerateAssemblyInfoDll) And Exists($(AssemblyInfoDll))">
<FileWrites Include="$(_AssemblyInfoSource)" />
<FileWrites Include="$(AssemblyInfoDll)" />
</ItemGroup>
</Target>
<PropertyGroup>
<GenerateAssemblyInfoFromExistingAssembleInfoDependsOn>
$(OnBeforeGenerateAssemblyInfoFromExistingAssembleInfo);
$(GenerateAssemblyInfoFromExistingAssembleInfoDependsOn);
GetFrameworkPaths;
GetAspNetMergePath;
GenerateAssemblyInfoFromAssemblyAttributes;
</GenerateAssemblyInfoFromExistingAssembleInfoDependsOn>
</PropertyGroup>
<Target Name="GenerateAssemblyInfoFromExistingAssembleInfo"
DependsOnTargets="$(GenerateAssemblyInfoFromExistingAssembleInfoDependsOn)"
Condition=" '@(AssemblyAttributes)' == '' ">
<FilterByItems Condition="'$(_AssemblyInfoSource)'==''"
PipelineItems="@(Compile)"
SourceMetadataName="Filename"
FilterMetadataName="Filename"
Filter="AssemblyInfo">
<Output TaskParameter="InFilter" ItemName="_AspNetCompile_AssemblyInfo"/>
</FilterByItems>
<ItemGroup Condition="'$(_AssemblyInfoSource)'!=''">
<_AspNetCompile_AssemblyInfo Include="$(_AssemblyInfoSource)" />
</ItemGroup>
<PropertyGroup Condition="'$(AssemblyInfoDll)' == ''">
<_AssemblyInfoDllDirectory>$(IntermediateOutputPath)AssemblyInfo</_AssemblyInfoDllDirectory>
<AssemblyInfoDll>$(_AssemblyInfoDllDirectory)\AssemblyInfo.dll</AssemblyInfoDll>
</PropertyGroup>
<MakeDir Condition="!Exists($(_AssemblyInfoDllDirectory))"
Directories="$(_AssemblyInfoDllDirectory)" ContinueOnError="true" />
<PropertyGroup >
<_GenerateAssemblyInfoDll>False</_GenerateAssemblyInfoDll>
<_GenerateAssemblyInfoDll Condition="'$(AssemblyInfoDll)' == '' Or !Exists($(AssemblyInfoDll))">True</_GenerateAssemblyInfoDll>
</PropertyGroup>
<CheckItemsCount Items="@(_AspNetCompile_AssemblyInfo)" >
<Output TaskParameter="Count" PropertyName="_AspNetCompile_AssemblyInfo_Count" />
</CheckItemsCount>
<!--Found more than one AssemblyInfo.cs or AssemblyInfo.vb
To avoid this error either specify
/p:_AssemblyInfoSource=..\..\AssemblyInfo.cs
or
/p:AssemblyInfoDll=$(TargetPath)
or
supply @(AssemblyAttributes) as following
<ItemGroup>
<AssebmlyAttributes Include="AssemblyVersion">
<value>3.0.0.0</value>
</AssebmlyAttributes>
<AssebmlyAttributes Include="AssemblyFileVersion">
<value>3.0.0.0</value>
</AssebmlyAttributes>
<AssemblyAttributes Include="AssemblyTitle">
<value>MyCompany MyWeb</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyDescription">
<value>Corporate Site</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCompany">
<value>MyCompany</value>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyCopyright">
<value>Copyright © MyCompany 2005</value>
</AssemblyAttributes>
</ItemGroup>-->
<GetPublishingLocalizedString
Condition="$(_GenerateAssemblyInfoDll) AND '$(_AspNetCompile_AssemblyInfo_Count)' != '1'"
ID="PublishLocalizedString_ErrorInvalidMSBuildItemCollectionCount"
ArgumentCount="3"
Arguments="_AspNetCompile_AssemblyInfo_Count;$(_AspNetCompile_AssemblyInfo_Count);1"
LogType="Error" />
<Error Text ="Target GenerateAssemblyInfoFromExistingAssembleInfo Failed"
Condition="$(_GenerateAssemblyInfoDll) And '$(_AspNetCompile_AssemblyInfo_Count)' != '1'" />
<FilterByItems
PipelineItems="@(_AspNetCompile_AssemblyInfo)"
SourceMetadataName="Extension"
FilterMetadataName="Extension"
Filter="AssemblyInfo.cs">
<Output TaskParameter="InFilter" ItemName="_AspNetCompile_AssemblyInfo_CS"/>
</FilterByItems>
<Csc Condition="$(_GenerateAssemblyInfoDll) And '@(_AspNetCompile_AssemblyInfo_CS)' != ''"
TargetType="library"
Sources="@(_AspNetCompile_AssemblyInfo_CS)"
OutputAssembly="$(AssemblyInfoDll)"
/>
<FilterByItems
PipelineItems="@(_AspNetCompile_AssemblyInfo)"
SourceMetadataName="Extension"
FilterMetadataName="Extension"
Filter="AssemblyInfo.vb">
<Output TaskParameter="InFilter" ItemName="_AspNetCompile_AssemblyInfo_VB"/>
</FilterByItems>
<Vbc Condition="$(_GenerateAssemblyInfoDll) And '@(_AspNetCompile_AssemblyInfo_VB)' != ''"
TargetType="library"
Sources="@(_AspNetCompile_AssemblyInfo_VB)"
OutputAssembly="$(AssemblyInfoDll)"
/>
<ItemGroup Condition="$(_GenerateAssemblyInfoDll) And Exists($(AssemblyInfoDll))">
<FileWrites Include="$(AssemblyInfoDll)" />
</ItemGroup>
</Target>
<PropertyGroup>
<GenerateAssemblyInfoDependsOn>
$(OnBeforeGenerateAssemblyInfo);
$(GenerateAssemblyInfoDependsOn);
GetFrameworkPaths;
GetAspNetMergePath;
GenerateAssemblyInfoFromAssemblyAttributes;
GenerateAssemblyInfoFromExistingAssembleInfo;
</GenerateAssemblyInfoDependsOn>
</PropertyGroup>
<Target Name="GenerateAssemblyInfo"
DependsOnTargets="$(GenerateAssemblyInfoDependsOn)"
Condition=" '$(GenerateAssemblyInfo)' != 'false' ">
</Target>
<!--********************************************************************-->
<!-- Target GetAspNetPreCompileSourceVirtualPath -->
<!--********************************************************************-->
<PropertyGroup>
<GetAspNetPreCompileSourceVirtualPathDependsOn >
$(OnBeforeGetAspNetPreCompileSourceVirtualPath);
$(GetAspNetPreCompileSourceVirtualPathDependsOn);
</GetAspNetPreCompileSourceVirtualPathDependsOn>
</PropertyGroup>
<Target Name="GetAspNetPreCompileSourceVirtualPath"
Condition ="'$(GetAspNetPreCompileSourceVirtualPath)' != 'false' And '$(_AspNetCompilerVirtualPath)' == '' And '$(UseMetabasePath)' != 'true'"
DependsOnTargets="$(GetAspNetPreCompileSourceVirtualPathDependsOn)">
<ItemGroup>
<__AspNetPreCompileSourceVirtualPathName Include ="DevelopmentServerVPath" />
<__AspNetPreCompileSourceVirtualPathValue />
</ItemGroup>
<GetProjectProperties ProjectFileFullPath="$(WebPublishPipelineWAPProjectSettings)"
ProjectExtensionsProperties="@(__AspNetPreCompileSourceVirtualPathName)">
<Output TaskParameter="ResultProperties" ItemName="__AspNetPreCompileSourceVirtualPathValue" />
<Output TaskParameter="UseIis" PropertyName="__AspNetPreCompileSourceUseIis" />
<Output TaskParameter="IisUrl" PropertyName="__AspNetPreCompileSourceIisUrl" />
</GetProjectProperties>
<PropertyGroup>
<_AspNetCompilerVirtualPath>%(__AspNetPreCompileSourceVirtualPathValue.Value)</_AspNetCompilerVirtualPath>
<_AspNetCompilerVirtualPath Condition="'$(_AspNetCompilerVirtualPath)' == '' ">\</_AspNetCompilerVirtualPath>
</PropertyGroup>
</Target>
<!--********************************************************************-->
<!-- Target ConfigureForAspNetPreCompileMerge -->
<!--********************************************************************-->
<PropertyGroup>
<ConfigureForAspNetPreCompileMergeDependsOn>
$(OnBeforeConfigureForAspNetPreCompileMerge);
$(ConfigureForAspNetPreCompileMergeDependsOn);
GetFrameworkPaths;
GetAspNetMergePath;
GetAspNetPreCompileSourceVirtualPath;
ResolveKeySource;
</ConfigureForAspNetPreCompileMergeDependsOn>
</PropertyGroup>
<Target Name="ConfigureForAspNetPreCompileMerge" DependsOnTargets="$(ConfigureForAspNetPreCompileMergeDependsOn)">
<PropertyGroup Condition="'$(_WDPFrameworkLowerThan4)' ==''">
<_WDPFrameworkLowerThan4>False</_WDPFrameworkLowerThan4>
<_WDPFrameworkLowerThan4 Condition="'$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'">True</_WDPFrameworkLowerThan4>
</PropertyGroup>
<PropertyGroup>
<!-- 2.0 CLR -->
<AspnetCompilerPath Condition=" '$(AspnetCompilerPath)'=='' and '$(_WDPFrameworkLowerThan4)' == 'True' and '$(Platform)'=='x64'">$(windir)\Microsoft.NET\Framework64\v2.0.50727</AspnetCompilerPath>
<AspnetCompilerPath Condition=" '$(AspnetCompilerPath)'=='' and '$(_WDPFrameworkLowerThan4)' == 'True' ">$(Framework20Dir)</AspnetCompilerPath>
<!-- 4.0 CLR -->
<AspnetCompilerPath Condition=" '$(AspnetCompilerPath)'=='' and '$(Platform)'=='x64' ">$(windir)\Microsoft.NET\Framework64\v4.0.30319</AspnetCompilerPath>
<!-- Default value -->
<AspnetCompilerPath Condition=" '$(AspnetCompilerPath)'=='' " >$(Framework40Dir)</AspnetCompilerPath>
</PropertyGroup>
<Error Condition="'$(AspnetCompilerPath)' == '' Or !Exists($(AspnetCompilerPath))"
Text="Can't find the valid AspnetCompilerPath" />
<PropertyGroup>
<_AspNetCompileMergeKeyFile Condition="'$(_AspNetCompileMergeKeyFile)' == ''">$(KeyOriginatorFile)</_AspNetCompileMergeKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(UseMerge)' != true">
<_AspNetCompileMergeKeyContainer Condition="'$(_AspNetCompileMergeKeyContainer)' == ''">$(KeyContainerName)</_AspNetCompileMergeKeyContainer>
</PropertyGroup>
</Target>
<!--********************************************************************-->
<!-- Target AspNetPreCompile -->
<!--We can't use the in-place aspnet_compiler because it will output to the aspnet temp folder which is only suiteable to run on the current machine.-->
<!--********************************************************************-->
<PropertyGroup>
<AspNetPreCompileDependsOn >
$(OnBeforeAspNetPreCompile);
$(AspNetPreCompileDependsOn);
CopyAllFilesToSingleFolderForAspNetCompileMerge;
GetReferenceAssemblyPaths;
ResolveReferences;
ResolveKeySource;
ConfigureForAspNetPreCompileMerge;
</AspNetPreCompileDependsOn>
</PropertyGroup>
<Target Name="AspNetPreCompile" DependsOnTargets="$(AspNetPreCompileDependsOn)" Condition="'$(AspNetPreCompile)' != 'false'">
<PropertyGroup Condition="'$(UseMetabasePath)' == 'true'" >
<_PreAspnetCompileMergeSingleTargetFolderFullPath></_PreAspnetCompileMergeSingleTargetFolderFullPath>
<_AspNetCompilerVirtualPath></_AspNetCompilerVirtualPath>
</PropertyGroup>
<PropertyGroup Condition="'$(UseMetabasePath)' != 'true'" >
<_PreAspnetCompileMergeSingleTargetFolderFullPath>$([System.IO.Path]::GetFullPath($(_PreAspnetCompileMergeSingleTargetFolder)))</_PreAspnetCompileMergeSingleTargetFolderFullPath>
</PropertyGroup>
<PropertyGroup>
<_PostAspnetCompileMergeSingleTargetFolderFullPath>$([System.IO.Path]::GetFullPath($(_PostAspnetCompileMergeSingleTargetFolder)))</_PostAspnetCompileMergeSingleTargetFolderFullPath>
</PropertyGroup>
<AspNetCompiler
PhysicalPath="$(_PreAspnetCompileMergeSingleTargetFolderFullPath)"
TargetPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)"
VirtualPath="$(_AspNetCompilerVirtualPath)"
Force="$(_AspNetCompilerForce)"
Debug="$(DebugSymbols)"
Updateable="$(EnableUpdateable)"
KeyFile="$(_AspNetCompileMergeKeyFile)"
KeyContainer="$(_AspNetCompileMergeKeyContainer)"
DelaySign="$(DelaySign)"
AllowPartiallyTrustedCallers="$(AllowPartiallyTrustedCallers)"
FixedNames="$(_AspNetCompilerFixedNames)"
Clean="$(Clean)"
MetabasePath="$(_AspNetCompilerMetabasePath)"
ToolPath="$(AspnetCompilerPath)"
/>
<!--
Removing APP_DATA is done here so that the output groups reflect the fact that App_data is
not present
-->
<RemoveDir Condition="'$(DeleteAppDataFolder)' == 'true' And Exists('$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\App_Data')"
Directories="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\App_Data" />
<CollectFilesinFolder Condition="'$(UseMerge)' != 'true'"
RootPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)" >
<Output TaskParameter="Result" ItemName="_AspnetCompileMergePrecompiledOutputNoMetadata" />
</CollectFilesinFolder>
<ItemGroup Condition="'$(UseMerge)' != 'true'">
<FileWrites Include="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\**"/>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!-- Target AspNetMerge -->
<!--********************************************************************-->
<PropertyGroup>
<AspNetMergeDependsOn >
$(OnBeforeAspNetMerge);
CopyAllFilesToSingleFolderForAspNetCompileMerge;
$(AspNetMergeDependsOn);
ConfigureForAspNetPreCompileMerge;
AspNetPreCompile;
GenerateAssemblyInfo;
</AspNetMergeDependsOn>
</PropertyGroup>
<Target Name="AspNetMerge" DependsOnTargets="$(AspNetMergeDependsOn)" Condition="'$(AspNetMerge)' != 'false' And '$(UseMerge)' == 'true'">
<AspNetMerge
ExePath="$(AspnetMergePath)"
ApplicationPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)"
KeyFile="$(_AspNetCompileMergeKeyFile)"
DelaySign="$(DelaySign)"
Prefix="$(AssemblyPrefixName)"
SingleAssemblyName="$(SingleAssemblyName)"
Debug="$(DebugSymbols)"
Nologo="$(NoLogo)"
ContentAssemblyName="$(ContentAssemblyName)"
ErrorStack="$(ErrorStack)"
RemoveCompiledFiles="$(DeleteAppCodeCompiledFiles)"
CopyAttributes="$(CopyAssemblyAttributes)"
AssemblyInfo="$(AssemblyInfoDll)"
MergeXmlDocs="$(MergeXmlDocs)"
ErrorLogFile="$(MergeErrorLogFile)"
/>
<CollectFilesinFolder Condition="'$(UseMerge)' == 'true'"
RootPath="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)" >
<Output TaskParameter="Result" ItemName="_AspnetCompileMergePrecompiledOutputNoMetadata" />
</CollectFilesinFolder>
<ItemGroup Condition="'$(UseMerge)' == 'true'">
<FileWrites Include="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)\**"/>
</ItemGroup>
</Target>
<!--********************************************************************-->
<!--Target ConfigureFoldersForAspNetCompileMerge -->
<!--********************************************************************-->
<PropertyGroup>
<ConfigureFoldersForAspNetCompileMergeDependsOn>
$(OnBeforeConfigureFoldersForAspNetCompileMerge);
$(ConfigureFoldersForAspNetCompileMergeDependsOn);
</ConfigureFoldersForAspNetCompileMergeDependsOn>
</PropertyGroup>
<Target Name="ConfigureFoldersForAspNetCompileMerge"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(ConfigureFoldersForAspNetCompileMergeDependsOn)">
<!--This is a phase separation point-->
<!--
<CopyBeforeAspnetCompileMergeTargetPath Condition="'$(CopyBeforeAspnetCompileMergeTargetPath)' == ''">$(AspnetCompileMergeIntermediateOutputPath)\Source</CopyBeforeAspnetCompileMergeTargetPath>
<AspnetCompileMerge_TempBuildDir Condition="'$(AspnetCompileMerge_TempBuildDir)' == ''" >$(AspnetCompileMergeIntermediateOutputPath)\TempBuildDir</AspnetCompileMerge_TempBuildDir>
-->
<PropertyGroup>
<_PreAspnetCompileMergeSingleTargetFolder>$(CopyBeforeAspnetCompileMergeTargetPath)</_PreAspnetCompileMergeSingleTargetFolder>
<_PostAspnetCompileMergeSingleTargetFolder>$(AspnetCompileMerge_TempBuildDir)</_PostAspnetCompileMergeSingleTargetFolder>
</PropertyGroup>
<CallTarget Targets="$(OnAfterConfigureFoldersForAspNetCompileMerge)" RunEachTargetSeparately="False" />
</Target>
<!--******************************************************************** -->
<!-- CopyAllFilesToSingleFolderForAspNetCompileMerge Task -->
<!-- This will materialize all the in-memory files list which is not marked -->
<!-- as excluded from packaging into the AspNetCompileMerge temp folder. -->
<!--ToDo: remove the condition on ContentPath AspNetCompileMerge (we are doing it now because IIS team is not support it yet-->
<!-- ******************************************************************** -->
<PropertyGroup>
<CopyAllFilesToSingleFolderForAspNetCompileMergeDependsOn>
$(OnBeforeCopyAllFilesToSingleFolderForAspNetCompileMerge);
ConfigureFoldersForAspNetCompileMerge;
$(CopyAllFilesToSingleFolderForAspNetCompileMergeDependsOn);
</CopyAllFilesToSingleFolderForAspNetCompileMergeDependsOn>
</PropertyGroup>
<Target Name="CopyAllFilesToSingleFolderForAspNetCompileMerge"
DependsOnTargets="$(CopyAllFilesToSingleFolderForAspNetCompileMergeDependsOn)"
Condition="'$(UseMetabasePath)' != 'true'">
<!-- In the case of the incremental Packaging/Publish, we need to find out the extra file and delete them-->
<ItemGroup>
<_AllExtraFilesUnder_PreAspnetCompileMergeSingleTargetFolder Include="$(_PreAspnetCompileMergeSingleTargetFolder)\**" />
<_AllExtraFilesUnder_PreAspnetCompileMergeSingleTargetFolder
Remove="@(FilesForPackagingFromProject->'$(_PreAspnetCompileMergeSingleTargetFolder)\%(DestinationRelativePath)')" />
</ItemGroup>
<!--Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject-->
<Delete Files="@(_AllExtraFilesUnder_PreAspnetCompileMergeSingleTargetFolder)" />
<!-- Make sure the folder exist -->
<MakeDir Directories="$(_PreAspnetCompileMergeSingleTargetFolder)" Condition="!Exists('$(_PreAspnetCompileMergeSingleTargetFolder)')"/>
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
Importance="High"
ID="PublishLocalizedString_WebPublishPipelineMaterializeAllFilesToTempDir"
ArgumentCount="1"
Arguments="$(_PreAspnetCompileMergeSingleTargetFolder)"
LogType="Message" />
<!--Force Copy Of all file to the $(_PreAspnetCompileMergeSingleTargetFolder) if needed-->
<CopyPipelineFiles PipelineItems="@(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(_PreAspnetCompileMergeSingleTargetFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True">
<Output TaskParameter="ResultPipelineItems" ItemName="_Files_PreAspnetCompileMergeSingleTargetFolder"/>
</CopyPipelineFiles>
<!--Workaround the MSBuild 2.0 limitation-->
<ItemGroup>
<FilesForPackagingFromProject Remove="@(FilesForPackagingFromProject)" />
<FilesForPackagingFromProject Include="@(_Files_PreAspnetCompileMergeSingleTargetFolder)" />
</ItemGroup>
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(IntermediateOutputPath)\FilesForPackagingFromProjectInPreAspNetComopileMergeCopied.txt"
Lines="@(FilesForPackagingFromProject->'
Files:%(Identity)
FromTarget:%(FromTarget)
DestinationRelativePath:%(DestinationRelativePath)')"
Overwrite="True" />
<!--Remove all Empty folder that's left. Since it is not critical, we only log warning if we failed to delete empty folder.-->
<RemoveEmptyDirectories Directories="$(_PreAspnetCompileMergeSingleTargetFolder)" LogErrorAsWarning="True" />
<MakeDir Directories="$(_PreAspnetCompileMergeSingleTargetFolder)" Condition="!Exists('$(_PreAspnetCompileMergeSingleTargetFolder)')"/>
<CallTarget Targets="$(OnAfterCopyAllFilesToSingleFolderForAspNetCompileMerge)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target PostAspNetCompileMergeCollectFiles -->
<!--********************************************************************-->
<PropertyGroup>
<PostAspNetCompileMergeCollectFilesDependsOn>
$(OnBeforePostAspNetCompileMergeCollectFiles);
$(PostAspNetCompileMergeCollectFilesDependsOn);
AspNetMerge;
</PostAspNetCompileMergeCollectFilesDependsOn>
</PropertyGroup>
<Target Name="PostAspNetCompileMergeCollectFiles"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(PostAspNetCompileMergeCollectFilesDependsOn)">
<!--need to consolate the @(FilesForPackagingFromProject) and @(_AspnetCompileMergePrecompiledOutput)-->
<ItemGroup>
<_AspnetCompileMergePrecompiledOutput Include="@(_AspnetCompileMergePrecompiledOutputNoMetadata->'$(_PostAspnetCompileMergeSingleTargetFolder)\%(Identity)')">
<DestinationRelativePath>%(_AspnetCompileMergePrecompiledOutputNoMetadata.Identity)</DestinationRelativePath>
</_AspnetCompileMergePrecompiledOutput>
</ItemGroup>
<!--This exclude if the filter item's DestinationRelativePath is specified.
This is useful for case like Reference Dll and pdb where the source is not under the current project.-->
<FilterByItems PipelineItems="@(FilesForPackagingFromProject)"
SourceMetadataName="DestinationRelativePath"
FilterRootFolder="$(_PostAspnetCompileMergeSingleTargetFolderFullPath)"
FilterBaseOnRelativePath="True"
FilterMetadataName="DestinationRelativePath"
Filter="@(_AspnetCompileMergePrecompiledOutput)">
<Output TaskParameter="InFilter" ItemName="_FilesForPackagingFromProject_in_AspnetCompileMergePrecompiledOutput"/>
</FilterByItems>
<!--Keep the Item meta from the original @(FilesForPackagingFromProject)-->
<ItemGroup>
<_AspnetCompileMergePrecompiledOutput Remove="@(_FilesForPackagingFromProject_in_AspnetCompileMergePrecompiledOutput->'%(FilterItemSpec)')" />
<_AspnetCompileMergePrecompiledOutput Include="@(_FilesForPackagingFromProject_in_AspnetCompileMergePrecompiledOutput->'%(FilterItemSpec)')" />
</ItemGroup>
<!--Workaround the MSBuild 2.0 limitation-->
<ItemGroup>
<FilesForPackagingFromProject Remove="@(FilesForPackagingFromProject)" />
<FilesForPackagingFromProject Include="@(_AspnetCompileMergePrecompiledOutput)" />
</ItemGroup>
<WriteLinesToFile Condition="$(EnablePackageProcessLoggingAndAssert)"
Encoding="utf-8"
File="$(IntermediateOutputPath)\FilesForPackagingFromPostAspNetCompileMergeCollectFiles.txt"
Lines="@(FilesForPackagingFromProject->'
Files:%(Identity)
FromTarget:%(FromTarget)
DestinationRelativePath:%(DestinationRelativePath)')"
Overwrite="True" />
<CallTarget Targets="$(OnAfterPostAspNetCompileMergeCollectFiles)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target CleanPostAspNetCompileMergeFolder -->
<!--********************************************************************-->
<PropertyGroup>
<CleanPostAspNetCompileMergeFolderDependsOn>
$(OnBeforeCleanPostAspNetCompileMergeFolder);
$(CleanPostAspNetCompileMergeFolderDependsOn);
ConfigureFoldersForAspNetCompileMerge;
</CleanPostAspNetCompileMergeFolderDependsOn>
</PropertyGroup>
<Target Name="CleanPostAspNetCompileMergeFolder"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(CleanPostAspNetCompileMergeFolderDependsOn)">
<RemoveDir Condition="'$(_PostAspnetCompileMergeSingleTargetFolder)' != '' And Exists($(_PostAspnetCompileMergeSingleTargetFolder))"
Directories="$(_PostAspnetCompileMergeSingleTargetFolder)" />
<CallTarget Targets="$(OnAfterCleanPostAspNetCompileMergeFolder)" RunEachTargetSeparately="False" />
</Target>
<!--********************************************************************-->
<!--Target PipelineAspNetCompileMergePhase -->
<!--********************************************************************-->
<PropertyGroup>
<PipelineAspNetCompileMergePhaseDependsOn>
$(OnBeforePipelineAspNetCompileMergePhase);
$(PipelineAspNetCompileMergePhaseDependsOn);
CleanPostAspNetCompileMergeFolder;
CopyAllFilesToSingleFolderForAspNetCompileMerge;
AspNetPreCompile;
AspNetMerge;
PostAspNetCompileMergeCollectFiles;
</PipelineAspNetCompileMergePhaseDependsOn>
<PipelineAspNetCompileMergePhaseAfterTargets Condition="'$(PipelineAspNetCompileMergePhaseAfterTargets)' == '' ">
PipelineTransformPhase;
</PipelineAspNetCompileMergePhaseAfterTargets>
</PropertyGroup>
<Target Name="PipelineAspNetCompileMergePhase"
Outputs="@(FilesForPackagingFromProject)"
DependsOnTargets="$(PipelineAspNetCompileMergePhaseDependsOn)"
AfterTargets="$(PipelineAspNetCompileMergePhaseAfterTargets)">
<!--This is a phase separation point-->
<!--Get Localized string before displaying message-->
<GetPublishingLocalizedString
ID="PublishLocalizedString_WebPublishPipelinePhase"
ArgumentCount="1"
Arguments="AspnetCompileMerge"
LogType="Message" />
<!--<Message Text="Pipeline AspNetCompileMerge Phase" />-->
<CallTarget Targets="$(OnAfterPipelineAspNetCompileMergePhase)" RunEachTargetSeparately="False" />
</Target>
<!--ImportAfter Extension-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftWebPublishingTransformTargets Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingTransformTargets)'==''">true</ImportByWildcardAfterMicrosoftWebPublishingTransformTargets>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftWebPublishingTransformTargets)' == 'true' and exists('$(MSBuildThisFileDirectory)\$(MSBuildThisFileName)\ImportAfter')"/>
</Project>

BIN
eng/msbuild/web/WebApplications/Microsoft.WebApplication.Build.Tasks.Dll

Binary file not shown.

396
eng/msbuild/web/WebApplications/Microsoft.WebApplication.targets

@ -1,396 +0,0 @@
<!--
***********************************************************************************************
Microsoft.WebApplication.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 web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process for web application projects.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.GetSilverlightItemsFromProperty" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.CopyFilesToFolders" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<PropertyGroup>
<IsDesktopBuild Condition="'$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''">False</IsDesktopBuild>
<WebProjectOutputDirInsideProjectDefault>True</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProjectDefault Condition="('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProject Condition="'$(WebProjectOutputDirInsideProject)' == ''">$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject>
<DisableLinkInCopyWebApplicaton Condition="'$(DisableLinkInCopyWebApplicaton)'==''">False</DisableLinkInCopyWebApplicaton>
<Disable_CopyWebApplication Condition="'$(Disable_CopyWebApplication)' == ''">False</Disable_CopyWebApplication>
<UseWPP_CopyWebApplication Condition="'$(UseWPP_CopyWebApplication)' == ''">False</UseWPP_CopyWebApplication>
<CleanWebProjectOutputDir>True</CleanWebProjectOutputDir>
<CleanWebProjectOutputDir Condition="$(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir>
</PropertyGroup>
<!--Only setup $(WebProjectOutputDir) iff user haven't set it up-->
<PropertyGroup Condition="'$(WebProjectOutputDir)'==''">
<WebProjectOutputDir>$(MSBuildProjectDirectory)</WebProjectOutputDir>
<WebProjectOutputDir Condition="!$(WebProjectOutputDirInsideProject)">$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebProjectOutputDir>
</PropertyGroup>
<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
CopySilverlightApplications;
_CopyBinDeployableAssemblies;
</PrepareForRunDependsOn>
<PrepareForRunDependsOn Condition="!$(Disable_CopyWebApplication)">
$(PrepareForRunDependsOn);
_CopyWebApplication;
_BuiltWebOutputGroupOutput
</PrepareForRunDependsOn>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CleanWebProjectOutputDir;
</CleanDependsOn>
</PropertyGroup>
<!--********************************************************************-->
<!-- CleanWebProjectOutputDir -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebProjectOutputDirDependsOn Condition="'$(CleanWebProjectOutputDirDependsOn)' == ''">
</CleanWebProjectOutputDirDependsOn>
</PropertyGroup>
<Target Name="CleanWebProjectOutputDir"
Condition="$(CleanWebProjectOutputDir)"
DependsOnTargets="$(CleanWebProjectOutputDirDependsOn)">
<!--Assertion check-->
<!--In the case of Clean Packaging/Publish, we simply delete the WebProjectOutputDir-->
<RemoveDir Condition="Exists($(WebProjectOutputDir))" Directories="$(WebProjectOutputDir)" ContinueOnError="true" />
</Target>
<!--
============================================================
_CopyWebApplication
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation.
============================================================
-->
<PropertyGroup>
<!--This will be overwrite by ..\web\Microsoft.Web.Publishing.targets when $(UseWPP_CopyWebApplication) set to true-->
<OnBefore_CopyWebApplicationDefault>
_CopyWebApplicationLegacy;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplicationDefault Condition="$(UseWPP_CopyWebApplication) AND Exists('$(MSBuildThisFileDirectory)\..\Web\Microsoft.Web.Publishing.targets')">
_WPPCopyWebApplication;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplication Condition="'$(OnBefore_CopyWebApplication)'==''">
$(OnBefore_CopyWebApplicationDefault);
</OnBefore_CopyWebApplication>
<OnAfter_CopyWebApplication Condition="'$(OnAfter_CopyWebApplication)'==''">
</OnAfter_CopyWebApplication>
<_CopyWebApplicationDependsOn Condition="'$(_CopyWebApplicationDependsOn)'==''">
$(OnBefore_CopyWebApplication);
</_CopyWebApplicationDependsOn>
</PropertyGroup>
<Target Name="_CopyWebApplication"
Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'"
DependsOnTargets="$(_CopyWebApplicationDependsOn)">
<CallTarget Condition="'$(OnAfter_CopyWebApplication)' != ''" Targets="$(OnAfter_CopyWebApplication)" RunEachTargetSeparately="true" />
</Target>
<!--
============================================================
_CopyWebApplicationLegacy
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
============================================================
-->
<Target Name="_CopyWebApplicationLegacy" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'" >
<!-- Log tasks -->
<Message Text="Copying Web Application Project Files for $(MSBuildProjectName)" />
<!-- Create the _PublishedWebsites\app\bin folder -->
<MakeDir Directories="$(WebProjectOutputDir)\bin" />
<!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(AddModules)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)"
DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'$(_SGenDllCreated)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DebugSymbolsProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DocumentationFileProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)"
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(ReferenceCopyLocalPaths)"
DestinationFiles="@(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
<Copy SourceFiles="@(Content)" Condition="'%(Content.Link)' == ''"
DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
<Copy SourceFiles="@(Content)" Condition="!$(DisableLinkInCopyWebApplicaton) And '%(Content.Link)' != ''"
DestinationFiles="$(WebProjectOutputDir)\%(Content.Link)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that have been marked to be copied to the bin folder -->
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="false"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy Silverlight Zip and Xzp file to _PublishedWebsites\app\ folder-->
<Copy SourceFiles="@(_WebApplicationSilverlightXapFiles)"
DestinationFolder="$(WebProjectOutputDir)\%(_WebApplicationSilverlightXapFiles.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that need to be bin deployed to the bin folder -->
<Copy SourceFiles="@(_binDeployableAssemblies)"
DestinationFolder="$(WebProjectOutputDir)\bin\%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--
============================================================
_BuiltWebOutputGroupOutput
This target creates and populates BuiltWebOutputGroupOutput
with contents of bin along with the @(Content) files
============================================================
-->
<Target Name ="_BuiltWebOutputGroupOutput"
Condition="!$(Disable_CopyWebApplication)"
Outputs="@(BuiltWebOutputGroupOutput)">
<CreateItem Include="$(WebProjectOutputDir)\bin\**\*.*;@(Content->'%(FullPath)')" Condition="'$(OutDir)' == '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
<CreateItem Include="$(WebProjectOutputDir)\**\*.*" Condition="'$(OutDir)' != '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
</Target>
<!--
============================================================
_GetSilverlightApplications
Converts the list of Silverlight Applications that are defined
in the property $(SilverlightApplicationList) to ITaskItems that
can be used by teh CopySilverlightApplication task
The format of $(SilverlightApplicationList) is:
{projGuid}|relPath|tgtFolder;{projGuid2}|relPathToProject2|tgtFolder2;...
============================================================
-->
<Target
Name="_GetSilverlightApplications"
Condition="'$(SilverlightApplicationList)' != ''">
<GetSilverlightItemsFromProperty
SilverlightReferences="$(SilverlightApplicationList)"
ProjectPath="$(MSBuildProjectFullPath)">
<Output TaskParameter="SilverlightApplications" ItemName="_AllSilverlightApplications"/>
</GetSilverlightItemsFromProperty>
<!-- Break the silverlight application list into two lists: those that exist on disk and those that don't. -->
<ItemGroup>
<_SilverlightApplications Include="@(_AllSilverlightApplications)" Condition="Exists('%(Identity)')"/>
<_SilverlightApplicationsNotExist Include="@(_AllSilverlightApplications)" Condition="!Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!--
============================================================
CopySilverlightApplications
This target copies the output xap files from referenced
Silverlight application projects to the target folder.
============================================================
-->
<Target
Name="CopySilverlightApplications"
DependsOnTargets="_GetSilverlightApplications"
Outputs="@(_WebApplicationSilverlightXapFiles)"
Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<!--
When building this project from the IDE or when building a .SLN from the command-line,
just gather the referenced build outputs (Xap files). The code that builds the .SLN will already have
built the project, so there's no need to do it again here. Since Silverlight only supports AnyCPU that is
what we use for the platform
The ContinueOnError setting is here so that, during project load, as
much information as possible will be passed to the compilers.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="GetXapOutputFile"
BuildInParallel= "false"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);Platform=AnyCPU;BuildingSolutionFile=false"
Condition="'@(_SilverlightApplications)' != ''"
ContinueOnError="!$(BuildingProject)">
<Output TaskParameter="TargetOutputs" ItemName="_SilverlightXapFiles"/>
</MSBuild>
<!--
Build referenced projects when building from the command line.
The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default
target is used during a P2P reference. However if a custom build process requires that
the referenced project has a different target to build it can be specified.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="$(ProjectReferenceBuildTargets)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);Platform=AnyCPU;BuildingSolutionFile=false"
BuildInParallel="false"
Condition="'$(BuildingInsideVisualStudio)' != 'true' and '@(_SilverlightApplications)' != ''">
</MSBuild>
<!--Copy the outputs to the target folder-->
<CopyFilesToFolders SourceFiles="@(_SilverlightXapFiles)"
SilverlightApplications="@(_SilverlightApplications)"
ConfigName="$(Configuration)"
Condition="'@(_SilverlightXapFiles)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="_WebApplicationSilverlightXapFiles" />
</CopyFilesToFolders>
<!-- Issue a warning for each non-existent project. -->
<Warning
Text="The referenced Silverlight project '%(_SilverlightApplicationsNotExist.Identity)' does not exist."
Condition="'@(_SilverlightApplicationsNotExist)'!=''"/>
</Target>
<!--
============================================================
_CopyBinDeployableAssemblies
This target copies the contents of ProjectDir\_bin_deployableAssemblies to the bin
folder, preserving the relative paths
============================================================
-->
<Target
Name="_CopyBinDeployableAssemblies"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
<PropertyGroup>
<BinDeployableFolder Condition="'$(BinDeployableFolder)' == ''">_bin_deployableAssemblies\</BinDeployableFolder>
<BinDeployableFolderFullPath>$([System.IO.Path]::GetFullPath($(BinDeployableFolder)))</BinDeployableFolderFullPath>
</PropertyGroup>
<!--Pick up the deployable items from the $(None) collection that are under the _bin_deployableAssemblies folder -->
<CreateItem Include="@(None->'%(Identity)')" Condition="'%(None.FullPath)' != '' And $([System.String]::new('%(None.FullPath)').StartsWith($(BinDeployableFolderFullPath), StringComparison.OrdinalIgnoreCase ))" >
<Output ItemName="__binDeployableAssemblies" TaskParameter="Include"/>
</CreateItem>
<!--Add metadata which holds the destination relative folder to copy them to-->
<ItemGroup>
<_binDeployableAssemblies Include ="@(__binDeployableAssemblies)" Condition="'@(__binDeployableAssemblies)' != ''">
<DestinationRelPath>$([System.String]::Concat($([System.IO.Path]::GetDirectoryName($([System.String]::new('%(__binDeployableAssemblies.FullPath)')))),'\').SubString($(BinDeployableFolderFullPath.Length)))</DestinationRelPath>
</_binDeployableAssemblies>
</ItemGroup>
<!-- Do the copy-->
<Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!--Add the items just copied to the collection of items to delete when doing a clean-->
<ItemGroup>
<FileWrites Include ="@(_binDeployableAssemblies->'$(OutDir)%(DestinationRelPath)%(Filename)%(Extension)')" />
</ItemGroup>
</Target>
<!--Import publishing target-->
<PropertyGroup>
<AspNetTargetsPath Condition=" '$(AspNetTargetsPath)'=='' ">$(MSBuildThisFileDirectory)..\Web\</AspNetTargetsPath>
</PropertyGroup>
<Import Project="$(AspNetTargetsPath)Microsoft.Web.Publishing.targets" Condition="Exists('$(AspNetTargetsPath)Microsoft.Web.Publishing.targets')" />
<!--Ensure the Siliverlight zap file is created and copied to the bin folder for the Microsoft.Web.Publishing.targets-->
<PropertyGroup>
<OnBeforePipelineCollectFilesPhase>
$(OnBeforePipelineCollectFilesPhase);
CopySilverlightApplications;
</OnBeforePipelineCollectFilesPhase>
</PropertyGroup>
<!-- Instruct ResolveAssemblyReferences in MS.Common.targets to generate suggested binding redirects. -->
<PropertyGroup>
<AutoUnifyAssemblyReferences>false</AutoUnifyAssemblyReferences>
<AppConfig Condition="'$(AppConfig)' == '' And Exists('$(ProjectConfigFileName)')">$(ProjectConfigFileName)</AppConfig>
</PropertyGroup>
</Project>

10
gen/OpenIddict.Client.WebIntegration.Generators/OpenIddict.Client.WebIntegration.Generators.csproj

@ -9,22 +9,12 @@
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OpenIddict.Abstractions\OpenIddict.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="Scriban" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="System.Interactive" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>
<ItemGroup>
<Using Include="OpenIddict.Abstractions" />
<Using Include="OpenIddict.Abstractions.OpenIddictConstants" Static="true" />
<Using Include="OpenIddict.Abstractions.OpenIddictResources" Alias="SR" />
</ItemGroup>
<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>

49
gen/OpenIddict.Client.WebIntegration.Generators/OpenIddictClientWebIntegrationGenerator.cs

@ -492,7 +492,7 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
throw new ArgumentException(SR.GetResourceString(SR.ID0346), nameof(key));
}
var algorithm = OpenIddictHelpers.CreateEcdsaKey();
var algorithm = ECDsa.Create();
try
{
@ -580,14 +580,10 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
[Obsolete(""This option is no longer supported and will be removed in a future version."")]
{{~ end ~}}
public {{ provider.name }} Set{{ setting.property_name }}(Assembly assembly, string resource, string? password)
#if SUPPORTS_EPHEMERAL_KEY_SETS
// Note: ephemeral key sets are currently not supported on macOS.
=> Set{{ setting.property_name }}(assembly, resource, password, OperatingSystem.IsMacOS() ?
X509KeyStorageFlags.MachineKeySet :
X509KeyStorageFlags.EphemeralKeySet);
#else
=> Set{{ setting.property_name }}(assembly, resource, password, X509KeyStorageFlags.MachineKeySet);
#endif
/// <summary>
/// Configures {{ setting.description }}.
@ -623,14 +619,10 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
[Obsolete(""This option is no longer supported and will be removed in a future version."")]
{{~ end ~}}
public {{ provider.name }} Set{{ setting.property_name }}(Stream stream, string? password)
#if SUPPORTS_EPHEMERAL_KEY_SETS
// Note: ephemeral key sets are currently not supported on macOS.
=> Set{{ setting.property_name }}(stream, password, OperatingSystem.IsMacOS() ?
X509KeyStorageFlags.MachineKeySet :
X509KeyStorageFlags.EphemeralKeySet);
#else
=> Set{{ setting.property_name }}(stream, password, X509KeyStorageFlags.MachineKeySet);
#endif
/// <summary>
/// Configures {{ setting.description }}.
@ -649,16 +641,13 @@ public sealed partial class OpenIddictClientWebIntegrationBuilder
using var buffer = new MemoryStream();
stream.CopyTo(buffer);
#if SUPPORTS_CERTIFICATE_LOADER
var certificate = X509Certificate2.GetCertContentType(buffer.ToArray()) switch
{
X509ContentType.Pkcs12 => X509CertificateLoader.LoadPkcs12(buffer.ToArray(), password, flags),
_ => throw new InvalidOperationException(SR.GetResourceString(SR.ID0454))
};
#else
var certificate = new X509Certificate2(buffer.ToArray(), password, flags);
#endif
return Set{{ setting.property_name }}(certificate);
}
@ -1178,7 +1167,6 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
registration.SigningCredentials.Add(new SigningCredentials(key, SecurityAlgorithms.HmacSha256));
}
#if SUPPORTS_ECDSA
// Note: ECDSA algorithms are bound to specific curves and must be treated separately.
else if (key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha256))
{
@ -1194,14 +1182,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{
registration.SigningCredentials.Add(new SigningCredentials(key, SecurityAlgorithms.EcdsaSha512));
}
#else
else if (key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha256) ||
key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha384) ||
key.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha512))
{
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0069));
}
#endif
else
{
throw new InvalidOperationException(SR.GetResourceString(SR.ID0068));
@ -1230,7 +1211,6 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
registration.SigningCredentials.Add(new SigningCredentials(settings.{{ setting.property_name }}, SecurityAlgorithms.HmacSha256));
}
#if SUPPORTS_ECDSA
// Note: ECDSA algorithms are bound to specific curves and must be treated separately.
else if (settings.{{ setting.property_name }}.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha256))
{
@ -1246,14 +1226,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{
registration.SigningCredentials.Add(new SigningCredentials(settings.{{ setting.property_name }}, SecurityAlgorithms.EcdsaSha512));
}
#else
else if (settings.{{ setting.property_name }}.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha256) ||
settings.{{ setting.property_name }}.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha384) ||
settings.{{ setting.property_name }}.IsSupportedAlgorithm(SecurityAlgorithms.EcdsaSha512))
{
throw new PlatformNotSupportedException(SR.GetResourceString(SR.ID0069));
}
#endif
else
{
throw new InvalidOperationException(SR.GetResourceString(SR.ID0068));
@ -1311,7 +1284,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } types => types.Select(static type => (string?) type.Attribute("Value")).ToList(),
// If no explicit grant type was set, assume the provider only supports the code flow.
_ => [GrantTypes.AuthorizationCode]
_ => ["authorization_code"]
},
ResponseModesSupported = configuration.Elements("ResponseMode").ToList() switch
@ -1319,7 +1292,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } modes => modes.Select(static type => (string?) type.Attribute("Value")).ToList(),
// If no explicit response mode was set, assume the provider only supports the query response mode.
_ => [ResponseModes.Query]
_ => ["query"]
},
ResponseTypesSupported = configuration.Elements("ResponseType").ToList() switch
@ -1327,7 +1300,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
{ Count: > 0 } types => types.Select(static type => (string?) type.Attribute("Value")).ToList(),
// If no explicit response type was set, assume the provider only supports the code flow.
_ => [ResponseTypes.Code]
_ => ["code"]
},
ScopesSupported = configuration.Elements("Scope").ToList() switch
@ -1343,7 +1316,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only supports
// flowing the client credentials as part of the device authorization request payload.
_ => [ClientAuthenticationMethods.ClientSecretPost]
_ => ["client_secret_post"]
},
IntrospectionEndpointAuthMethodsSupported = configuration.Elements("IntrospectionEndpointAuthMethod").ToList() switch
@ -1352,7 +1325,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only
// supports flowing the client credentials as part of the introspection request payload.
_ => [ClientAuthenticationMethods.ClientSecretPost]
_ => ["client_secret_post"]
},
RevocationEndpointAuthMethodsSupported = configuration.Elements("RevocationEndpointAuthMethod").ToList() switch
@ -1361,7 +1334,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only
// supports flowing the client credentials as part of the revocation request payload.
_ => [ClientAuthenticationMethods.ClientSecretPost]
_ => ["client_secret_post"]
},
TokenEndpointAuthMethodsSupported = configuration.Elements("TokenEndpointAuthMethod").ToList() switch
@ -1370,7 +1343,7 @@ public sealed partial class OpenIddictClientWebIntegrationConfiguration
// If no explicit client authentication method was set, assume the provider only
// supports flowing the client credentials as part of the token request payload.
_ => [ClientAuthenticationMethods.ClientSecretPost]
_ => ["client_secret_post"]
}
},

10
global.json

@ -6,20 +6,12 @@
},
"tools": {
"dotnet": "10.0.203",
"runtimes": {
"aspnetcore": [
"8.0.26",
"9.0.15"
]
}
"dotnet": "10.0.203"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25562.108",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25562.108",
"MSBuild.Sdk.Extras": "3.0.44",
"MSBuild.SDK.SystemWeb": "4.0.97"
}
}

3
sandbox/OpenIddict.Sandbox.AspNet.Client/OpenIddict.Sandbox.AspNet.Client.csproj

@ -4,6 +4,7 @@
<TargetFramework>net48</TargetFramework>
<AppConfig>Web.config</AppConfig>
<GeneratedBindingRedirectsAction>Overwrite</GeneratedBindingRedirectsAction>
<VSToolsPath>$(NuGetPackageRoot)msbuild.microsoft.visualstudio.web.targets\14.0.0.3\tools\VSToolsPath</VSToolsPath>
<MvcBuildViews>false</MvcBuildViews>
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>CA3147</NoWarn>
@ -30,7 +31,9 @@
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" />
<PackageReference Include="Microsoft.Owin.Security.Cookies" />
<PackageReference Include="Microsoft.Web.Infrastructure" PrivateAssets="all" />
<PackageReference Include="MSBuild.Microsoft.VisualStudio.Web.targets" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NuGet.Build.Tasks.Pack" PrivateAssets="all" />
<PackageReference Include="WebGrease" />
</ItemGroup>

42
sandbox/OpenIddict.Sandbox.AspNet.Client/Web.config

@ -43,13 +43,13 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.6.0" newVersion="2.1.6.0" />
<assemblyIdentity name="Microsoft.Extensions.Primitives" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -73,7 +73,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -91,13 +91,13 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
<assemblyIdentity name="System.Threading.Tasks.Extensions" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -133,7 +133,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -156,8 +156,8 @@
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
<assemblyIdentity name="System.Numerics.Vectors" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -192,44 +192,44 @@
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<assemblyIdentity name="Microsoft.Extensions.Http" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

3
sandbox/OpenIddict.Sandbox.AspNet.Server/OpenIddict.Sandbox.AspNet.Server.csproj

@ -4,6 +4,7 @@
<TargetFramework>net48</TargetFramework>
<AppConfig>Web.config</AppConfig>
<GeneratedBindingRedirectsAction>Overwrite</GeneratedBindingRedirectsAction>
<VSToolsPath>$(NuGetPackageRoot)msbuild.microsoft.visualstudio.web.targets\14.0.0.3\tools\VSToolsPath</VSToolsPath>
<MvcBuildViews>false</MvcBuildViews>
<ImplicitUsings>disable</ImplicitUsings>
<NoWarn>CA3147</NoWarn>
@ -34,7 +35,9 @@
<PackageReference Include="Microsoft.Owin.Security.Cookies" />
<PackageReference Include="Microsoft.Owin.Security.OAuth" />
<PackageReference Include="Microsoft.Web.Infrastructure" PrivateAssets="all" />
<PackageReference Include="MSBuild.Microsoft.VisualStudio.Web.targets" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NuGet.Build.Tasks.Pack" PrivateAssets="all" />
<PackageReference Include="WebGrease" />
</ItemGroup>

38
sandbox/OpenIddict.Sandbox.AspNet.Server/Web.config

@ -49,13 +49,13 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.6.0" newVersion="2.1.6.0" />
<assemblyIdentity name="Microsoft.Extensions.Primitives" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -97,7 +97,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -115,13 +115,13 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
<assemblyIdentity name="System.Threading.Tasks.Extensions" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -180,8 +180,8 @@
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
<assemblyIdentity name="System.Numerics.Vectors" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -204,38 +204,38 @@
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
<assemblyIdentity name="Microsoft.Extensions.Http" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" culture="neutral" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.7" newVersion="10.0.0.7" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

7
sandbox/OpenIddict.Sandbox.AspNetCore.Client/Controllers/AuthenticationController.cs

@ -228,19 +228,12 @@ public class AuthenticationController : Controller
OpenIddictClientAspNetCoreConstants.Tokens.BackchannelIdentityToken or
OpenIddictClientAspNetCoreConstants.Tokens.RefreshToken));
#if SUPPORTS_REDIRECTION_ON_SIGN_IN
// Ask the default sign-in handler to return a new cookie and redirect the
// user agent to the return URL stored in the authentication properties.
//
// For scenarios where the default sign-in handler configured in the ASP.NET Core
// authentication options shouldn't be used, a specific scheme can be specified here.
return SignIn(new ClaimsPrincipal(identity), properties);
#else
// Note: "return SignIn(...)" cannot be directly used as-is on ASP.NET Core <7.0, as the cookies handler
// doesn't allow redirecting from an endpoint that doesn't match the path set in the cookie options.
await HttpContext.SignInAsync(new ClaimsPrincipal(identity), properties);
return Redirect(properties.RedirectUri ?? "/");
#endif
}
// Note: this controller uses the same callback action for all providers

3
sandbox/OpenIddict.Sandbox.AspNetCore.Client/Controllers/HomeController.cs

@ -1,5 +1,4 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Headers;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

15
sandbox/OpenIddict.Sandbox.AspNetCore.Client/OpenIddict.Sandbox.AspNetCore.Client.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net48;net10.0</TargetFrameworks>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -15,17 +15,4 @@
<PackageReference Include="Quartz.Extensions.Hosting" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<!--
Note: Microsoft.AspNetCore.Server.Kestrel.Core is explicitly referenced to
override the vulnerable version referenced by other packages or metapackages.
-->
<PackageReference Include="Microsoft.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" />
</ItemGroup>
</Project>

386
sandbox/OpenIddict.Sandbox.AspNetCore.Client/Program.cs

@ -1,17 +1,209 @@
using Microsoft.AspNetCore;
using OpenIddict.Sandbox.AspNetCore.Client;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using OpenIddict.Client;
using OpenIddict.Client.WebIntegration;
using OpenIddict.Sandbox.AspNetCore.Client.Models;
using Quartz;
using static OpenIddict.Abstractions.OpenIddictConstants;
#if SUPPORTS_WEB_INTEGRATION_IN_GENERIC_HOST
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
#else
var builder = WebHost.CreateDefaultBuilder(args);
builder.UseStartup<Startup>();
#endif
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<ApplicationDbContext>(options =>
{
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-aspnetcore-client.sqlite3")}");
options.UseOpenIddict();
});
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.LoginPath = "/login";
options.LogoutPath = "/logout";
options.ExpireTimeSpan = TimeSpan.FromMinutes(50);
options.SlidingExpiration = false;
});
// OpenIddict offers native integration with Quartz.NET to perform scheduled tasks
// (like pruning orphaned authorizations from the database) at regular intervals.
builder.Services.AddQuartz(options =>
{
options.UseSimpleTypeLoader();
options.UseInMemoryStore();
});
// Register the Quartz.NET service and configure it to block shutdown until jobs are complete.
builder.Services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);
builder.Services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
// Configure OpenIddict to use the Entity Framework Core stores and models.
options.UseEntityFrameworkCore()
.UseDbContext<ApplicationDbContext>();
// Developers who prefer using MongoDB can remove the previous lines
// and configure OpenIddict to use the specified MongoDB database:
// options.UseMongoDb()
// .UseDatabase(new MongoClient().GetDatabase("openiddict"));
// Enable Quartz.NET integration.
options.UseQuartz();
})
// Register the OpenIddict client components.
.AddClient(options =>
{
// Note: this sample uses the authorization code and refresh token
// flows, but you can enable the other flows if necessary.
options.AllowAuthorizationCodeFlow()
.AllowRefreshTokenFlow();
// Register the signing and encryption credentials used to protect
// sensitive data like the state tokens produced by OpenIddict.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableRedirectionEndpointPassthrough()
.EnablePostLogoutRedirectionEndpointPassthrough();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
// providers that use the user agent as a way to throttle requests (e.g Reddit).
options.UseSystemNetHttp()
.SetProductInformation(typeof(Program).Assembly);
// Add a client registration matching the client application definition in the server project.
options.AddRegistration(new OpenIddictClientRegistration
{
Issuer = new Uri("https://localhost:44395/", UriKind.Absolute),
ProviderName = "Local",
ProviderDisplayName = "Local OIDC server",
ClientId = "mvc",
Scopes = { Scopes.Email, Scopes.Profile, Scopes.OfflineAccess, "demo_api" },
RedirectUri = new Uri("callback/login/local", UriKind.Relative),
PostLogoutRedirectUri = new Uri("callback/logout/local", UriKind.Relative),
// On supported platforms, this application can authenticate using 3 different client
// authentication methods that all offer a higher security level than shared client secrets:
//
// 1) tls_client_auth (PKI-based mutual TLS authentication): while it requires
// setting up a proper Public Key Infrastructure, this method offers a very
// high level of security, as the authorization server never has access to the
// private key used by the client to authenticate itself and can dynamically check
// the revocation status of the client certificate using standard PKI mechanisms.
//
// 2) self_signed_tls_client_auth (self-signed certificate-based mutual TLS authentication):
// this method is easier to deploy than PKI-based mutual TLS authentication, while
// still offering a high level of security. Unlike PKI-based mutual TLS authentication,
// the revocation status of the client certificate is never checked but certificates can
// be "revoked" by being removed from the JSON Web Key Set associated with the client.
//
// 3) private_key_jwt (JWT client assertions signed with a private key): while this
// method doesn't offer the same security guarantees as mutual TLS authentication,
// it is more secure than shared secrets and doesn't have the operational constraints
// required by the two mutual TLS methods described above (such as TLS configuration).
//
// The actual client authentication method used by the OpenIddict client is automatically
// selected based on the registered credentials and the methods supported by the server:
// when supported by the server, mutual TLS authentication methods are always preferred.
//
// In all cases, no client secret is necessary but the client needs to be able to access the
// private key of the certificate/key to be able to generate and sign the client assertions.
SigningCredentials =
{
// Note: this certificate can be used with either tls_client_auth or private_key_jwt,
// depending on the server configuration (and the client authentication methods explicitly
// configured via OpenIddictClientRegistration.ClientAuthenticationMethods, if applicable).
//
GetPublicKeyInfrastructureCertificate(),
// Note: this certificate can be used with either self_signed_tls_client_auth or private_key_jwt,
// depending on the server configuration (and the client authentication methods explicitly
// configured via OpenIddictClientRegistration.ClientAuthenticationMethods, if applicable):
//
// GetSelfSignedCertificate(),
// Note: this key can only be used with private_key_jwt as raw keys cannot be used with TLS.
// GetSigningKey()
}
});
// Register the Web providers integrations.
//
// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint
// URI per provider, unless all the registered providers support returning a special "iss"
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
.AddGitHub(options =>
{
options.SetClientId("c4ade52327b01ddacff3")
.SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
.SetRedirectUri("callback/login/github");
})
.AddGoogle(options =>
{
options.SetClientId("1016114395689-kgtgq2p6dj27d7v6e2kjkoj54dgrrckh.apps.googleusercontent.com")
.SetClientSecret("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")
.SetRedirectUri("callback/login/google")
.SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline)
.AddScopes(Scopes.Profile);
})
.AddReddit(options =>
{
options.SetClientId("vDLNqhrkwrvqHgnoBWF3og")
.SetClientSecret("Tpab28Dz0upyZLqn7AN3GFD1O-zaAw")
.SetRedirectUri("callback/login/reddit")
.SetDuration(OpenIddictClientWebIntegrationConstants.Reddit.Durations.Permanent);
});
});
// Register a named HTTP client that will be used to call the demo resource API.
//
// Note: since the authorization server is configured to issue certificate-bound
// access tokens, the client certificate MUST be attached to outgoing HTTP requests
// and the mTLS subdomain (for which TLS client authentication is enabled) MUST be used.
builder.Services.AddHttpClient("ApiClient")
.AddAsKeyed()
.ConfigureHttpClient(static client => client.BaseAddress = new Uri("https://mtls.dev.localhost:44395/"))
.ConfigurePrimaryHttpMessageHandler(static () => new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ClientCertificates = { GetPublicKeyInfrastructureCertificate().Certificate }
});
builder.Services.AddMvc();
var app = builder.Build();
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseStatusCodePagesWithReExecute("/error");
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapDefaultControllerRoute();
// Before starting the host, create the database used to store the application data.
//
// Note: in a real world application, this step should be part of a setup script.
@ -22,3 +214,179 @@ await using (var scope = app.Services.CreateAsyncScope())
}
await app.RunAsync();
static X509SigningCredentials GetPublicKeyInfrastructureCertificate()
{
// Note: OpenIddict only negotiates PKI-based or self-signed mutual
// TLS authentication if the certificate explicitly contains the
// "digitalSignature" key usage and the "clientAuth" extended key usage.
var certificate = X509Certificate2.CreateFromPem(
certPem: $"""
-----BEGIN CERTIFICATE-----
MIIEezCCAmOgAwIBAgIRALTZE9ezjPCWDFr38cp6AMAwDQYJKoZIhvcNAQELBQAw
GjEYMBYGA1UEAxMPSW50ZXJtZWRpYXRlIENBMCAXDTI2MDIwMTE0MTQ0M1oYDzIx
MjYwMjAyMTQxNDQzWjAaMRgwFgYDVQQDEw9FbmQgY2VydGlmaWNhdGUwggEiMA0G
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMs9spnvKeKw6VwPbpB47ikC6bL0Cn
S+K19Fp8dJg8b4dA1J1Y8dA2gi2nU/+ntOMYp1A6EvMZ8UpbgnSmhUN/2JQFU5Hc
PP0/IMjZAl2Iseh2yiK3Ril4Agbng6YW7e9P5YtMV+6i/stYujwNTXsUMr/+QSUI
Nze7856XSIl9gRjWEKJ17Jk/tJpun/zdpl4hXcptrsxxLU/E03bC3LcjiXzg8/Zl
3/oEHqcHfv9C8RTdIBBw66zJAYzGfxwV31cJ9QQ2udlipi2l+ZR6jFWzzJI4XmiC
FzdwZRvhMLJsyK5miVIl0qPp3zJ2IyEb/2pLA0bc/ylZwVq6Z49k2xhZAgMBAAGj
gbkwgbYwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCB4AwFgYDVR0lAQH/BAww
CgYIKwYBBQUHAwIwHQYDVR0OBBYEFHPamNF/deBBv5JpDwiiRctPw4ziMEkGA1Ud
IwRCMECAFOEWwW18w3rZ6/5iIwAB12592OlHoRakFDASMRAwDgYDVQQDEwdSb290
IENBghBvqw/xqI/LNgVfSURP9ck7MBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkq
hkiG9w0BAQsFAAOCAgEAbBq73JzDpK11hoRUxHq7LvplQEe/FNuD/slvn9Crfm2d
jJj0HsQQZpMgxP7SZ9FNvFqCo+/dm9PchIlwqwSjWtTxgYmcMOXw0Rzst85Ug4U1
I2PG6iPxJ4WLSW2gzo//jFPa7MD1AnqDYwcCQTVsQW6aJavY3mFD31SJKsvSKqsV
6xTXsajLRetCSXGe5qFgfyLC9tOhtTWXsCed/ISoQ9bljhOSqT6pxkpOVu0AHHMB
1CMZay/B5ecjb66mwSoRcAPweMlAYJkjU5HXHSi7kB3gRQTsb1ZymEn67Q4C5cpI
Lq6UFK5bWZf1A0kFbYJBmn3oHsWxMQqv0F6QE7r4Mg6pfk9swzYZ8WqcgjiGHQET
pVU7ZKkUsg2JREXxRnhh5+Q+vGsF/DjhzQ6NrfPm8sqs+X+LzUN2cne8ZPclfyW2
VKCHTPZ6o8mELiAlIPdBYUYsgUEOsfmUWbx4wfx5IB7vnenrenInLLyGOOCxR33d
o/gDMLFdeKHXK2ISsbDCk+zwEF8kztn1cXWK+K6H9cr8oJjDi1OJwTkqz9msar+9
mjZ1CPAF0X+mLgrhVnNYqd5oqeeLerXKkAvpC2TgvlWJRGyDILhjva3J+2fQAYXZ
+OKFHNPf3n8Co4s5TMr1eiGVtS1etH6hPxnn5Jwnes9JZWFRLcjeTmPLSRWFucg=
-----END CERTIFICATE-----
""",
keyPem: $"""
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAzLPbKZ7ynisOlcD26QeO4pAumy9Ap0vitfRafHSYPG+HQNSd
WPHQNoItp1P/p7TjGKdQOhLzGfFKW4J0poVDf9iUBVOR3Dz9PyDI2QJdiLHodsoi
t0YpeAIG54OmFu3vT+WLTFfuov7LWLo8DU17FDK//kElCDc3u/Oel0iJfYEY1hCi
deyZP7Sabp/83aZeIV3Kba7McS1PxNN2wty3I4l84PP2Zd/6BB6nB37/QvEU3SAQ
cOusyQGMxn8cFd9XCfUENrnZYqYtpfmUeoxVs8ySOF5oghc3cGUb4TCybMiuZolS
JdKj6d8ydiMhG/9qSwNG3P8pWcFaumePZNsYWQIDAQABAoIBACorfyHC4d5dpmKJ
XxRAf1oDM+a6REpyoqCzVxS+fEIvA6ECa+vP3QHtrXQEJO2qoQIKLcfY8YXNpHDX
nipT18T1nADA55KEafNgUKAMEbLAW9Bk8ePpq09Ss5NsFoIwwBUoh5rRnpKrhL6h
lw9yf8F4dv7s8rEPlwa8OFaYFeLpoBLsPaX3nMu45CKb25dFZzSv9ORVs28LALrS
oK9MbtNFkmf/4EmpYA+nblkZd2bu4BomOF7C2F4bwtikN29vl4NPMhlbZGTy1hm9
jzMOOvO1DwvIjHRVcfHKMDZ7cw1Pj5TmeApToSs6ygu1lce0GQcNVm+KV2qZMjNQ
Al6cdFUCgYEA7HZ6wvZU/WA7ei+jIwrJdyQQ3jU/LAu7GGhXiMU3z2RSR/vieY5R
4IjQOgUkLBuQcy9uoQcSLpH/SNLIi6qhlMBvZuHq9QKF60t68tuW0PFSoa+SKaEn
DCZ70bnxo4OSRUtrzxikYHnwOvRGEli4EAOENETaQBKJUUygov/pOWMCgYEA3Z2a
TJlptRq75G6LHZvbBBzZdG9Mr04O6zvh5TGsJW86b6ov9BTAGz6Z37KWR1yUDfyH
dqNf90kJ8hs1eO6gGDQyGaH9yerrlULukANQfvpC0rEeJ7DfXSc1iLa3Q6+AOt5v
9TkQY7s/47iOPoCmblZ4FeVcIMx88ms2mBRXshMCgYAN9pkdNiqio7Ifbvy1Lwfi
jzCnzoEierbbpB23J9450vTA53DiOLNBDRMuuer+58nJ430m6SH7ugdXJ4tMJBFS
lWJ+ssyLF1ENKfHisXDgeb+laJa6+pcxsnwRUGeifjx+9wswuYXLZKf48z/ICZEk
8PA3nfE9Y1rUgC/kMDR3fQKBgQCyQRRdTICUJV7ATJIlTLmLw1C9sNBzqUuitlXq
rluS+LZ+HtvXbeFfiKjoH5N07ug/n8GuEZcdJmiTjoMiNH4dOc6ag4vJH+ZB9sZA
nAnhOJcLNV/V+RSQrvsGbkFWdhGkSEqxaibesTyghFAVwhEcavzIT+Yck55ktwwA
o0wudQKBgQDR0hyl/cf6MBgZ3gce6dOcznLKoa2icypmmfNkA6sqwXwW20/WfDGb
ZNdaL4U3xReSN1mzrs0yStq0UrAChwrwqJc6T7uhGR/lDjvJCeZP9zO2yCSBvtul
LWFkJnofc7NUYkhVSGaAMeT14xUY/XlFbkXp0jZOqKMRo7PeeeXZaQ==
-----END RSA PRIVATE KEY-----
""");
// On Windows, a certificate loaded from PEM-encoded material is ephemeral and
// cannot be directly used with TLS, as Schannel cannot access it in this case.
//
// To work this limitation, the certificate is exported and re-imported from a
// PFX blob to ensure the private key is persisted in a way that Schannel can use.
//
// In a real world application, the certificate wouldn't be embedded in the source code
// and would be installed in the certificate store, making this workaround unnecessary.
if (OperatingSystem.IsWindows())
{
certificate = X509CertificateLoader.LoadPkcs12(
data: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
}
return new X509SigningCredentials(certificate);
}
#pragma warning disable CS8321
static X509SigningCredentials GetSelfSignedCertificate()
{
// Note: OpenIddict only negotiates PKI-based or self-signed mutual
// TLS authentication if the certificate explicitly contains the
// "digitalSignature" key usage and the "clientAuth" extended key usage.
var certificate = X509Certificate2.CreateFromPem(
certPem: $"""
-----BEGIN CERTIFICATE-----
MIIC8zCCAdugAwIBAgIJAIZ9BN3TUnZQMA0GCSqGSIb3DQEBCwUAMCIxIDAeBgNV
BAMTF1NlbGYtc2lnbmVkIGNlcnRpZmljYXRlMCAXDTI2MDIwMjE0MzM0OVoYDzIx
MjYwMjAyMTQzMzQ5WjAiMSAwHgYDVQQDExdTZWxmLXNpZ25lZCBjZXJ0aWZpY2F0
ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOtfKVPM7ghVFh4U/sz4
sTrpaNJGQ2NORqawYxAHwluhr101yIOW7rWvFlFncA64Lkq9SAbFFCVSAbo28c6B
2Mi41jyC4LHQU11jhv08K/3FUuckCuzEpzTnXUhxJHWxrRDVEuvKINGPs1VgVtTT
ra8rjP8s1YRAzCYnByxSx+8GXNGHprylLh0agpWKb2+2FYwDqY5ME2g3xTL9FTUu
FYWTcyspsvN0U1Eo1vlCeOxSYGPRct0MK0AS6eXEGBv+3kCYI7a5+UhQok0WvErF
pjIVo7USISDgKhW9GhTsWN+WywwdG4Kx4V6SB8ZLAHFSBSR3gjWS3TGOyqAWoBXc
znkCAwEAAaMqMCgwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
BwMCMA0GCSqGSIb3DQEBCwUAA4IBAQBf5i/S7shmNalVxMuP8/Mk8cOhRRZjnAXd
zz3eOuXu0CH8iY/DwCgss04O2NTxuz87rKiuNKOrtY0oN/G4aFjWPvbgoQ+N1XP1
zvbhqbyo3fQr07FyjWkrIUoHYFQ3JRfL+GPGjWizJsgdpdCRJSK6G9VX8eU3Akjv
YhMRLmbkrH5etOURqFtLpZlxNmLzCpqWIvzRiYyyj74iOipA2I0acgcvkakWn6rE
Wio7luBAZ3dXlukEfHTOg+ft4k0nOlRXPTtASOmyFQBOs6iYJeztHDz6MQnknAPe
+W53US8kLWktspcOQmxhVVH1g1/T4ynl9iX7tzqvUbdYwZNi92+x
-----END CERTIFICATE-----
""",
keyPem: $"""
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA618pU8zuCFUWHhT+zPixOulo0kZDY05GprBjEAfCW6GvXTXI
g5buta8WUWdwDrguSr1IBsUUJVIBujbxzoHYyLjWPILgsdBTXWOG/Twr/cVS5yQK
7MSnNOddSHEkdbGtENUS68og0Y+zVWBW1NOtryuM/yzVhEDMJicHLFLH7wZc0Yem
vKUuHRqClYpvb7YVjAOpjkwTaDfFMv0VNS4VhZNzKymy83RTUSjW+UJ47FJgY9Fy
3QwrQBLp5cQYG/7eQJgjtrn5SFCiTRa8SsWmMhWjtRIhIOAqFb0aFOxY35bLDB0b
grHhXpIHxksAcVIFJHeCNZLdMY7KoBagFdzOeQIDAQABAoIBAQDgBOqov9uuQo2S
hBkfrXPBxnXl7MomslG8RRWEJF5wKCtoY9A8rmL0uXhccj7NQ6+LoyvyhZDvFGZg
ffsXua5DHOmLHmYN12IA+MF6NNMJ7c1CAaQERgd+6tZ2JHm3Kyy1YJdppDAoRMVC
9Tavyej9WE4ScPGntqSXi33gScnRTEGuuC0HydomT/rmguSWx8oPumeWelSTCh9c
vZ9Q1NOnRlW/VrNbYyyByiaWEgdrM2E/z3p+MFgrIsYxnIGQ/Ql1FbT0LxbeIYzc
9MT4cbOlMrD0SZVk9lyxnCs/c1pN7pXDHutmDg6JzSj0xW5AYKzKSvXKjy7+uQay
YVyYh/QhAoGBAPKL1cZJMqwdQBzHMaHChth5cMh8/IkU6m3U7Ll75dztmaLFce+Y
Ova6te/D5Cm/l9pxx+vL5fuAafc2/FTesmKkE2DEERvy4EOQqB1Uho6XEoBBfnJT
0xmNY5Jvh0TfyquS23KvzezT7+epFYNhZDQwgWPnx2z+jwa/zn8Ows/nAoGBAPht
crkmXBMncO7CXzFzFbDghIitW9cZnqBTzKwr2k9lVsbioTIYDbGruvABwI5sN2b4
gJqcvnkun7dmooRPAGX/nMl5UxeGhdSlYGVzHchZz/310MdEg/JThIV219sHR5fd
pBlrydWDyfDTkiGZHDiYUzuZ6hCyOjf+MUgGlyKfAoGBAKYblF1G9hgftC/BT8Fb
quQIT3BPANiU5XQwtarWKndilax/EmenVwJwnndFLjZVS5dEA0n+i1Px/yBanPc2
yO57NfY4cQs2C9bZ8/iaUcjHt9j0gbekptdCGKZKEVbe+TsFyZrCwgHmp8984gnn
IiwH6CVWsCJ6N9PEepRTtKGTAoGAV/wTdKW0WIhQhA9NPas/1GxAJFQZwd3uA2SK
ibPiVtpSWJAtfRttxi5HP/eu5gJHwO1kRt4ay7qKkJ8GEgwU3Qsh0W1p01wui/ii
YmvZ8Xp1osFr1xdaD/oqZkaH/qfeYFf8ZZB6ZGePnv6fs8yRZS311JcXgiBNZEVf
2N2Uq4sCgYAoVe3zkP37MjIH6nykFiR396den5ZyMflR42QtO0Z2QJuQKs6yZ7ii
cqQy4r1Z2i6bdtUlesyGF5U7BPvcers/Mczax0u81Y2S9PdIsv8cw8sr8M6HHiS3
IWBJpVJNyoHKLusRTYVqti+b5EHXQ55FZ9EJggvceGbcBamZ+ynYrg==
-----END RSA PRIVATE KEY-----
""");
// On Windows, a certificate loaded from PEM-encoded material is ephemeral and
// cannot be directly used with TLS, as Schannel cannot access it in this case.
//
// To work this limitation, the certificate is exported and re-imported from a
// PFX blob to ensure the private key is persisted in a way that Schannel can use.
//
// In a real world application, the certificate wouldn't be embedded in the source code
// and would be installed in the certificate store, making this workaround unnecessary.
if (OperatingSystem.IsWindows())
{
certificate = X509CertificateLoader.LoadPkcs12(
data: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
}
return new X509SigningCredentials(certificate);
}
static SigningCredentials GetSigningKey()
{
var algorithm = ECDsa.Create();
algorithm.ImportFromPem($"""
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIMGxf/eMzKuW2F8KKWPJo3bwlrO68rK5+xCeO1atwja2oAoGCCqGSM49
AwEHoUQDQgAEI23kaVsRRAWIez/pqEZOByJFmlXda6iSQ4QqcH23Ir8aYPPX5lsV
nBsExNsl7SOYOiIhgTaX6+PTS7yxTnmvSw==
-----END EC PRIVATE KEY-----
""");
var key = new ECDsaSecurityKey(algorithm);
return new SigningCredentials(key, SecurityAlgorithms.EcdsaSha256, SecurityAlgorithms.Sha256);
}
#pragma warning restore CS8321

432
sandbox/OpenIddict.Sandbox.AspNetCore.Client/Startup.cs

@ -1,432 +0,0 @@
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using OpenIddict.Client;
using OpenIddict.Client.WebIntegration;
using OpenIddict.Sandbox.AspNetCore.Client.Models;
using Quartz;
using static OpenIddict.Abstractions.OpenIddictConstants;
namespace OpenIddict.Sandbox.AspNetCore.Client;
public class Startup
{
public Startup(IConfiguration configuration)
=> Configuration = configuration;
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
{
// Configure the context to use Microsoft SQL Server.
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-aspnetcore-client.sqlite3")}");
// Register the entity sets needed by OpenIddict.
// Note: use the generic overload if you need
// to replace the default OpenIddict entities.
options.UseOpenIddict();
});
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.LoginPath = "/login";
options.LogoutPath = "/logout";
options.ExpireTimeSpan = TimeSpan.FromMinutes(50);
options.SlidingExpiration = false;
});
// OpenIddict offers native integration with Quartz.NET to perform scheduled tasks
// (like pruning orphaned authorizations from the database) at regular intervals.
services.AddQuartz(options =>
{
options.UseSimpleTypeLoader();
options.UseInMemoryStore();
});
// Register the Quartz.NET service and configure it to block shutdown until jobs are complete.
services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);
services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<ApplicationDbContext>();
// Developers who prefer using MongoDB can remove the previous lines
// and configure OpenIddict to use the specified MongoDB database:
// options.UseMongoDb()
// .UseDatabase(new MongoClient().GetDatabase("openiddict"));
// Enable Quartz.NET integration.
options.UseQuartz();
})
// Register the OpenIddict client components.
.AddClient(options =>
{
// Note: this sample uses the authorization code and refresh token
// flows, but you can enable the other flows if necessary.
options.AllowAuthorizationCodeFlow()
.AllowRefreshTokenFlow();
// Register the signing and encryption credentials used to protect
// sensitive data like the state tokens produced by OpenIddict.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableRedirectionEndpointPassthrough()
.EnablePostLogoutRedirectionEndpointPassthrough();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
// providers that use the user agent as a way to throttle requests (e.g Reddit).
options.UseSystemNetHttp()
.SetProductInformation(typeof(Startup).Assembly);
// Add a client registration matching the client application definition in the server project.
options.AddRegistration(new OpenIddictClientRegistration
{
Issuer = new Uri("https://localhost:44395/", UriKind.Absolute),
ProviderName = "Local",
ProviderDisplayName = "Local OIDC server",
ClientId = "mvc",
Scopes = { Scopes.Email, Scopes.Profile, Scopes.OfflineAccess, "demo_api" },
RedirectUri = new Uri("callback/login/local", UriKind.Relative),
PostLogoutRedirectUri = new Uri("callback/logout/local", UriKind.Relative),
#if SUPPORTS_PEM_ENCODED_KEY_IMPORT
// On supported platforms, this application can authenticate using 3 different client
// authentication methods that all offer a higher security level than shared client secrets:
//
// 1) tls_client_auth (PKI-based mutual TLS authentication): while it requires
// setting up a proper Public Key Infrastructure, this method offers a very
// high level of security, as the authorization server never has access to the
// private key used by the client to authenticate itself and can dynamically check
// the revocation status of the client certificate using standard PKI mechanisms.
//
// 2) self_signed_tls_client_auth (self-signed certificate-based mutual TLS authentication):
// this method is easier to deploy than PKI-based mutual TLS authentication, while
// still offering a high level of security. Unlike PKI-based mutual TLS authentication,
// the revocation status of the client certificate is never checked but certificates can
// be "revoked" by being removed from the JSON Web Key Set associated with the client.
//
// 3) private_key_jwt (JWT client assertions signed with a private key): while this
// method doesn't offer the same security guarantees as mutual TLS authentication,
// it is more secure than shared secrets and doesn't have the operational constraints
// required by the two mutual TLS methods described above (such as TLS configuration).
//
// The actual client authentication method used by the OpenIddict client is automatically
// selected based on the registered credentials and the methods supported by the server:
// when supported by the server, mutual TLS authentication methods are always preferred.
//
// In all cases, no client secret is necessary but the client needs to be able to access the
// private key of the certificate/key to be able to generate and sign the client assertions.
SigningCredentials =
{
// Note: this certificate can be used with either tls_client_auth or private_key_jwt,
// depending on the server configuration (and the client authentication methods explicitly
// configured via OpenIddictClientRegistration.ClientAuthenticationMethods, if applicable).
//
GetPublicKeyInfrastructureCertificate(),
// Note: this certificate can be used with either self_signed_tls_client_auth or private_key_jwt,
// depending on the server configuration (and the client authentication methods explicitly
// configured via OpenIddictClientRegistration.ClientAuthenticationMethods, if applicable):
//
// GetSelfSignedCertificate(),
// Note: this key can only be used with private_key_jwt as raw keys cannot be used with TLS.
// GetSigningKey()
},
#else
ClientSecret = "emCimpdc9SeOaZzN5jzm4_eek-STF6VenfVlKO1_qt0"
#endif
});
// Register the Web providers integrations.
//
// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint
// URI per provider, unless all the registered providers support returning a special "iss"
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
.AddGitHub(options =>
{
options.SetClientId("c4ade52327b01ddacff3")
.SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
.SetRedirectUri("callback/login/github");
})
.AddGoogle(options =>
{
options.SetClientId("1016114395689-kgtgq2p6dj27d7v6e2kjkoj54dgrrckh.apps.googleusercontent.com")
.SetClientSecret("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")
.SetRedirectUri("callback/login/google")
.SetAccessType(OpenIddictClientWebIntegrationConstants.Google.AccessTypes.Offline)
.AddScopes(Scopes.Profile);
})
.AddReddit(options =>
{
options.SetClientId("vDLNqhrkwrvqHgnoBWF3og")
.SetClientSecret("Tpab28Dz0upyZLqn7AN3GFD1O-zaAw")
.SetRedirectUri("callback/login/reddit")
.SetDuration(OpenIddictClientWebIntegrationConstants.Reddit.Durations.Permanent);
});
});
// Register a named HTTP client that will be used to call the demo resource API.
//
// Note: since the authorization server is configured to issue certificate-bound
// access tokens, the client certificate MUST be attached to outgoing HTTP requests
// and the mTLS subdomain (for which TLS client authentication is enabled) MUST be used.
services.AddHttpClient("ApiClient")
#if SUPPORTS_KEYED_HTTP_CLIENT_RESOLUTION
.AddAsKeyed()
#endif
#if SUPPORTS_PEM_ENCODED_KEY_IMPORT
.ConfigureHttpClient(static client => client.BaseAddress = new Uri("https://mtls.dev.localhost:44395/"))
.ConfigurePrimaryHttpMessageHandler(static () => new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ClientCertificates = { GetPublicKeyInfrastructureCertificate().Certificate }
});
#else
.ConfigureHttpClient(static client => client.BaseAddress = new Uri("https://localhost:44395/"));
#endif
#if !SUPPORTS_KEYED_HTTP_CLIENT_RESOLUTION
services.AddKeyedScoped("ApiClient", static (provider, name) =>
{
var factory = provider.GetRequiredService<IHttpClientFactory>();
return factory.CreateClient((string) name!);
});
#endif
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseStatusCodePagesWithReExecute("/error");
#if SUPPORTS_ENDPOINT_ROUTING
app.UseRouting();
#endif
app.UseAuthentication();
#if SUPPORTS_AUTHORIZATION_MIDDLEWARE
app.UseAuthorization();
#endif
#if SUPPORTS_ENDPOINT_ROUTING
app.UseEndpoints(options =>
{
options.MapControllers();
options.MapDefaultControllerRoute();
});
#else
app.UseMvcWithDefaultRoute();
#endif
}
#if SUPPORTS_PEM_ENCODED_KEY_IMPORT
#pragma warning disable CS8321
static X509SigningCredentials GetPublicKeyInfrastructureCertificate()
{
// Note: OpenIddict only negotiates PKI-based or self-signed mutual
// TLS authentication if the certificate explicitly contains the
// "digitalSignature" key usage and the "clientAuth" extended key usage.
var certificate = X509Certificate2.CreateFromPem(
certPem: $"""
-----BEGIN CERTIFICATE-----
MIIEezCCAmOgAwIBAgIRALTZE9ezjPCWDFr38cp6AMAwDQYJKoZIhvcNAQELBQAw
GjEYMBYGA1UEAxMPSW50ZXJtZWRpYXRlIENBMCAXDTI2MDIwMTE0MTQ0M1oYDzIx
MjYwMjAyMTQxNDQzWjAaMRgwFgYDVQQDEw9FbmQgY2VydGlmaWNhdGUwggEiMA0G
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMs9spnvKeKw6VwPbpB47ikC6bL0Cn
S+K19Fp8dJg8b4dA1J1Y8dA2gi2nU/+ntOMYp1A6EvMZ8UpbgnSmhUN/2JQFU5Hc
PP0/IMjZAl2Iseh2yiK3Ril4Agbng6YW7e9P5YtMV+6i/stYujwNTXsUMr/+QSUI
Nze7856XSIl9gRjWEKJ17Jk/tJpun/zdpl4hXcptrsxxLU/E03bC3LcjiXzg8/Zl
3/oEHqcHfv9C8RTdIBBw66zJAYzGfxwV31cJ9QQ2udlipi2l+ZR6jFWzzJI4XmiC
FzdwZRvhMLJsyK5miVIl0qPp3zJ2IyEb/2pLA0bc/ylZwVq6Z49k2xhZAgMBAAGj
gbkwgbYwDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCB4AwFgYDVR0lAQH/BAww
CgYIKwYBBQUHAwIwHQYDVR0OBBYEFHPamNF/deBBv5JpDwiiRctPw4ziMEkGA1Ud
IwRCMECAFOEWwW18w3rZ6/5iIwAB12592OlHoRakFDASMRAwDgYDVQQDEwdSb290
IENBghBvqw/xqI/LNgVfSURP9ck7MBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkq
hkiG9w0BAQsFAAOCAgEAbBq73JzDpK11hoRUxHq7LvplQEe/FNuD/slvn9Crfm2d
jJj0HsQQZpMgxP7SZ9FNvFqCo+/dm9PchIlwqwSjWtTxgYmcMOXw0Rzst85Ug4U1
I2PG6iPxJ4WLSW2gzo//jFPa7MD1AnqDYwcCQTVsQW6aJavY3mFD31SJKsvSKqsV
6xTXsajLRetCSXGe5qFgfyLC9tOhtTWXsCed/ISoQ9bljhOSqT6pxkpOVu0AHHMB
1CMZay/B5ecjb66mwSoRcAPweMlAYJkjU5HXHSi7kB3gRQTsb1ZymEn67Q4C5cpI
Lq6UFK5bWZf1A0kFbYJBmn3oHsWxMQqv0F6QE7r4Mg6pfk9swzYZ8WqcgjiGHQET
pVU7ZKkUsg2JREXxRnhh5+Q+vGsF/DjhzQ6NrfPm8sqs+X+LzUN2cne8ZPclfyW2
VKCHTPZ6o8mELiAlIPdBYUYsgUEOsfmUWbx4wfx5IB7vnenrenInLLyGOOCxR33d
o/gDMLFdeKHXK2ISsbDCk+zwEF8kztn1cXWK+K6H9cr8oJjDi1OJwTkqz9msar+9
mjZ1CPAF0X+mLgrhVnNYqd5oqeeLerXKkAvpC2TgvlWJRGyDILhjva3J+2fQAYXZ
+OKFHNPf3n8Co4s5TMr1eiGVtS1etH6hPxnn5Jwnes9JZWFRLcjeTmPLSRWFucg=
-----END CERTIFICATE-----
""",
keyPem: $"""
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAzLPbKZ7ynisOlcD26QeO4pAumy9Ap0vitfRafHSYPG+HQNSd
WPHQNoItp1P/p7TjGKdQOhLzGfFKW4J0poVDf9iUBVOR3Dz9PyDI2QJdiLHodsoi
t0YpeAIG54OmFu3vT+WLTFfuov7LWLo8DU17FDK//kElCDc3u/Oel0iJfYEY1hCi
deyZP7Sabp/83aZeIV3Kba7McS1PxNN2wty3I4l84PP2Zd/6BB6nB37/QvEU3SAQ
cOusyQGMxn8cFd9XCfUENrnZYqYtpfmUeoxVs8ySOF5oghc3cGUb4TCybMiuZolS
JdKj6d8ydiMhG/9qSwNG3P8pWcFaumePZNsYWQIDAQABAoIBACorfyHC4d5dpmKJ
XxRAf1oDM+a6REpyoqCzVxS+fEIvA6ECa+vP3QHtrXQEJO2qoQIKLcfY8YXNpHDX
nipT18T1nADA55KEafNgUKAMEbLAW9Bk8ePpq09Ss5NsFoIwwBUoh5rRnpKrhL6h
lw9yf8F4dv7s8rEPlwa8OFaYFeLpoBLsPaX3nMu45CKb25dFZzSv9ORVs28LALrS
oK9MbtNFkmf/4EmpYA+nblkZd2bu4BomOF7C2F4bwtikN29vl4NPMhlbZGTy1hm9
jzMOOvO1DwvIjHRVcfHKMDZ7cw1Pj5TmeApToSs6ygu1lce0GQcNVm+KV2qZMjNQ
Al6cdFUCgYEA7HZ6wvZU/WA7ei+jIwrJdyQQ3jU/LAu7GGhXiMU3z2RSR/vieY5R
4IjQOgUkLBuQcy9uoQcSLpH/SNLIi6qhlMBvZuHq9QKF60t68tuW0PFSoa+SKaEn
DCZ70bnxo4OSRUtrzxikYHnwOvRGEli4EAOENETaQBKJUUygov/pOWMCgYEA3Z2a
TJlptRq75G6LHZvbBBzZdG9Mr04O6zvh5TGsJW86b6ov9BTAGz6Z37KWR1yUDfyH
dqNf90kJ8hs1eO6gGDQyGaH9yerrlULukANQfvpC0rEeJ7DfXSc1iLa3Q6+AOt5v
9TkQY7s/47iOPoCmblZ4FeVcIMx88ms2mBRXshMCgYAN9pkdNiqio7Ifbvy1Lwfi
jzCnzoEierbbpB23J9450vTA53DiOLNBDRMuuer+58nJ430m6SH7ugdXJ4tMJBFS
lWJ+ssyLF1ENKfHisXDgeb+laJa6+pcxsnwRUGeifjx+9wswuYXLZKf48z/ICZEk
8PA3nfE9Y1rUgC/kMDR3fQKBgQCyQRRdTICUJV7ATJIlTLmLw1C9sNBzqUuitlXq
rluS+LZ+HtvXbeFfiKjoH5N07ug/n8GuEZcdJmiTjoMiNH4dOc6ag4vJH+ZB9sZA
nAnhOJcLNV/V+RSQrvsGbkFWdhGkSEqxaibesTyghFAVwhEcavzIT+Yck55ktwwA
o0wudQKBgQDR0hyl/cf6MBgZ3gce6dOcznLKoa2icypmmfNkA6sqwXwW20/WfDGb
ZNdaL4U3xReSN1mzrs0yStq0UrAChwrwqJc6T7uhGR/lDjvJCeZP9zO2yCSBvtul
LWFkJnofc7NUYkhVSGaAMeT14xUY/XlFbkXp0jZOqKMRo7PeeeXZaQ==
-----END RSA PRIVATE KEY-----
""");
// On Windows, a certificate loaded from PEM-encoded material is ephemeral and
// cannot be directly used with TLS, as Schannel cannot access it in this case.
//
// To work this limitation, the certificate is exported and re-imported from a
// PFX blob to ensure the private key is persisted in a way that Schannel can use.
//
// In a real world application, the certificate wouldn't be embedded in the source code
// and would be installed in the certificate store, making this workaround unnecessary.
if (OperatingSystem.IsWindows())
{
certificate = X509CertificateLoader.LoadPkcs12(
data: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
}
return new X509SigningCredentials(certificate);
}
static X509SigningCredentials GetSelfSignedCertificate()
{
// Note: OpenIddict only negotiates PKI-based or self-signed mutual
// TLS authentication if the certificate explicitly contains the
// "digitalSignature" key usage and the "clientAuth" extended key usage.
var certificate = X509Certificate2.CreateFromPem(
certPem: $"""
-----BEGIN CERTIFICATE-----
MIIC8zCCAdugAwIBAgIJAIZ9BN3TUnZQMA0GCSqGSIb3DQEBCwUAMCIxIDAeBgNV
BAMTF1NlbGYtc2lnbmVkIGNlcnRpZmljYXRlMCAXDTI2MDIwMjE0MzM0OVoYDzIx
MjYwMjAyMTQzMzQ5WjAiMSAwHgYDVQQDExdTZWxmLXNpZ25lZCBjZXJ0aWZpY2F0
ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOtfKVPM7ghVFh4U/sz4
sTrpaNJGQ2NORqawYxAHwluhr101yIOW7rWvFlFncA64Lkq9SAbFFCVSAbo28c6B
2Mi41jyC4LHQU11jhv08K/3FUuckCuzEpzTnXUhxJHWxrRDVEuvKINGPs1VgVtTT
ra8rjP8s1YRAzCYnByxSx+8GXNGHprylLh0agpWKb2+2FYwDqY5ME2g3xTL9FTUu
FYWTcyspsvN0U1Eo1vlCeOxSYGPRct0MK0AS6eXEGBv+3kCYI7a5+UhQok0WvErF
pjIVo7USISDgKhW9GhTsWN+WywwdG4Kx4V6SB8ZLAHFSBSR3gjWS3TGOyqAWoBXc
znkCAwEAAaMqMCgwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
BwMCMA0GCSqGSIb3DQEBCwUAA4IBAQBf5i/S7shmNalVxMuP8/Mk8cOhRRZjnAXd
zz3eOuXu0CH8iY/DwCgss04O2NTxuz87rKiuNKOrtY0oN/G4aFjWPvbgoQ+N1XP1
zvbhqbyo3fQr07FyjWkrIUoHYFQ3JRfL+GPGjWizJsgdpdCRJSK6G9VX8eU3Akjv
YhMRLmbkrH5etOURqFtLpZlxNmLzCpqWIvzRiYyyj74iOipA2I0acgcvkakWn6rE
Wio7luBAZ3dXlukEfHTOg+ft4k0nOlRXPTtASOmyFQBOs6iYJeztHDz6MQnknAPe
+W53US8kLWktspcOQmxhVVH1g1/T4ynl9iX7tzqvUbdYwZNi92+x
-----END CERTIFICATE-----
""",
keyPem: $"""
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA618pU8zuCFUWHhT+zPixOulo0kZDY05GprBjEAfCW6GvXTXI
g5buta8WUWdwDrguSr1IBsUUJVIBujbxzoHYyLjWPILgsdBTXWOG/Twr/cVS5yQK
7MSnNOddSHEkdbGtENUS68og0Y+zVWBW1NOtryuM/yzVhEDMJicHLFLH7wZc0Yem
vKUuHRqClYpvb7YVjAOpjkwTaDfFMv0VNS4VhZNzKymy83RTUSjW+UJ47FJgY9Fy
3QwrQBLp5cQYG/7eQJgjtrn5SFCiTRa8SsWmMhWjtRIhIOAqFb0aFOxY35bLDB0b
grHhXpIHxksAcVIFJHeCNZLdMY7KoBagFdzOeQIDAQABAoIBAQDgBOqov9uuQo2S
hBkfrXPBxnXl7MomslG8RRWEJF5wKCtoY9A8rmL0uXhccj7NQ6+LoyvyhZDvFGZg
ffsXua5DHOmLHmYN12IA+MF6NNMJ7c1CAaQERgd+6tZ2JHm3Kyy1YJdppDAoRMVC
9Tavyej9WE4ScPGntqSXi33gScnRTEGuuC0HydomT/rmguSWx8oPumeWelSTCh9c
vZ9Q1NOnRlW/VrNbYyyByiaWEgdrM2E/z3p+MFgrIsYxnIGQ/Ql1FbT0LxbeIYzc
9MT4cbOlMrD0SZVk9lyxnCs/c1pN7pXDHutmDg6JzSj0xW5AYKzKSvXKjy7+uQay
YVyYh/QhAoGBAPKL1cZJMqwdQBzHMaHChth5cMh8/IkU6m3U7Ll75dztmaLFce+Y
Ova6te/D5Cm/l9pxx+vL5fuAafc2/FTesmKkE2DEERvy4EOQqB1Uho6XEoBBfnJT
0xmNY5Jvh0TfyquS23KvzezT7+epFYNhZDQwgWPnx2z+jwa/zn8Ows/nAoGBAPht
crkmXBMncO7CXzFzFbDghIitW9cZnqBTzKwr2k9lVsbioTIYDbGruvABwI5sN2b4
gJqcvnkun7dmooRPAGX/nMl5UxeGhdSlYGVzHchZz/310MdEg/JThIV219sHR5fd
pBlrydWDyfDTkiGZHDiYUzuZ6hCyOjf+MUgGlyKfAoGBAKYblF1G9hgftC/BT8Fb
quQIT3BPANiU5XQwtarWKndilax/EmenVwJwnndFLjZVS5dEA0n+i1Px/yBanPc2
yO57NfY4cQs2C9bZ8/iaUcjHt9j0gbekptdCGKZKEVbe+TsFyZrCwgHmp8984gnn
IiwH6CVWsCJ6N9PEepRTtKGTAoGAV/wTdKW0WIhQhA9NPas/1GxAJFQZwd3uA2SK
ibPiVtpSWJAtfRttxi5HP/eu5gJHwO1kRt4ay7qKkJ8GEgwU3Qsh0W1p01wui/ii
YmvZ8Xp1osFr1xdaD/oqZkaH/qfeYFf8ZZB6ZGePnv6fs8yRZS311JcXgiBNZEVf
2N2Uq4sCgYAoVe3zkP37MjIH6nykFiR396den5ZyMflR42QtO0Z2QJuQKs6yZ7ii
cqQy4r1Z2i6bdtUlesyGF5U7BPvcers/Mczax0u81Y2S9PdIsv8cw8sr8M6HHiS3
IWBJpVJNyoHKLusRTYVqti+b5EHXQ55FZ9EJggvceGbcBamZ+ynYrg==
-----END RSA PRIVATE KEY-----
""");
// On Windows, a certificate loaded from PEM-encoded material is ephemeral and
// cannot be directly used with TLS, as Schannel cannot access it in this case.
//
// To work this limitation, the certificate is exported and re-imported from a
// PFX blob to ensure the private key is persisted in a way that Schannel can use.
//
// In a real world application, the certificate wouldn't be embedded in the source code
// and would be installed in the certificate store, making this workaround unnecessary.
if (OperatingSystem.IsWindows())
{
certificate = X509CertificateLoader.LoadPkcs12(
data: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
}
return new X509SigningCredentials(certificate);
}
static SigningCredentials GetSigningKey()
{
var algorithm = ECDsa.Create();
algorithm.ImportFromPem($"""
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIMGxf/eMzKuW2F8KKWPJo3bwlrO68rK5+xCeO1atwja2oAoGCCqGSM49
AwEHoUQDQgAEI23kaVsRRAWIez/pqEZOByJFmlXda6iSQ4QqcH23Ir8aYPPX5lsV
nBsExNsl7SOYOiIhgTaX6+PTS7yxTnmvSw==
-----END EC PRIVATE KEY-----
""");
var key = new ECDsaSecurityKey(algorithm);
return new SigningCredentials(key, SecurityAlgorithms.EcdsaSha256, SecurityAlgorithms.Sha256);
}
#pragma warning restore CS8321
#endif
}

7
sandbox/OpenIddict.Sandbox.AspNetCore.Server/Controllers/AuthenticationController.cs

@ -117,18 +117,11 @@ public class AuthenticationController : Controller
OpenIddictClientAspNetCoreConstants.Tokens.BackchannelAccessToken or
OpenIddictClientAspNetCoreConstants.Tokens.RefreshToken));
#if SUPPORTS_REDIRECTION_ON_SIGN_IN
// Ask the default sign-in handler to return a new cookie and redirect the
// user agent to the return URL stored in the authentication properties.
//
// For scenarios where the default sign-in handler configured in the ASP.NET Core
// authentication options shouldn't be used, a specific scheme can be specified here.
return SignIn(new ClaimsPrincipal(identity), properties);
#else
// Note: "return SignIn(...)" cannot be directly used as-is on ASP.NET Core <7.0, as the cookies handler
// doesn't allow redirecting from an endpoint that doesn't match the path set in the cookie options.
await HttpContext.SignInAsync(new ClaimsPrincipal(identity), properties);
return Redirect(properties.RedirectUri ?? "/");
#endif
}
}

28
sandbox/OpenIddict.Sandbox.AspNetCore.Server/Helpers/AsyncEnumerableExtensions.cs

@ -1,28 +0,0 @@
#if !SUPPORTS_ASYNC_LINQ
namespace OpenIddict.Sandbox.AspNetCore.Server.Helpers;
public static class AsyncEnumerableExtensions
{
public static Task<List<T>> ToListAsync<T>(this IAsyncEnumerable<T> source)
{
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
return ExecuteAsync();
async Task<List<T>> ExecuteAsync()
{
var list = new List<T>();
await foreach (var element in source)
{
list.Add(element);
}
return list;
}
}
}
#endif

15
sandbox/OpenIddict.Sandbox.AspNetCore.Server/OpenIddict.Sandbox.AspNetCore.Server.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net48;net10.0</TargetFrameworks>
<TargetFramework>net10.0</TargetFramework>
<TypeScriptEnabled>false</TypeScriptEnabled>
</PropertyGroup>
@ -18,17 +18,4 @@
<PackageReference Include="Quartz.Extensions.Hosting" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<!--
Note: Microsoft.AspNetCore.Identity and Microsoft.AspNetCore.Server.Kestrel.Core are explicitly
referenced to override vulnerable versions referenced by other packages or metapackages.
-->
<PackageReference Include="Microsoft.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Identity" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" />
</ItemGroup>
</Project>

383
sandbox/OpenIddict.Sandbox.AspNetCore.Server/Program.cs

@ -1,23 +1,384 @@
using System.Globalization;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Https;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using OpenIddict.Abstractions;
using OpenIddict.Sandbox.AspNetCore.Server;
using OpenIddict.Sandbox.AspNetCore.Server.Models;
using OpenIddict.Sandbox.AspNetCore.Server.Services;
using Quartz;
using static OpenIddict.Abstractions.OpenIddictConstants;
#if SUPPORTS_WEB_INTEGRATION_IN_GENERIC_HOST
var builder = Host.CreateDefaultBuilder(args);
builder.ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
#else
var builder = WebHost.CreateDefaultBuilder(args);
builder.UseStartup<Startup>();
#endif
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMvc();
builder.Services.AddDbContext<ApplicationDbContext>(options =>
{
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-aspnetcore-server.sqlite3")}");
options.UseOpenIddict();
});
// Register the Identity builder.Services.
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
// OpenIddict offers native integration with Quartz.NET to perform scheduled tasks
// (like pruning orphaned authorizations/tokens from the database) at regular intervals.
builder.Services.AddQuartz(options =>
{
options.UseSimpleTypeLoader();
options.UseInMemoryStore();
});
// Register the Quartz.NET service and configure it to block shutdown until jobs are complete.
builder.Services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);
builder.Services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
// Configure OpenIddict to use the Entity Framework Core stores and models.
options.UseEntityFrameworkCore()
.UseDbContext<ApplicationDbContext>();
// Developers who prefer using MongoDB can remove the previous lines
// and configure OpenIddict to use the specified MongoDB database:
// options.UseMongoDb()
// .UseDatabase(new MongoClient().GetDatabase("openiddict"));
// Enable Quartz.NET integration.
options.UseQuartz();
})
// Register the OpenIddict client components.
.AddClient(options =>
{
// Note: this sample uses the code flow, but you can enable the other flows if necessary.
options.AllowAuthorizationCodeFlow();
// Register the signing and encryption credentials used to protect
// sensitive data like the state tokens produced by OpenIddict.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableRedirectionEndpointPassthrough();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
// providers that use the user agent as a way to throttle requests (e.g Reddit).
options.UseSystemNetHttp()
.SetProductInformation(typeof(Program).Assembly);
// Register the Web providers integrations.
//
// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint
// URI per provider, unless all the registered providers support returning a special "iss"
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
.AddGitHub(options =>
{
options.SetClientId("c4ade52327b01ddacff3")
.SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
.SetRedirectUri("callback/login/github");
});
})
// Register the OpenIddict server components.
.AddServer(options =>
{
// Enable the endpoints that will be used by the client applications.
options.SetAuthorizationEndpointUris("connect/authorize")
.SetDeviceAuthorizationEndpointUris("connect/device")
.SetEndSessionEndpointUris("connect/endsession")
.SetEndUserVerificationEndpointUris("connect/verify")
.SetIntrospectionEndpointUris("connect/introspect")
.SetPushedAuthorizationEndpointUris("connect/par")
.SetRevocationEndpointUris("connect/revoke")
.SetTokenEndpointUris("connect/token")
.SetUserInfoEndpointUris("connect/userinfo");
// Enable the flows that will be used by the client applications.
options.AllowAuthorizationCodeFlow()
.AllowDeviceAuthorizationFlow()
.AllowHybridFlow()
.AllowImplicitFlow()
.AllowNoneFlow()
.AllowPasswordFlow()
.AllowRefreshTokenFlow()
.AllowTokenExchangeFlow();
// Register the public scopes that will be exposed by the configuration endpoint.
options.RegisterScopes(Scopes.Email, Scopes.Profile, Scopes.Roles, "demo_api");
// Register the signing and encryption credentials.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableAuthorizationEndpointPassthrough()
.EnableEndSessionEndpointPassthrough()
.EnableEndUserVerificationEndpointPassthrough()
.EnableTokenEndpointPassthrough()
.EnableUserInfoEndpointPassthrough();
// Note: if you don't want to specify a client_id when sending
// a token or revocation request, uncomment the following line:
//
// options.AcceptAnonymousClients();
// Note: if you want to process authorization and token requests
// that specify non-registered scopes, uncomment the following line:
//
// options.DisableScopeValidation();
// Note: if you don't want to use permissions, you can disable
// permission enforcement by uncommenting the following lines:
//
// options.IgnoreEndpointPermissions()
// .IgnoreGrantTypePermissions()
// .IgnoreResponseTypePermissions()
// .IgnoreScopePermissions();
// Note: when issuing access tokens used by third-party APIs
// you don't own, you can disable access token encryption:
//
// options.DisableAccessTokenEncryption();
// Enable both tls_client_auth and self_signed_tls_client_auth to allow clients
// to authenticate using either PKI certificates or self-signed certificates.
//
// Note: PKI and self-signed certificate authentication can be enabled independently.
options.EnablePublicKeyInfrastructureTlsClientAuthentication(
[
// Root certificate:
X509Certificate2.CreateFromPem($"""
-----BEGIN CERTIFICATE-----
MIIE7jCCAtagAwIBAgIJAN+SZB+xc7usMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV
BAMTB1Jvb3QgQ0EwIBcNMjYwMjAxMTQxNDQzWhgPMjEyNjAyMDIxNDE0NDNaMBIx
EDAOBgNVBAMTB1Jvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
AQC68DOD6IvsJM0mc7n8bYeNaVe8e0ytJCJozdMPNXAe80vMPP4cVUPFvJ/tbSjX
yhREJ9xz2dYgQAhWCaTnEHY4AaE1Tj2rYqotenDQxs18qqaqoZlcaFfkRUPHRH3Q
iS8D8gbxzlYkjxNsfDJRi0cXFxr4wb4FmSP4ES2DFWWAWbN9wt7Tb2uDiHkjSefZ
Pni5F6fN6nE7wgGMYrdrCiiwJf7jEZiIZ60bsiUnJ5VUX6g4ob469CLocH/q/9Yr
Dad9/+YYp6SuHZilsPmW4X0fziuF/RvtsRLw4bw5jwj69KH3Y0jqUMQoyzz2CIJz
cDMB/MLREgcT9jTVB/M5Pl61DCzR/0d4t6RENpkNqpAIVM0Unp0nDuHPwjoeEZn3
vSvUiGpiYY355GaSl05OE3SOKoRHt4lBXvY43y8fRBMOwlNHYn4eO3ZDuzZYzhfs
68ywK4zUy47Qyn1BgNNqc/KC7kzxeLFxqTg2VJgBeXuJfucwzhOFqkOSfpeIGDK9
8MODFlA3usf5LXxQ7DJhkeBgPkW56BUlYVkenm9ORWe77GnoXL95p2HQUEXATHir
unXFPVcHET6hyegvc9AzSTZFQL4RMO3ZV5ESs+JF/YY4ycBc1+WYy2kAuP5sfsGn
mpeKf2Dv9MGFcDxU7iimeM92n7t5lbCRlX8NUaYeQ8jKgQIDAQABo0UwQzASBgNV
HRMBAf8ECDAGAQH/AgEBMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUyHIqQnw/
x6e92OuJ+y+e0LSKSqQwDQYJKoZIhvcNAQELBQADggIBACCOjX4+RyoZt9tVoKdT
uGFoEJUGBUfcYaMdqiDstuSoNrqZXHnilzj33ZbNqj6X6rS1w5qVnkj7ZY4Wu8MP
Sj85Wp9cq0jMv3NfPZfKmJd2K7favGQKvgSPptSl9VgcIrpRam9BG2db1IP053tf
ydBB3w/yI7MTb4fkPqLWtKcuPPM8t9SsxAlKhEm+gbNEsqDX9ZIfxolHEpL2zLOi
a4v7+SlJdVBfo4mj+iLUeZXFRPglAnPQ3CZngfbPsjEklpOCU1v8TnhHwV8jyCgl
oLAceLjdlXHWVfhKU+N0jdAt8V2NPxq+yJ/gPX+J3YOrYRCHMdQZ/OFEUhmkxHNp
UUPkL1VJ9c8ZW2/gszFPyvsh7GHwl43y7bN8doiQVOSj6jZ7uCkQl1oz731fl97b
FqKVyGGx6UUEi57YS7mWsY02qNvYSObOxhSNusX/Ct06XbXS1Pn+co/3FMGMcEVf
IwzboV61sMqRu4l3YD0Z1AxdhXFERMlHBYyyj8CQYIXtnCUoeT40IIR3aFmEG5u8
/lwehTnV4slDDMJMFSW54aENpT1XP4b8m46kioNhxN+7ukdcWnYoapePuiDRboA3
GwRExwFUDiGO8zpnyvV4JTIGu9MZi51O3RbSlIDDhyzFsdQW3PeztwGjZWZAXD+7
qIoAaBbG/12cvNeZH7L9Mcpo
-----END CERTIFICATE-----
"""),
// Intermediate certificate (optional):
X509Certificate2.CreateFromPem($"""
-----BEGIN CERTIFICATE-----
MIIFQzCCAyugAwIBAgIQb6sP8aiPyzYFX0lET/XJOzANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQDEwdSb290IENBMCAXDTI2MDIwMTE0MTQ0M1oYDzIxMjYwMjAyMTQx
NDQzWjAaMRgwFgYDVQQDEw9JbnRlcm1lZGlhdGUgQ0EwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCfObzu9v5dfio8kCCKpb0vLXUrilcOM6FGVx50rPtc
MjlHNG4GpghoLXjJxrUIsoeGdsCI6W+K3R+5PRlEsbCT3l/0n2/ixW3rN9rO3FOt
VGOHYrE2wI+i1aWP1/w/0bcCbH1J6PLKPv5syzhWWdkoTy2K72gye5Kx3zXkFQoC
uBFMvj3HBgmTngaDRTT1QGsRSlhuvoEiHHAvgoTfYt7bgbRhM5I5upEbXB0cucj7
Ghzws5R2/4qsr/QorwA8l6aNeb1dm0uB+FlMVlGelYMZ76+SjBs1rOxD0qt82h13
BYPBR4gLvNFafOEskFndeP3OkNaQ6kPm+uClj5OxwONnBcy7neJPqZGMtxpApLK3
reK3IZ/ieg1nY9zZ7OkqIzQDt1CeCBQWU3RkpEtVojkRDLCmg+pKSjHtLxUUGiQ3
UHrXO2Yrej8Qpx4JHdKGUfku25r4SSaj2YF61ZIvsDxlOMROfJUFbpQdyAtQPCCq
zpfkVKaCeCiTlifI6AZODngc9c8U+s7vLxjucz/Q4gNHwcgg/mASbjh8A2hYsbW6
qeg7lE9k5t6Lv820FudjfgFiq7k+zIbNsDNy3Y7CSsgBHQQSyNFngg25PPQOon9c
yd3PiFK36OzktnRkcTs98i3fwO2+3pp6qgOSk1Sdx877egszMjBPFzxrBX9CXIpM
yQIDAQABo4GKMIGHMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgEG
MB0GA1UdDgQWBBThFsFtfMN62ev+YiMAAddufdjpRzBCBgNVHSMEOzA5gBTIcipC
fD/Hp73Y64n7L57QtIpKpKEWpBQwEjEQMA4GA1UEAxMHUm9vdCBDQYIJAN+SZB+x
c7usMA0GCSqGSIb3DQEBCwUAA4ICAQA6sBGs28FWhKgh6TxZ6U8Lc+iCdc4c9PeM
L5pQQosHekT0oBJK8WdvyXZS95Fz2ddJaKiiQyUKSP4XHpxE+6tBt8OOV0LJJxnx
yKTBZtcSiOFssu2j6aqx3oMotRZJrhuI/5ChExaPwFT1W7aQDIY6lN2KcQ/xndbX
Nts/2nwCvlplfiOGM7XrRMU8b4X+AVWXSksvLXiByrDh9W6WGDsBHyu+FKQVnwmW
QVnshKpwxIsW25JDOhFE8+VHn6yciUKUTqnCFt5HjZpZh00q8hhmlhrNBEdkxA8N
OF7S1uWWftJywqq23qG6pGIDQ1r1dwNzgaeNhmW6QKm2zBXUmuOW//Xt+1wtHrly
bDjXKKSa/zhR9plYPdvGe9PopXwTw/fQWRYcxML6aH+WbWY9AgCHFgY56YCJYZd9
eUIfrvPVJLn8fqwLmsWQtIY+XkAS/YQ4wTQs0zZS3+bdxeGQ6oHIMgxCDiBK8Qcc
RHf+RvYHiBllOJmaRaJHdsauMk9IlYYYpxPPwuWGti9B5HI4JO6bIqmR5Q8x3L/g
tFGMPzvWDTA2+dQcrh7WKULDH9Ngnnoodc6Hb9Iv1yCGYahcS6ARt9BzRyG1+6d9
bq/zCH8KQCjryiTn3ZEpsln/iXtp5nHiLegUc1OoXldrUKAz9V93l61GHUw1kdhD
V+KJceDj3Q==
-----END CERTIFICATE-----
""")
]);
options.EnableSelfSignedTlsClientAuthentication();
// Note: setting a static issuer is mandatory when using mTLS aliases to ensure it not
// dynamically computed based on the request URI, as this would result in two different
// issuers being used (one pointing to the mTLS domain and one pointing to the regular one).
options.SetIssuer("https://localhost:44395/");
// Configure the mTLS endpoint aliases that will be used by client applications opting
// for TLS-based client authentication to communicate with the authorization server:
// the configured URIs MUST point to a domain for which the HTTPS server is configured
// to require the use of client certificates when receiving TLS handshakes from clients.
//
// Using mTLS endpoint aliases is not mandatory but is strongly recommended to avoid
// severely degrading the experience of users of browser-based clients, as TLS client
// authentication can only be enforced globally and not per-client, which would result
// in certificate selection prompts being systematically displayed by browsers.
options.SetMtlsDeviceAuthorizationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/device")
.SetMtlsIntrospectionEndpointAliasUri("https://mtls.dev.localhost:44395/connect/introspect")
.SetMtlsPushedAuthorizationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/par")
.SetMtlsRevocationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/revoke")
.SetMtlsTokenEndpointAliasUri("https://mtls.dev.localhost:44395/connect/token")
.SetMtlsUserInfoEndpointAliasUri("https://mtls.dev.localhost:44395/connect/userinfo");
// While public client applications cannot use mTLS for client authentication, they can use
// mTLS purely as a token binding mechanism: in this case, the refresh tokens issued to
// public clients sending a client certificate are automatically bound to the certificate,
// which requires sending the same certificate when using them to get new access tokens.
options.UseClientCertificateBoundRefreshTokens();
// Optionally, the server stack can be configured to issue client certificate-bound access tokens.
//
// When doing so, the standard "cnf" claim is automatically added to access tokens to inform
// resource servers that a proof of possession derived from the certificate must be provided.
options.UseClientCertificateBoundAccessTokens();
})
// Register the OpenIddict validation components.
.AddValidation(options =>
{
// Configure the audience accepted by this resource server.
// The value MUST match the audience associated with the
// "demo_api" scope, which is used by ResourceController.
options.AddAudiences("resource_server");
// Import the configuration from the local OpenIddict server instance.
options.UseLocalServer();
// Instead of validating the token locally by reading it directly,
// introspection can be used to ask a remote authorization server
// to validate the token (and its attached database entry).
//
// options.UseIntrospection()
// .SetIssuer("https://localhost:44395/")
// .SetClientId("resource_server")
// .SetClientSecret("vVQ-yjr42sXP5VHj6AswkXuS7MU1i2gFjvJjY0TdGMk");
//
// When introspection is used, the System.Net.Http integration must be enabled.
//
// options.UseSystemNetHttp();
// Register the ASP.NET Core host.
options.UseAspNetCore();
// For applications that need immediate access token or authorization
// revocation, the database entry of the received tokens and their
// associated authorizations can be validated for each API call.
// Enabling these options may have a negative impact on performance.
//
// options.EnableAuthorizationEntryValidation();
// options.EnableTokenEntryValidation();
});
builder.Services.AddTransient<IEmailSender, AuthMessageSender>();
builder.Services.AddTransient<ISmsSender, AuthMessageSender>();
// Configure Kestrel to listen on the 44395 port and configure it to enforce mTLS.
//
// Note: depending on the operating system, the mtls.dev.localhost
// subdomain MAY have to be manually mapped to 127.0.0.1 or ::1.
builder.Services.Configure<KestrelServerOptions>(options => options.ListenAnyIP(44395, options =>
{
options.UseHttps(new TlsHandshakeCallbackOptions
{
OnConnection = GetServerAuthenticationOptionsAsync
});
static ValueTask<SslServerAuthenticationOptions> GetServerAuthenticationOptionsAsync(TlsHandshakeCallbackContext context)
{
using var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
return ValueTask.FromResult(new SslServerAuthenticationOptions
{
// Require a client certificate for all the requests pointing to the mTLS subdomain.
ClientCertificateRequired = string.Equals(context.ClientHelloInfo.ServerName,
"mtls.dev.localhost", StringComparison.OrdinalIgnoreCase),
// Ignore all the client certificate errors for requests pointing to
// the mTLS-specific domain, even if they indicate that the chain is
// invalid: this is necessary to allow OpenIddict to validate the PKI
// and self-signed certificates using its own per-client chain policies.
RemoteCertificateValidationCallback = (sender, certificate, chain, errors) =>
{
if (string.Equals(context.ClientHelloInfo.ServerName,
"mtls.dev.localhost", StringComparison.OrdinalIgnoreCase))
{
return true;
}
return errors is SslPolicyErrors.None or SslPolicyErrors.RemoteCertificateNotAvailable;
},
// Use the development certificate generated and stored by ASP.NET Core in the user store.
ServerCertificate = store.Certificates
.Find(X509FindType.FindByExtension, "1.3.6.1.4.1.311.84.1.1", validOnly: false)
.Cast<X509Certificate2>()
.Where(static certificate => certificate.NotBefore < TimeProvider.System.GetLocalNow())
.Where(static certificate => certificate.NotAfter > TimeProvider.System.GetLocalNow())
.OrderByDescending(static certificate => certificate.NotAfter)
.FirstOrDefault() ??
throw new InvalidOperationException("The ASP.NET Core HTTPS development certificate was not found.")
});
}
}));
var app = builder.Build();
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseStatusCodePagesWithReExecute("/error");
app.UseRouting();
app.UseRequestLocalization(options =>
{
options.AddSupportedCultures("en-US", "fr-FR");
options.AddSupportedUICultures("en-US", "fr-FR");
options.SetDefaultCulture("en-US");
});
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapDefaultControllerRoute();
// Before starting the host, create the database used to store the application data.
//
// Note: in a real world application, this step should be part of a setup script.
@ -161,7 +522,6 @@ static async Task RegisterApplicationsAsync(IServiceProvider provider)
{
[CultureInfo.GetCultureInfo("fr-FR")] = "Application cliente MVC"
},
#if SUPPORTS_PEM_ENCODED_KEY_IMPORT
JsonWebKeySet = new JsonWebKeySet
{
Keys =
@ -207,7 +567,6 @@ static async Task RegisterApplicationsAsync(IServiceProvider provider)
"""))
}
},
#endif
RedirectUris =
{
new Uri("https://localhost:44381/callback/login/local")
@ -396,7 +755,6 @@ static async Task RegisterApplicationsAsync(IServiceProvider provider)
await manager.CreateAsync(descriptor);
}
#if SUPPORTS_PEM_ENCODED_KEY_IMPORT
static ECDsaSecurityKey GetECDsaSigningKey(ReadOnlySpan<char> key)
{
var algorithm = ECDsa.Create();
@ -404,7 +762,6 @@ static async Task RegisterApplicationsAsync(IServiceProvider provider)
return new ECDsaSecurityKey(algorithm);
}
#endif
}
static async Task RegisterScopesAsync(IServiceProvider provider)

405
sandbox/OpenIddict.Sandbox.AspNetCore.Server/Startup.cs

@ -1,405 +0,0 @@
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Https;
using Microsoft.EntityFrameworkCore;
using OpenIddict.Sandbox.AspNetCore.Server.Models;
using OpenIddict.Sandbox.AspNetCore.Server.Services;
using Quartz;
using static OpenIddict.Abstractions.OpenIddictConstants;
namespace OpenIddict.Sandbox.AspNetCore.Server;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddDbContext<ApplicationDbContext>(options =>
{
// Configure the context to use Microsoft SQL Server.
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-aspnetcore-server.sqlite3")}");
// Register the entity sets needed by OpenIddict.
// Note: use the generic overload if you need
// to replace the default OpenIddict entities.
options.UseOpenIddict();
});
// Register the Identity services.
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
// OpenIddict offers native integration with Quartz.NET to perform scheduled tasks
// (like pruning orphaned authorizations/tokens from the database) at regular intervals.
services.AddQuartz(options =>
{
options.UseSimpleTypeLoader();
options.UseInMemoryStore();
});
// Register the Quartz.NET service and configure it to block shutdown until jobs are complete.
services.AddQuartzHostedService(options => options.WaitForJobsToComplete = true);
services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<ApplicationDbContext>();
// Developers who prefer using MongoDB can remove the previous lines
// and configure OpenIddict to use the specified MongoDB database:
// options.UseMongoDb()
// .UseDatabase(new MongoClient().GetDatabase("openiddict"));
// Enable Quartz.NET integration.
options.UseQuartz();
})
// Register the OpenIddict client components.
.AddClient(options =>
{
// Note: this sample uses the code flow, but you can enable the other flows if necessary.
options.AllowAuthorizationCodeFlow();
// Register the signing and encryption credentials used to protect
// sensitive data like the state tokens produced by OpenIddict.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableRedirectionEndpointPassthrough();
// Register the System.Net.Http integration and use the identity of the current
// assembly as a more specific user agent, which can be useful when dealing with
// providers that use the user agent as a way to throttle requests (e.g Reddit).
options.UseSystemNetHttp()
.SetProductInformation(typeof(Startup).Assembly);
// Register the Web providers integrations.
//
// Note: to mitigate mix-up attacks, it's recommended to use a unique redirection endpoint
// URI per provider, unless all the registered providers support returning a special "iss"
// parameter containing their URL as part of authorization responses. For more information,
// see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.4.
options.UseWebProviders()
.AddGitHub(options =>
{
options.SetClientId("c4ade52327b01ddacff3")
.SetClientSecret("da6bed851b75e317bf6b2cb67013679d9467c122")
.SetRedirectUri("callback/login/github");
});
})
// Register the OpenIddict server components.
.AddServer(options =>
{
// Enable the endpoints that will be used by the client applications.
options.SetAuthorizationEndpointUris("connect/authorize")
.SetDeviceAuthorizationEndpointUris("connect/device")
.SetEndSessionEndpointUris("connect/endsession")
.SetEndUserVerificationEndpointUris("connect/verify")
.SetIntrospectionEndpointUris("connect/introspect")
.SetPushedAuthorizationEndpointUris("connect/par")
.SetRevocationEndpointUris("connect/revoke")
.SetTokenEndpointUris("connect/token")
.SetUserInfoEndpointUris("connect/userinfo");
// Enable the flows that will be used by the client applications.
options.AllowAuthorizationCodeFlow()
.AllowDeviceAuthorizationFlow()
.AllowHybridFlow()
.AllowImplicitFlow()
.AllowNoneFlow()
.AllowPasswordFlow()
.AllowRefreshTokenFlow()
.AllowTokenExchangeFlow();
// Register the public scopes that will be exposed by the configuration endpoint.
options.RegisterScopes(Scopes.Email, Scopes.Profile, Scopes.Roles, "demo_api");
// Register the signing and encryption credentials.
options.AddDevelopmentEncryptionCertificate()
.AddDevelopmentSigningCertificate();
// Register the ASP.NET Core host and configure the ASP.NET Core-specific options.
options.UseAspNetCore()
.EnableStatusCodePagesIntegration()
.EnableAuthorizationEndpointPassthrough()
.EnableEndSessionEndpointPassthrough()
.EnableEndUserVerificationEndpointPassthrough()
.EnableTokenEndpointPassthrough()
.EnableUserInfoEndpointPassthrough();
// Note: if you don't want to specify a client_id when sending
// a token or revocation request, uncomment the following line:
//
// options.AcceptAnonymousClients();
// Note: if you want to process authorization and token requests
// that specify non-registered scopes, uncomment the following line:
//
// options.DisableScopeValidation();
// Note: if you don't want to use permissions, you can disable
// permission enforcement by uncommenting the following lines:
//
// options.IgnoreEndpointPermissions()
// .IgnoreGrantTypePermissions()
// .IgnoreResponseTypePermissions()
// .IgnoreScopePermissions();
// Note: when issuing access tokens used by third-party APIs
// you don't own, you can disable access token encryption:
//
// options.DisableAccessTokenEncryption();
#if SUPPORTS_KESTREL_TLS_HANDSHAKE_CALLBACK_OPTIONS
// Enable both tls_client_auth and self_signed_tls_client_auth to allow clients
// to authenticate using either PKI certificates or self-signed certificates.
//
// Note: PKI and self-signed certificate authentication can be enabled independently.
options.EnablePublicKeyInfrastructureTlsClientAuthentication(
[
// Root certificate:
X509Certificate2.CreateFromPem($"""
-----BEGIN CERTIFICATE-----
MIIE7jCCAtagAwIBAgIJAN+SZB+xc7usMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV
BAMTB1Jvb3QgQ0EwIBcNMjYwMjAxMTQxNDQzWhgPMjEyNjAyMDIxNDE0NDNaMBIx
EDAOBgNVBAMTB1Jvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
AQC68DOD6IvsJM0mc7n8bYeNaVe8e0ytJCJozdMPNXAe80vMPP4cVUPFvJ/tbSjX
yhREJ9xz2dYgQAhWCaTnEHY4AaE1Tj2rYqotenDQxs18qqaqoZlcaFfkRUPHRH3Q
iS8D8gbxzlYkjxNsfDJRi0cXFxr4wb4FmSP4ES2DFWWAWbN9wt7Tb2uDiHkjSefZ
Pni5F6fN6nE7wgGMYrdrCiiwJf7jEZiIZ60bsiUnJ5VUX6g4ob469CLocH/q/9Yr
Dad9/+YYp6SuHZilsPmW4X0fziuF/RvtsRLw4bw5jwj69KH3Y0jqUMQoyzz2CIJz
cDMB/MLREgcT9jTVB/M5Pl61DCzR/0d4t6RENpkNqpAIVM0Unp0nDuHPwjoeEZn3
vSvUiGpiYY355GaSl05OE3SOKoRHt4lBXvY43y8fRBMOwlNHYn4eO3ZDuzZYzhfs
68ywK4zUy47Qyn1BgNNqc/KC7kzxeLFxqTg2VJgBeXuJfucwzhOFqkOSfpeIGDK9
8MODFlA3usf5LXxQ7DJhkeBgPkW56BUlYVkenm9ORWe77GnoXL95p2HQUEXATHir
unXFPVcHET6hyegvc9AzSTZFQL4RMO3ZV5ESs+JF/YY4ycBc1+WYy2kAuP5sfsGn
mpeKf2Dv9MGFcDxU7iimeM92n7t5lbCRlX8NUaYeQ8jKgQIDAQABo0UwQzASBgNV
HRMBAf8ECDAGAQH/AgEBMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUyHIqQnw/
x6e92OuJ+y+e0LSKSqQwDQYJKoZIhvcNAQELBQADggIBACCOjX4+RyoZt9tVoKdT
uGFoEJUGBUfcYaMdqiDstuSoNrqZXHnilzj33ZbNqj6X6rS1w5qVnkj7ZY4Wu8MP
Sj85Wp9cq0jMv3NfPZfKmJd2K7favGQKvgSPptSl9VgcIrpRam9BG2db1IP053tf
ydBB3w/yI7MTb4fkPqLWtKcuPPM8t9SsxAlKhEm+gbNEsqDX9ZIfxolHEpL2zLOi
a4v7+SlJdVBfo4mj+iLUeZXFRPglAnPQ3CZngfbPsjEklpOCU1v8TnhHwV8jyCgl
oLAceLjdlXHWVfhKU+N0jdAt8V2NPxq+yJ/gPX+J3YOrYRCHMdQZ/OFEUhmkxHNp
UUPkL1VJ9c8ZW2/gszFPyvsh7GHwl43y7bN8doiQVOSj6jZ7uCkQl1oz731fl97b
FqKVyGGx6UUEi57YS7mWsY02qNvYSObOxhSNusX/Ct06XbXS1Pn+co/3FMGMcEVf
IwzboV61sMqRu4l3YD0Z1AxdhXFERMlHBYyyj8CQYIXtnCUoeT40IIR3aFmEG5u8
/lwehTnV4slDDMJMFSW54aENpT1XP4b8m46kioNhxN+7ukdcWnYoapePuiDRboA3
GwRExwFUDiGO8zpnyvV4JTIGu9MZi51O3RbSlIDDhyzFsdQW3PeztwGjZWZAXD+7
qIoAaBbG/12cvNeZH7L9Mcpo
-----END CERTIFICATE-----
"""),
// Intermediate certificate (optional):
X509Certificate2.CreateFromPem($"""
-----BEGIN CERTIFICATE-----
MIIFQzCCAyugAwIBAgIQb6sP8aiPyzYFX0lET/XJOzANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQDEwdSb290IENBMCAXDTI2MDIwMTE0MTQ0M1oYDzIxMjYwMjAyMTQx
NDQzWjAaMRgwFgYDVQQDEw9JbnRlcm1lZGlhdGUgQ0EwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCfObzu9v5dfio8kCCKpb0vLXUrilcOM6FGVx50rPtc
MjlHNG4GpghoLXjJxrUIsoeGdsCI6W+K3R+5PRlEsbCT3l/0n2/ixW3rN9rO3FOt
VGOHYrE2wI+i1aWP1/w/0bcCbH1J6PLKPv5syzhWWdkoTy2K72gye5Kx3zXkFQoC
uBFMvj3HBgmTngaDRTT1QGsRSlhuvoEiHHAvgoTfYt7bgbRhM5I5upEbXB0cucj7
Ghzws5R2/4qsr/QorwA8l6aNeb1dm0uB+FlMVlGelYMZ76+SjBs1rOxD0qt82h13
BYPBR4gLvNFafOEskFndeP3OkNaQ6kPm+uClj5OxwONnBcy7neJPqZGMtxpApLK3
reK3IZ/ieg1nY9zZ7OkqIzQDt1CeCBQWU3RkpEtVojkRDLCmg+pKSjHtLxUUGiQ3
UHrXO2Yrej8Qpx4JHdKGUfku25r4SSaj2YF61ZIvsDxlOMROfJUFbpQdyAtQPCCq
zpfkVKaCeCiTlifI6AZODngc9c8U+s7vLxjucz/Q4gNHwcgg/mASbjh8A2hYsbW6
qeg7lE9k5t6Lv820FudjfgFiq7k+zIbNsDNy3Y7CSsgBHQQSyNFngg25PPQOon9c
yd3PiFK36OzktnRkcTs98i3fwO2+3pp6qgOSk1Sdx877egszMjBPFzxrBX9CXIpM
yQIDAQABo4GKMIGHMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgEG
MB0GA1UdDgQWBBThFsFtfMN62ev+YiMAAddufdjpRzBCBgNVHSMEOzA5gBTIcipC
fD/Hp73Y64n7L57QtIpKpKEWpBQwEjEQMA4GA1UEAxMHUm9vdCBDQYIJAN+SZB+x
c7usMA0GCSqGSIb3DQEBCwUAA4ICAQA6sBGs28FWhKgh6TxZ6U8Lc+iCdc4c9PeM
L5pQQosHekT0oBJK8WdvyXZS95Fz2ddJaKiiQyUKSP4XHpxE+6tBt8OOV0LJJxnx
yKTBZtcSiOFssu2j6aqx3oMotRZJrhuI/5ChExaPwFT1W7aQDIY6lN2KcQ/xndbX
Nts/2nwCvlplfiOGM7XrRMU8b4X+AVWXSksvLXiByrDh9W6WGDsBHyu+FKQVnwmW
QVnshKpwxIsW25JDOhFE8+VHn6yciUKUTqnCFt5HjZpZh00q8hhmlhrNBEdkxA8N
OF7S1uWWftJywqq23qG6pGIDQ1r1dwNzgaeNhmW6QKm2zBXUmuOW//Xt+1wtHrly
bDjXKKSa/zhR9plYPdvGe9PopXwTw/fQWRYcxML6aH+WbWY9AgCHFgY56YCJYZd9
eUIfrvPVJLn8fqwLmsWQtIY+XkAS/YQ4wTQs0zZS3+bdxeGQ6oHIMgxCDiBK8Qcc
RHf+RvYHiBllOJmaRaJHdsauMk9IlYYYpxPPwuWGti9B5HI4JO6bIqmR5Q8x3L/g
tFGMPzvWDTA2+dQcrh7WKULDH9Ngnnoodc6Hb9Iv1yCGYahcS6ARt9BzRyG1+6d9
bq/zCH8KQCjryiTn3ZEpsln/iXtp5nHiLegUc1OoXldrUKAz9V93l61GHUw1kdhD
V+KJceDj3Q==
-----END CERTIFICATE-----
""")
]);
options.EnableSelfSignedTlsClientAuthentication();
// Note: setting a static issuer is mandatory when using mTLS aliases to ensure it not
// dynamically computed based on the request URI, as this would result in two different
// issuers being used (one pointing to the mTLS domain and one pointing to the regular one).
options.SetIssuer("https://localhost:44395/");
// Configure the mTLS endpoint aliases that will be used by client applications opting
// for TLS-based client authentication to communicate with the authorization server:
// the configured URIs MUST point to a domain for which the HTTPS server is configured
// to require the use of client certificates when receiving TLS handshakes from clients.
//
// Using mTLS endpoint aliases is not mandatory but is strongly recommended to avoid
// severely degrading the experience of users of browser-based clients, as TLS client
// authentication can only be enforced globally and not per-client, which would result
// in certificate selection prompts being systematically displayed by browsers.
options.SetMtlsDeviceAuthorizationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/device")
.SetMtlsIntrospectionEndpointAliasUri("https://mtls.dev.localhost:44395/connect/introspect")
.SetMtlsPushedAuthorizationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/par")
.SetMtlsRevocationEndpointAliasUri("https://mtls.dev.localhost:44395/connect/revoke")
.SetMtlsTokenEndpointAliasUri("https://mtls.dev.localhost:44395/connect/token")
.SetMtlsUserInfoEndpointAliasUri("https://mtls.dev.localhost:44395/connect/userinfo");
// While public client applications cannot use mTLS for client authentication, they can use
// mTLS purely as a token binding mechanism: in this case, the refresh tokens issued to
// public clients sending a client certificate are automatically bound to the certificate,
// which requires sending the same certificate when using them to get new access tokens.
options.UseClientCertificateBoundRefreshTokens();
// Optionally, the server stack can be configured to issue client certificate-bound access tokens.
//
// When doing so, the standard "cnf" claim is automatically added to access tokens to inform
// resource servers that a proof of possession derived from the certificate must be provided.
options.UseClientCertificateBoundAccessTokens();
#endif
})
// Register the OpenIddict validation components.
.AddValidation(options =>
{
// Configure the audience accepted by this resource server.
// The value MUST match the audience associated with the
// "demo_api" scope, which is used by ResourceController.
options.AddAudiences("resource_server");
// Import the configuration from the local OpenIddict server instance.
options.UseLocalServer();
// Instead of validating the token locally by reading it directly,
// introspection can be used to ask a remote authorization server
// to validate the token (and its attached database entry).
//
// options.UseIntrospection()
// .SetIssuer("https://localhost:44395/")
// .SetClientId("resource_server")
// .SetClientSecret("vVQ-yjr42sXP5VHj6AswkXuS7MU1i2gFjvJjY0TdGMk");
//
// When introspection is used, the System.Net.Http integration must be enabled.
//
// options.UseSystemNetHttp();
// Register the ASP.NET Core host.
options.UseAspNetCore();
// For applications that need immediate access token or authorization
// revocation, the database entry of the received tokens and their
// associated authorizations can be validated for each API call.
// Enabling these options may have a negative impact on performance.
//
// options.EnableAuthorizationEntryValidation();
// options.EnableTokenEntryValidation();
});
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
#if SUPPORTS_KESTREL_TLS_HANDSHAKE_CALLBACK_OPTIONS
// Configure Kestrel to listen on the 44395 port and configure it to enforce mTLS.
//
// Note: depending on the operating system, the mtls.dev.localhost
// subdomain MAY have to be manually mapped to 127.0.0.1 or ::1.
services.Configure<KestrelServerOptions>(options => options.ListenAnyIP(44395, options =>
{
options.UseHttps(new TlsHandshakeCallbackOptions
{
OnConnection = GetServerAuthenticationOptionsAsync
});
}));
static ValueTask<SslServerAuthenticationOptions> GetServerAuthenticationOptionsAsync(TlsHandshakeCallbackContext context)
{
using var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
return ValueTask.FromResult(new SslServerAuthenticationOptions
{
// Require a client certificate for all the requests pointing to the mTLS subdomain.
ClientCertificateRequired = string.Equals(context.ClientHelloInfo.ServerName,
"mtls.dev.localhost", StringComparison.OrdinalIgnoreCase),
// Ignore all the client certificate errors for requests pointing to
// the mTLS-specific domain, even if they indicate that the chain is
// invalid: this is necessary to allow OpenIddict to validate the PKI
// and self-signed certificates using its own per-client chain policies.
RemoteCertificateValidationCallback = (sender, certificate, chain, errors) =>
{
if (string.Equals(context.ClientHelloInfo.ServerName,
"mtls.dev.localhost", StringComparison.OrdinalIgnoreCase))
{
return true;
}
return errors is SslPolicyErrors.None or SslPolicyErrors.RemoteCertificateNotAvailable;
},
// Use the development certificate generated and stored by ASP.NET Core in the user store.
ServerCertificate = store.Certificates
.Find(X509FindType.FindByExtension, "1.3.6.1.4.1.311.84.1.1", validOnly: false)
.Cast<X509Certificate2>()
.Where(static certificate => certificate.NotBefore < TimeProvider.System.GetLocalNow())
.Where(static certificate => certificate.NotAfter > TimeProvider.System.GetLocalNow())
.OrderByDescending(static certificate => certificate.NotAfter)
.FirstOrDefault() ??
throw new InvalidOperationException("The ASP.NET Core HTTPS development certificate was not found.")
});
}
#endif
}
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.UseStatusCodePagesWithReExecute("/error");
#if SUPPORTS_ENDPOINT_ROUTING
app.UseRouting();
#endif
app.UseRequestLocalization(options =>
{
options.AddSupportedCultures("en-US", "fr-FR");
options.AddSupportedUICultures("en-US", "fr-FR");
options.SetDefaultCulture("en-US");
});
app.UseAuthentication();
#if SUPPORTS_AUTHORIZATION_MIDDLEWARE
app.UseAuthorization();
#endif
#if SUPPORTS_ENDPOINT_ROUTING
app.UseEndpoints(options =>
{
options.MapControllers();
options.MapDefaultControllerRoute();
});
#else
app.UseMvcWithDefaultRoute();
#endif
}
}

26
sandbox/OpenIddict.Sandbox.Console.Client/App.config

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SQLite"
type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SQLite"
connectionString="Data Source=|DataDirectory|openiddict-sandbox-console-client.sqlite3;Version=3" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
description=".NET Framework Data Provider for SQLite" />
</DbProviderFactories>
</system.data>
</configuration>

9
sandbox/OpenIddict.Sandbox.Console.Client/InteractiveService.cs

@ -854,7 +854,6 @@ public class InteractiveService : BackgroundService
return Task.Run(Prompt, cancellationToken).WaitAsync(cancellationToken);
}
#if SUPPORTS_CERTIFICATE_GENERATION
static X509Certificate2 GenerateEphemeralTlsClientCertificate()
{
using var algorithm = RSA.Create(keySizeInBits: 4096);
@ -876,21 +875,13 @@ public class InteractiveService : BackgroundService
// and would be installed in the certificate store, making this workaround unnecessary.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
#if SUPPORTS_CERTIFICATE_LOADER
certificate = X509CertificateLoader.LoadPkcs12(
data: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
#else
certificate = new X509Certificate2(
rawData: certificate.Export(X509ContentType.Pfx, string.Empty),
password: string.Empty,
keyStorageFlags: X509KeyStorageFlags.DefaultKeySet);
#endif
}
return certificate;
}
#endif
}
}

46
sandbox/OpenIddict.Sandbox.Console.Client/Models/ApplicationDbContext.cs

@ -0,0 +1,46 @@
#if NET
using Microsoft.EntityFrameworkCore;
#else
using System.Data.Entity;
using SQLite.CodeFirst;
#endif
namespace OpenIddict.Sandbox.Console.Client.Models;
public class ApplicationDbContext : DbContext
{
#if NET
public ApplicationDbContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.UseOpenIddict();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-console-client.sqlite3")}");
}
#else
public ApplicationDbContext()
: base("name=DefaultConnection")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseOpenIddict();
// Override the default database initializer to use the one provided
// by SQLite.CodeFirst, which automatically creates the database.
Database.SetInitializer(new SqliteCreateDatabaseIfNotExists<ApplicationDbContext>(modelBuilder));
}
#endif
}

34
sandbox/OpenIddict.Sandbox.Console.Client/OpenIddict.Sandbox.Console.Client.csproj

@ -1,21 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net10.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks Condition=" $([MSBuild]::IsOSPlatform('Windows')) ">$(TargetFrameworks);net48</TargetFrameworks>
</PropertyGroup>
<!--
Note: the SourceGear.sqlite3 package doesn't support AnyCPU builds and requires the application
to be built as x64, x86 or arm64. To avoid any potential "BadImageFormatException" at runtime,
the PlatformTarget and Prefer32Bit properties are always set to "x64" and "false" by default.
-->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">x64</PlatformTarget>
<Prefer32Bit Condition=" '$(Prefer32Bit)' == '' ">false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemIntegration\OpenIddict.Client.SystemIntegration.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemNetHttp\OpenIddict.Client.SystemNetHttp.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.WebIntegration\OpenIddict.Client.WebIntegration.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFrameworkCore\OpenIddict.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFramework\OpenIddict.EntityFramework.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Spectre.Console" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="SourceGear.sqlite3" />
<PackageReference Include="SQLite.CodeFirst" />
<PackageReference Include="System.Data.SQLite.EF6" />
</ItemGroup>
</Project>

27
sandbox/OpenIddict.Sandbox.Console.Client/Program.cs

@ -1,10 +1,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenIddict.Client;
using OpenIddict.Client.WebIntegration;
using OpenIddict.Sandbox.Console.Client;
using OpenIddict.Sandbox.Console.Client.Models;
using static OpenIddict.Abstractions.OpenIddictConstants;
var builder = Host.CreateApplicationBuilder(args);
@ -12,21 +12,26 @@ var builder = Host.CreateApplicationBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddDebug();
builder.Services.AddDbContext<DbContext>(options =>
{
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-console-client.sqlite3")}");
options.UseOpenIddict();
});
#if NET
builder.Services.AddDbContext<ApplicationDbContext>();
#else
builder.Services.AddScoped<ApplicationDbContext>();
#endif
builder.Services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
#if NET
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<DbContext>();
.UseDbContext<ApplicationDbContext>();
#else
// Configure OpenIddict to use the Entity Framework 6.x stores and models.
options.UseEntityFramework()
.UseDbContext<ApplicationDbContext>();
#endif
})
// Register the OpenIddict client components.
@ -137,10 +142,12 @@ var app = builder.Build();
// Before starting the host, create the database used to store the application data.
//
// Note: in a real world application, this step should be part of a setup script.
#if NET
await using (var scope = app.Services.CreateAsyncScope())
{
var context = scope.ServiceProvider.GetRequiredService<DbContext>();
var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await context.Database.EnsureCreatedAsync();
}
#endif
await app.RunAsync();

1
sandbox/OpenIddict.Sandbox.Maui.Client/MauiProgram.cs

@ -29,7 +29,6 @@ public static class MauiProgram
.AddCore(options =>
{
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<DbContext>();
})

24
sandbox/OpenIddict.Sandbox.WinForms.Client/App.config

@ -1,5 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SQLite"
type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SQLite"
connectionString="Data Source=|DataDirectory|openiddict-sandbox-winforms-client.sqlite3;Version=3" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
description=".NET Framework Data Provider for SQLite" />
</DbProviderFactories>
</system.data>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>

18
sandbox/OpenIddict.Sandbox.WinForms.Client/MainForm.cs

@ -62,7 +62,7 @@ public partial class MainForm : Form, IWinFormsShell
Nonce = result.Nonce
})).Principal;
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Authentication successful",
@ -78,7 +78,7 @@ public partial class MainForm : Form, IWinFormsShell
catch (OperationCanceledException)
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Authentication timed out",
@ -94,7 +94,7 @@ public partial class MainForm : Form, IWinFormsShell
catch (ProtocolException exception) when (exception.Error is Errors.AccessDenied)
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Authorization denied",
@ -110,7 +110,7 @@ public partial class MainForm : Form, IWinFormsShell
catch
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Authentication failed",
@ -167,7 +167,7 @@ public partial class MainForm : Form, IWinFormsShell
Nonce = result.Nonce
});
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Logout successful",
@ -183,7 +183,7 @@ public partial class MainForm : Form, IWinFormsShell
catch (OperationCanceledException)
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Logout timed out",
@ -199,7 +199,7 @@ public partial class MainForm : Form, IWinFormsShell
catch (ProtocolException exception) when (exception.Error is Errors.AccessDenied)
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Logout denied",
@ -215,7 +215,7 @@ public partial class MainForm : Form, IWinFormsShell
catch
{
#if SUPPORTS_WINFORMS_TASK_DIALOG
#if NET
TaskDialog.ShowDialog(new TaskDialogPage
{
Caption = "Logout failed",
@ -239,4 +239,4 @@ public partial class MainForm : Form, IWinFormsShell
GitHubLogin.Enabled = true;
}
}
}
}

46
sandbox/OpenIddict.Sandbox.WinForms.Client/Models/ApplicationDbContext.cs

@ -0,0 +1,46 @@
#if NET
using Microsoft.EntityFrameworkCore;
#else
using System.Data.Entity;
using SQLite.CodeFirst;
#endif
namespace OpenIddict.Sandbox.WinForms.Client.Models;
public class ApplicationDbContext : DbContext
{
#if NET
public ApplicationDbContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.UseOpenIddict();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-winforms-client.sqlite3")}");
}
#else
public ApplicationDbContext()
: base("name=DefaultConnection")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseOpenIddict();
// Override the default database initializer to use the one provided
// by SQLite.CodeFirst, which automatically creates the database.
Database.SetInitializer(new SqliteCreateDatabaseIfNotExists<ApplicationDbContext>(modelBuilder));
}
#endif
}

33
sandbox/OpenIddict.Sandbox.WinForms.Client/OpenIddict.Sandbox.WinForms.Client.csproj

@ -2,25 +2,52 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net48</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsWindowsTargeting)' == 'true' ">$(TargetFrameworks);net10.0-windows7.0</TargetFrameworks>
<TargetFrameworks>net10.0-windows7.0</TargetFrameworks>
<TargetFrameworks Condition=" $([MSBuild]::IsOSPlatform('Windows')) ">$(TargetFrameworks);net48</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
</PropertyGroup>
<!--
Note: the SourceGear.sqlite3 package doesn't support AnyCPU builds and requires the application
to be built as x64, x86 or arm64. To avoid any potential "BadImageFormatException" at runtime,
the PlatformTarget and Prefer32Bit properties are always set to "x64" and "false" by default.
-->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">x64</PlatformTarget>
<Prefer32Bit Condition=" '$(Prefer32Bit)' == '' ">false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemIntegration\OpenIddict.Client.SystemIntegration.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemNetHttp\OpenIddict.Client.SystemNetHttp.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.WebIntegration\OpenIddict.Client.WebIntegration.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFrameworkCore\OpenIddict.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFramework\OpenIddict.EntityFramework.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapplo.Microsoft.Extensions.Hosting.AppServices" />
<PackageReference Include="Dapplo.Microsoft.Extensions.Hosting.WinForms" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="SourceGear.sqlite3" />
<PackageReference Include="SQLite.CodeFirst" />
<PackageReference Include="System.Data.SQLite.EF6" />
</ItemGroup>
</Project>

31
sandbox/OpenIddict.Sandbox.WinForms.Client/Program.cs

@ -1,15 +1,15 @@
using System.Diagnostics;
using Dapplo.Microsoft.Extensions.Hosting.WinForms;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Win32;
using OpenIddict.Client;
using OpenIddict.Sandbox.WinForms.Client;
using OpenIddict.Sandbox.WinForms.Client.Models;
using static OpenIddict.Abstractions.OpenIddictConstants;
#if SUPPORTS_APPLICATION_CONFIGURATION_INITIALIZATION
#if NET
ApplicationConfiguration.Initialize();
#endif
@ -23,21 +23,26 @@ var host = new HostBuilder()
.ConfigureLogging(options => options.AddDebug())
.ConfigureServices(services =>
{
services.AddDbContext<DbContext>(options =>
{
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-winforms-client.sqlite3")}");
options.UseOpenIddict();
});
#if NET
services.AddDbContext<ApplicationDbContext>();
#else
services.AddScoped<ApplicationDbContext>();
#endif
services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
#if NET
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<DbContext>();
.UseDbContext<ApplicationDbContext>();
#else
// Configure OpenIddict to use the Entity Framework 6.x stores and models.
options.UseEntityFramework()
.UseDbContext<ApplicationDbContext>();
#endif
})
// Register the OpenIddict client components.
@ -109,8 +114,10 @@ var host = new HostBuilder()
// Note: in a real world application, this step should be part of a setup script.
await using (var scope = host.Services.CreateAsyncScope())
{
var context = scope.ServiceProvider.GetRequiredService<DbContext>();
#if NET
var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await context.Database.EnsureCreatedAsync();
#endif
// Create the registry entries necessary to handle URI protocol activations.
//
@ -126,12 +133,12 @@ await using (var scope = host.Services.CreateAsyncScope())
using var command = root.CreateSubKey("shell\\open\\command");
command.SetValue(string.Empty, string.Format("\"{0}\" \"%1\"",
#if SUPPORTS_ENVIRONMENT_PROCESS_PATH
#if NET
Environment.ProcessPath
#else
Process.GetCurrentProcess().MainModule.FileName
#endif
));
));
}
await host.RunAsync();

26
sandbox/OpenIddict.Sandbox.Wpf.Client/App.config

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SQLite"
type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SQLite"
connectionString="Data Source=|DataDirectory|openiddict-sandbox-wpf-client.sqlite3;Version=3" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"
description=".NET Framework Data Provider for SQLite" />
</DbProviderFactories>
</system.data>
</configuration>

47
sandbox/OpenIddict.Sandbox.Wpf.Client/Models/ApplicationDbContext.cs

@ -0,0 +1,47 @@
#if NET
using System.IO;
using Microsoft.EntityFrameworkCore;
#else
using System.Data.Entity;
using SQLite.CodeFirst;
#endif
namespace OpenIddict.Sandbox.Wpf.Client.Models;
public class ApplicationDbContext : DbContext
{
#if NET
public ApplicationDbContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.UseOpenIddict();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-wpf-client.sqlite3")}");
}
#else
public ApplicationDbContext()
: base("name=DefaultConnection")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseOpenIddict();
// Override the default database initializer to use the one provided
// by SQLite.CodeFirst, which automatically creates the database.
Database.SetInitializer(new SqliteCreateDatabaseIfNotExists<ApplicationDbContext>(modelBuilder));
}
#endif
}

33
sandbox/OpenIddict.Sandbox.Wpf.Client/OpenIddict.Sandbox.Wpf.Client.csproj

@ -2,24 +2,51 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net48</TargetFrameworks>
<TargetFrameworks Condition=" '$(SupportsWindowsTargeting)' == 'true' ">$(TargetFrameworks);net10.0-windows10.0.17763</TargetFrameworks>
<TargetFrameworks>net10.0-windows10.0.17763</TargetFrameworks>
<TargetFrameworks Condition=" $([MSBuild]::IsOSPlatform('Windows')) ">$(TargetFrameworks);net48</TargetFrameworks>
<UseWPF>true</UseWPF>
<EnableDefaultApplicationDefinition>false</EnableDefaultApplicationDefinition>
</PropertyGroup>
<!--
Note: the SourceGear.sqlite3 package doesn't support AnyCPU builds and requires the application
to be built as x64, x86 or arm64. To avoid any potential "BadImageFormatException" at runtime,
the PlatformTarget and Prefer32Bit properties are always set to "x64" and "false" by default.
-->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PlatformTarget Condition=" '$(PlatformTarget)' == '' ">x64</PlatformTarget>
<Prefer32Bit Condition=" '$(Prefer32Bit)' == '' ">false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemIntegration\OpenIddict.Client.SystemIntegration.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.SystemNetHttp\OpenIddict.Client.SystemNetHttp.csproj" />
<ProjectReference Include="..\..\src\OpenIddict.Client.WebIntegration\OpenIddict.Client.WebIntegration.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFrameworkCore\OpenIddict.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<ProjectReference Include="..\..\src\OpenIddict.EntityFramework\OpenIddict.EntityFramework.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapplo.Microsoft.Extensions.Hosting.AppServices" />
<PackageReference Include="Dapplo.Microsoft.Extensions.Hosting.Wpf" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="SourceGear.sqlite3" />
<PackageReference Include="SQLite.CodeFirst" />
<PackageReference Include="System.Data.SQLite.EF6" />
</ItemGroup>
</Project>

32
sandbox/OpenIddict.Sandbox.Wpf.Client/Program.cs

@ -1,13 +1,12 @@
using System.Diagnostics;
using System.IO;
using Dapplo.Microsoft.Extensions.Hosting.Wpf;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Win32;
using OpenIddict.Client;
using OpenIddict.Sandbox.Wpf.Client;
using OpenIddict.Sandbox.Wpf.Client.Models;
using static OpenIddict.Abstractions.OpenIddictConstants;
var host = new HostBuilder()
@ -20,21 +19,26 @@ var host = new HostBuilder()
.ConfigureLogging(options => options.AddDebug())
.ConfigureServices(services =>
{
services.AddDbContext<DbContext>(options =>
{
options.UseSqlite($"Filename={Path.Combine(Path.GetTempPath(), "openiddict-sandbox-wpf-client.sqlite3")}");
options.UseOpenIddict();
});
#if NET
services.AddDbContext<ApplicationDbContext>();
#else
services.AddScoped<ApplicationDbContext>();
#endif
services.AddOpenIddict()
// Register the OpenIddict core components.
.AddCore(options =>
{
#if NET
// Configure OpenIddict to use the Entity Framework Core stores and models.
// Note: call ReplaceDefaultEntities() to replace the default OpenIddict entities.
options.UseEntityFrameworkCore()
.UseDbContext<DbContext>();
.UseDbContext<ApplicationDbContext>();
#else
// Configure OpenIddict to use the Entity Framework 6.x stores and models.
options.UseEntityFramework()
.UseDbContext<ApplicationDbContext>();
#endif
})
// Register the OpenIddict client components.
@ -110,8 +114,10 @@ var host = new HostBuilder()
// Note: in a real world application, this step should be part of a setup script.
await using (var scope = host.Services.CreateAsyncScope())
{
var context = scope.ServiceProvider.GetRequiredService<DbContext>();
#if NET
var context = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await context.Database.EnsureCreatedAsync();
#endif
// Create the registry entries necessary to handle URI protocol activations.
//
@ -127,12 +133,12 @@ await using (var scope = host.Services.CreateAsyncScope())
using var command = root.CreateSubKey("shell\\open\\command");
command.SetValue(string.Empty, string.Format("\"{0}\" \"%1\"",
#if SUPPORTS_ENVIRONMENT_PROCESS_PATH
#if NET
Environment.ProcessPath
#else
Process.GetCurrentProcess().MainModule.FileName
#endif
));
));
}
await host.RunAsync();
await host.RunAsync();

4
shared/OpenIddict.Extensions/OpenIddict.Extensions.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<DefineConstants>$(DefineConstants);FeatureValueTuple</DefineConstants>
</PropertyGroup>
@ -10,7 +10,7 @@
<ProjectReference Include="..\..\src\OpenIddict.Abstractions\OpenIddict.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

624
shared/OpenIddict.Extensions/OpenIddictHelpers.cs

@ -6,7 +6,6 @@
using System.Collections.ObjectModel;
using System.Data;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
@ -332,509 +331,6 @@ internal static class OpenIddictHelpers
return await reader.ReadFormAsync(cancellationToken);
}
#if SUPPORTS_ECDSA
/// <summary>
/// Creates a new <see cref="ECDsa"/> key.
/// </summary>
/// <returns>A new <see cref="ECDsa"/> key.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static ECDsa CreateEcdsaKey()
{
return GetAlgorithmFromConfig() switch
{
ECDsa result => result,
null => ECDsa.Create(),
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict ECDSA Cryptographic Provider");
}
/// <summary>
/// Creates a new <see cref="ECDsa"/> key.
/// </summary>
/// <param name="curve">The EC curve to use to create the key.</param>
/// <returns>A new <see cref="ECDsa"/> key.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static ECDsa CreateEcdsaKey(ECCurve curve)
{
var algorithm = GetAlgorithmFromConfig() switch
{
ECDsa result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom algorithm was registered, use either the static Create() API
// on platforms that support it or create a default instance provided by the BCL.
if (algorithm is null)
{
return ECDsa.Create(curve);
}
try
{
algorithm.GenerateKey(curve);
}
catch
{
algorithm.Dispose();
throw;
}
return algorithm;
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict ECDSA Cryptographic Provider");
}
#endif
/// <summary>
/// Creates a new <see cref="RSA"/> key.
/// </summary>
/// <param name="size">The key size to use to create the key.</param>
/// <returns>A new <see cref="RSA"/> key.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static RSA CreateRsaKey(int size)
{
var algorithm = GetAlgorithmFromConfig() switch
{
RSA result => result,
#if SUPPORTS_RSA_KEY_CREATION_WITH_SPECIFIED_SIZE
// Note: on .NET Framework >= 4.7.2, the new RSA.Create(int keySizeInBits) uses
// CryptoConfig.CreateFromName("RSAPSS") internally, which returns by default
// a RSACng instance instead of a RSACryptoServiceProvider based on CryptoAPI.
null => RSA.Create(size),
#else
// Note: while a RSACng object could be manually instantiated and returned on
// .NET Framework < 4.7.2, the static RSA.Create() factory (which returns a
// RSACryptoServiceProvider instance by default) is always preferred to RSACng
// as this type is known to have compatibility issues on .NET Framework < 4.6.2.
//
// Developers who prefer using a CNG-based implementation on .NET Framework 4.6.1
// can do so by tweaking machine.config or by using CryptoConfig.AddAlgorithm().
null => RSA.Create(),
#endif
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// Note: on .NET Framework, the RSA.Create() overload uses CryptoConfig.CreateFromName()
// and always returns a RSACryptoServiceProvider instance unless the default name mapping was
// explicitly overridden in machine.config or via CryptoConfig.AddAlgorithm(). Unfortunately,
// RSACryptoServiceProvider still uses 1024-bit keys by default and doesn't support changing
// the key size via RSACryptoServiceProvider.KeySize (setting it has no effect on the object).
//
// To ensure the key size matches the requested size, this method replaces the instance by a
// new RSACryptoServiceProvider using the constructor allowing to override the default key size.
try
{
if (algorithm.KeySize != size)
{
if (algorithm is RSACryptoServiceProvider)
{
algorithm.Dispose();
algorithm = new RSACryptoServiceProvider(size);
}
else
{
algorithm.KeySize = size;
}
if (algorithm.KeySize != size)
{
throw new CryptographicException(SR.FormatID0059(algorithm.GetType().FullName));
}
}
}
catch
{
algorithm.Dispose();
throw;
}
return algorithm;
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict RSA Cryptographic Provider");
}
/// <summary>
/// Computes the SHA-256 message authentication code (HMAC) of the specified <paramref name="data"/> array.
/// </summary>
/// <param name="key">The cryptographic key.</param>
/// <param name="data">The data to hash.</param>
/// <returns>The SHA-256 message authentication code (HMAC) of the specified <paramref name="data"/> array.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] ComputeSha256MessageAuthenticationCode(byte[] key, byte[] data)
{
var algorithm = GetAlgorithmFromConfig(key) switch
{
HMACSHA256 result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom algorithm was registered, use either the static/one-shot HashData() API
// on platforms that support it or create a default instance provided by the BCL.
if (algorithm is null)
{
#if SUPPORTS_ONE_SHOT_HASHING_METHODS
return HMACSHA256.HashData(key, data);
#else
algorithm = new HMACSHA256(key);
#endif
}
try
{
return algorithm.ComputeHash(data);
}
finally
{
algorithm.Dispose();
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig(byte[] key) => CryptoConfig.CreateFromName("OpenIddict HMAC SHA-256 Cryptographic Provider", [key]);
}
/// <summary>
/// Computes the SHA-256 hash of the specified <paramref name="data"/> array.
/// </summary>
/// <param name="data">The data to hash.</param>
/// <returns>The SHA-256 hash of the specified <paramref name="data"/> array.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] ComputeSha256Hash(byte[] data)
{
var algorithm = GetAlgorithmFromConfig() switch
{
SHA256 result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom algorithm was registered, use either the static/one-shot HashData() API
// on platforms that support it or create a default instance provided by the BCL.
if (algorithm is null)
{
#if SUPPORTS_ONE_SHOT_HASHING_METHODS
return SHA256.HashData(data);
#else
algorithm = SHA256.Create();
#endif
}
try
{
return algorithm.ComputeHash(data);
}
finally
{
algorithm.Dispose();
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict SHA-256 Cryptographic Provider");
}
/// <summary>
/// Computes the SHA-384 hash of the specified <paramref name="data"/> array.
/// </summary>
/// <param name="data">The data to hash.</param>
/// <returns>The SHA-384 hash of the specified <paramref name="data"/> array.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] ComputeSha384Hash(byte[] data)
{
var algorithm = GetAlgorithmFromConfig() switch
{
SHA384 result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom algorithm was registered, use either the static/one-shot HashData() API
// on platforms that support it or create a default instance provided by the BCL.
if (algorithm is null)
{
#if SUPPORTS_ONE_SHOT_HASHING_METHODS
return SHA384.HashData(data);
#else
algorithm = SHA384.Create();
#endif
}
try
{
return algorithm.ComputeHash(data);
}
finally
{
algorithm.Dispose();
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict SHA-384 Cryptographic Provider");
}
/// <summary>
/// Computes the SHA-512 hash of the specified <paramref name="data"/> array.
/// </summary>
/// <param name="data">The data to hash.</param>
/// <returns>The SHA-512 hash of the specified <paramref name="data"/> array.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] ComputeSha512Hash(byte[] data)
{
var algorithm = GetAlgorithmFromConfig() switch
{
SHA512 result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom algorithm was registered, use either the static/one-shot HashData() API
// on platforms that support it or create a default instance provided by the BCL.
if (algorithm is null)
{
#if SUPPORTS_ONE_SHOT_HASHING_METHODS
return SHA512.HashData(data);
#else
algorithm = SHA512.Create();
#endif
}
try
{
return algorithm.ComputeHash(data);
}
finally
{
algorithm.Dispose();
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict SHA-512 Cryptographic Provider");
}
/// <summary>
/// Creates a new array of <see cref="byte"/> containing random data.
/// </summary>
/// <param name="size">The desired entropy, in bits.</param>
/// <returns>A new array of <see cref="byte"/> containing random data.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] CreateRandomArray(int size)
{
var algorithm = GetAlgorithmFromConfig() switch
{
RandomNumberGenerator result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom random number generator was registered, use either the static GetBytes() or
// Fill() APIs on platforms that support them or create a default instance provided by the BCL.
#if SUPPORTS_ONE_SHOT_RANDOM_NUMBER_GENERATOR_METHODS
if (algorithm is null)
{
var array = new byte[size / 8];
algorithm.GetBytes(array);
return array;
}
#endif
var array = new byte[size / 8];
#if SUPPORTS_STATIC_RANDOM_NUMBER_GENERATOR_METHODS
if (algorithm is null)
{
RandomNumberGenerator.Fill(array);
return array;
}
#else
algorithm ??= RandomNumberGenerator.Create();
#endif
try
{
algorithm.GetBytes(array);
}
finally
{
algorithm.Dispose();
}
return array;
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict RNG Cryptographic Provider");
}
/// <summary>
/// Creates a new <see cref="string"/> containing characters
/// randomly selected in the specified <paramref name="charset"/>.
/// </summary>
/// <param name="charset">The characters allowed to be included in the <see cref="string"/>.</param>
/// <param name="count">The number of characters.</param>
/// <returns>A new <see cref="string"/> containing random data.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static string CreateRandomString(ReadOnlySpan<string> charset, int count)
{
var algorithm = GetAlgorithmFromConfig() switch
{
RandomNumberGenerator result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
try
{
var builder = new StringBuilder();
for (var index = 0; index < count; index++)
{
// Pick a character in the specified charset by generating a random index.
builder.Append(charset[index: algorithm switch
{
#if SUPPORTS_INT32_RANDOM_NUMBER_GENERATOR_METHODS
// If no custom random number generator was registered, use
// the static GetInt32() API on platforms that support it.
null => RandomNumberGenerator.GetInt32(0, charset.Length),
#endif
// Otherwise, create a default implementation if necessary
// and use the local function that achieves the same result.
_ => GetInt32(algorithm ??= RandomNumberGenerator.Create(), 0..charset.Length)
}]);
}
return builder.ToString();
}
finally
{
algorithm?.Dispose();
}
static int GetInt32(RandomNumberGenerator algorithm, Range range)
{
// Note: the logic used here is directly taken from the official implementation
// of the RandomNumberGenerator.GetInt32() method introduced in .NET Core 3.0.
//
// See https://github.com/dotnet/corefx/pull/31243 for more information.
var count = (uint) range.End.Value - (uint) range.Start.Value - 1;
if (count is 0)
{
return range.Start.Value;
}
var mask = count;
mask |= mask >> 1;
mask |= mask >> 2;
mask |= mask >> 4;
mask |= mask >> 8;
mask |= mask >> 16;
var buffer = new byte[sizeof(uint)];
uint value;
do
{
algorithm.GetBytes(buffer);
value = mask & BitConverter.ToUInt32(buffer, 0);
}
while (value > count);
return (int) value + range.Start.Value;
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig() => CryptoConfig.CreateFromName("OpenIddict RNG Cryptographic Provider");
}
/// <summary>
/// Determines the equality of two byte sequences in an amount of time
/// which depends on the length of the sequences, but not the values.
/// </summary>
/// <param name="left">The first buffer to compare.</param>
/// <param name="right">The second buffer to compare.</param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> have the same values
/// for <see cref="ReadOnlySpan{T}.Length"/> and the same contents, <see langword="false"/> otherwise.
/// </returns>
#if !SUPPORTS_TIME_CONSTANT_COMPARISONS
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
#endif
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
#if SUPPORTS_TIME_CONSTANT_COMPARISONS
return CryptographicOperations.FixedTimeEquals(left, right);
#else
// Note: the logic used here is directly taken from the official implementation of
// the CryptographicOperations.FixedTimeEquals() method introduced in .NET Core 2.1.
//
// See https://github.com/dotnet/corefx/pull/27103 for more information.
// Note: these null checks can be theoretically considered as early checks
// (which would defeat the purpose of a time-constant comparison method),
// but the expected string length is the only information an attacker
// could get at this stage, which is not critical where this method is used.
if (left.Length != right.Length)
{
return false;
}
var length = left.Length;
var accumulator = 0;
for (var index = 0; index < length; index++)
{
accumulator |= left[index] - right[index];
}
return accumulator is 0;
#endif
}
/// <summary>
/// Removes the characters that are not part of <paramref name="charset"/>
/// from the specified <paramref name="value"/> string.
@ -870,97 +366,6 @@ internal static class OpenIddictHelpers
return builder.ToString();
}
#if SUPPORTS_KEY_DERIVATION_WITH_SPECIFIED_HASH_ALGORITHM
/// <summary>
/// Creates a derived key based on the specified <paramref name="secret"/> using PBKDF2.
/// </summary>
/// <param name="secret">The secret from which the derived key is created.</param>
/// <param name="salt">The salt.</param>
/// <param name="algorithm">The hash algorithm to use.</param>
/// <param name="iterations">The number of iterations to use.</param>
/// <param name="length">The desired length of the derived key.</param>
/// <returns>A derived key based on the specified <paramref name="secret"/>.</returns>
/// <exception cref="CryptographicException">
/// The implementation resolved from <see cref="CryptoConfig.CreateFromName(string)"/> is not valid.
/// </exception>
public static byte[] DeriveKey(string secret, byte[] salt, HashAlgorithmName algorithm, int iterations, int length)
{
// Warning: the type and order of the arguments specified here MUST exactly match the parameters used with
// Rfc2898DeriveBytes(string password, byte[] salt, int iterations, HashAlgorithmName hashAlgorithm).
var generator = GetAlgorithmFromConfig(secret, salt, iterations, algorithm) switch
{
Rfc2898DeriveBytes result => result,
null => null,
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
// If no custom generator was registered, use either the static/one-shot Pbkdf2() API
// on platforms that support it or create an instance using the dedicated constructor.
if (generator is null)
{
#if SUPPORTS_ONE_SHOT_KEY_DERIVATION_METHODS
return Rfc2898DeriveBytes.Pbkdf2(secret, salt, iterations, algorithm, length);
#else
#pragma warning disable CA5379
generator = new Rfc2898DeriveBytes(secret, salt, iterations, algorithm);
#pragma warning restore CA5379
#endif
}
try
{
return generator.GetBytes(length);
}
finally
{
generator.Dispose();
}
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static object? GetAlgorithmFromConfig(string secret, byte[] salt, int iterations, HashAlgorithmName algorithm)
=> CryptoConfig.CreateFromName("OpenIddict PBKDF2 Cryptographic Provider", [secret, salt, iterations, algorithm]);
}
#endif
#if SUPPORTS_ECDSA
/// <summary>
/// Determines whether the specified <paramref name="parameters"/> represent a specific EC curve.
/// </summary>
/// <param name="parameters">The <see cref="ECParameters"/>.</param>
/// <param name="curve">The <see cref="ECCurve"/>.</param>
/// <returns>
/// <see langword="true"/> if <see cref="ECParameters.Curve"/> is identical to
/// the specified <paramref name="curve"/>, <see langword="false"/> otherwise.
/// </returns>
public static bool IsEcCurve(ECParameters parameters, ECCurve curve)
{
Debug.Assert(parameters.Curve.Oid is not null, SR.GetResourceString(SR.ID4011));
Debug.Assert(curve.Oid is not null, SR.GetResourceString(SR.ID4011));
// Warning: on .NET Framework 4.x and .NET Core 2.1, exported ECParameters generally have
// a null OID value attached. To work around this limitation, both the raw OID values and
// the friendly names are compared to determine whether the curve is of the specified type.
if (!string.IsNullOrEmpty(parameters.Curve.Oid.Value) &&
!string.IsNullOrEmpty(curve.Oid.Value))
{
return string.Equals(parameters.Curve.Oid.Value,
curve.Oid.Value, StringComparison.Ordinal);
}
if (!string.IsNullOrEmpty(parameters.Curve.Oid.FriendlyName) &&
!string.IsNullOrEmpty(curve.Oid.FriendlyName))
{
return string.Equals(parameters.Curve.Oid.FriendlyName,
curve.Oid.FriendlyName, StringComparison.Ordinal);
}
Debug.Fail(SR.GetResourceString(SR.ID4012));
return false;
}
#endif
/// <summary>
/// Determines whether the specified <paramref name="element"/> represents a null, undefined or empty JSON node.
/// </summary>
@ -968,31 +373,16 @@ internal static class OpenIddictHelpers
/// <returns>
/// <see langword="true"/> if the JSON node is null, undefined or empty <see langword="false"/> otherwise.
/// </returns>
public static bool IsNullOrEmpty(JsonElement element)
public static bool IsNullOrEmpty(JsonElement element) => element.ValueKind switch
{
switch (element.ValueKind)
{
case JsonValueKind.Undefined or JsonValueKind.Null:
return true;
case JsonValueKind.String:
return string.IsNullOrEmpty(element.GetString());
JsonValueKind.Undefined or JsonValueKind.Null => true,
case JsonValueKind.Array:
return element.GetArrayLength() is 0;
JsonValueKind.String => string.IsNullOrEmpty(element.GetString()),
JsonValueKind.Array => element.GetArrayLength() is 0,
JsonValueKind.Object => element.GetPropertyCount() is 0,
case JsonValueKind.Object:
#if SUPPORTS_JSON_ELEMENT_PROPERTY_COUNT
return element.GetPropertyCount() is 0;
#else
using (var enumerator = element.EnumerateObject())
{
return !enumerator.MoveNext();
}
#endif
default: return false;
}
}
_ => false,
};
/// <summary>
/// Determines whether the specified <paramref name="node"/> represents a null or empty JSON node.

170
shared/OpenIddict.Extensions/OpenIddictPolyfills.cs

@ -4,8 +4,10 @@
* the license and the contributors participating to this project.
*/
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace OpenIddict.Extensions;
@ -44,6 +46,29 @@ internal static class OpenIddictPolyfills
#endif
}
extension(HMACSHA256)
{
#if !SUPPORTS_ONE_SHOT_HASHING_METHODS
/// <summary>
/// Computes the HMAC of data using the SHA256 algorithm.
/// </summary>
/// <param name="key">The HMAC key.</param>
/// <param name="source">The data to HMAC.</param>
/// <returns>The HMAC of the data.</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="key" /> or <paramref name="source" /> is <see langword="null" />.
/// </exception>
public static byte[] HashData(byte[] key, byte[] source)
{
ArgumentNullException.ThrowIfNull(key);
ArgumentNullException.ThrowIfNull(source);
using var algorithm = new HMACSHA256(key);
return algorithm.ComputeHash(source);
}
#endif
}
extension(OperatingSystem)
{
#if !SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON
@ -131,6 +156,69 @@ internal static class OpenIddictPolyfills
#endif
}
extension(Rfc2898DeriveBytes)
{
#if !SUPPORTS_ONE_SHOT_KEY_DERIVATION_METHODS
/// <summary>
/// Creates a PBKDF2 derived key from a password.
/// </summary>
/// <param name="password">The password used to derive the key.</param>
/// <param name="salt">The key salt used to derive the key.</param>
/// <param name="iterations">The number of iterations for the operation.</param>
/// <param name="hashAlgorithm">The hash algorithm to use to derive the key.</param>
/// <param name="outputLength">The size of key to derive.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// <para><paramref name="outputLength" /> is not zero or a positive value.</para>
/// <para>-or-</para>
/// <para><paramref name="iterations" /> is not a positive value.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="hashAlgorithm" /> has a <see cref="HashAlgorithmName.Name" />
/// that is empty or <see langword="null" />.
/// </exception>
/// <exception cref="CryptographicException">
/// <paramref name="hashAlgorithm" /> is an unsupported hash algorithm. Supported algorithms
/// are <see cref="HashAlgorithmName.SHA1" />, <see cref="HashAlgorithmName.SHA256" />,
/// <see cref="HashAlgorithmName.SHA384" />, and <see cref="HashAlgorithmName.SHA512" />.
/// </exception>
public static byte[] Pbkdf2(
ReadOnlySpan<char> password,
ReadOnlySpan<byte> salt,
int iterations,
HashAlgorithmName hashAlgorithm,
int outputLength)
{
ArgumentOutOfRangeException.ThrowIfNegative(outputLength);
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(iterations);
using var algorithm = new Rfc2898DeriveBytes(password.ToString(), salt.ToArray(), iterations, hashAlgorithm);
return algorithm.GetBytes(outputLength);
}
#endif
}
extension(SHA384)
{
#if !SUPPORTS_ONE_SHOT_HASHING_METHODS
/// <summary>
/// Computes the hash of data using the SHA384 algorithm.
/// </summary>
/// <param name="source">The data to hash.</param>
/// <returns>The hash of the data.</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="source" /> is <see langword="null" />.
/// </exception>
public static byte[] HashData(byte[] source)
{
ArgumentNullException.ThrowIfNull(source);
using var algorithm = SHA384.Create();
return algorithm.ComputeHash(source);
}
#endif
}
extension<TResult>(ValueTask<TResult>)
{
#if !SUPPORTS_VALUETASK_COMPLETED_TASK
@ -219,3 +307,85 @@ internal static class OpenIddictPolyfills
#endif
}
}
/// <summary>
/// Exposes common polyfills used by the OpenIddict assemblies.
/// </summary>
internal static class OpenIddictPolyfills_SHA512
{
extension(SHA512)
{
#if !SUPPORTS_ONE_SHOT_HASHING_METHODS
/// <summary>
/// Computes the hash of data using the SHA512 algorithm.
/// </summary>
/// <param name="source">The data to hash.</param>
/// <returns>The hash of the data.</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="source" /> is <see langword="null" />.
/// </exception>
public static byte[] HashData(byte[] source)
{
ArgumentNullException.ThrowIfNull(source);
using var algorithm = SHA512.Create();
return algorithm.ComputeHash(source);
}
#endif
}
}
#if !SUPPORTS_TIME_CONSTANT_COMPARISONS
internal static class CryptographicOperations
{
/// <summary>
/// Determine the equality of two byte sequences in an amount of time which depends on
/// the length of the sequences, but not the values.
/// </summary>
/// <param name="left">The first buffer to compare.</param>
/// <param name="right">The second buffer to compare.</param>
/// <returns>
/// <c>true</c> if <paramref name="left"/> and <paramref name="right"/> have the same
/// values for <see cref="ReadOnlySpan{T}.Length"/> and the same contents, <c>false</c>
/// otherwise.
/// </returns>
/// <remarks>
/// This method compares two buffers' contents for equality in a manner which does not
/// leak timing information, making it ideal for use within cryptographic routines.
/// This method will short-circuit and return <c>false</c> only if <paramref name="left"/>
/// and <paramref name="right"/> have different lengths.
///
/// Fixed-time behavior is guaranteed in all other cases, including if <paramref name="left"/>
/// and <paramref name="right"/> reference the same address.
/// </remarks>
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
// Note: the logic used here is directly taken from the official implementation of
// the CryptographicOperations.FixedTimeEquals() method introduced in .NET Core 2.1.
//
// See https://github.com/dotnet/corefx/pull/27103 for more information.
// Note: these null checks can be theoretically considered as early checks
// (which would defeat the purpose of a time-constant comparison method),
// but the expected string length is the only information an attacker
// could get at this stage, which is not critical where this method is used.
if (left.Length != right.Length)
{
return false;
}
var length = left.Length;
var accumulator = 0;
for (var index = 0; index < length; index++)
{
accumulator |= left[index] - right[index];
}
return accumulator is 0;
}
}
#endif

24
src/OpenIddict.Abstractions/OpenIddict.Abstractions.csproj

@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>
$(NetFrameworkTargetFrameworks);
$(NetCoreTargetFrameworks);
$(NetStandardTargetFrameworks)
</TargetFrameworks>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
<GenerateResxSourceEmitFormatMethods>true</GenerateResxSourceEmitFormatMethods>
</PropertyGroup>
@ -19,31 +15,17 @@
<PackageReference Include="Microsoft.IdentityModel.Tokens" />
</ItemGroup>
<ItemGroup
Condition=" ('$(TargetFrameworkIdentifier)' == '.NETFramework') Or
('$(TargetFrameworkIdentifier)' == '.NETStandard' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '2.1'))) ">
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.Bcl.HashCode" />
</ItemGroup>
<ItemGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' Or '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<PackageReference Include="System.Buffers" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<PackageReference Include="System.ComponentModel.Annotations" />
</ItemGroup>
<ItemGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '4.7.1')) ">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="**\*.resx" GenerateSource="true" GenerateResourcesCodeAsConstants="true" />
</ItemGroup>

128
src/OpenIddict.Abstractions/Primitives/OpenIddictParameter.cs

@ -119,8 +119,8 @@ public readonly struct OpenIddictParameter : IEquatable<OpenIddictParameter>
string?[] value => value.Length,
// If the parameter is a JSON array or a JSON object, return its length.
JsonElement { ValueKind: JsonValueKind.Array or JsonValueKind.Object } element
=> Count(element),
JsonElement { ValueKind: JsonValueKind.Array } element => element.GetArrayLength(),
JsonElement { ValueKind: JsonValueKind.Object } element => element.GetPropertyCount(),
// If the parameter is a JsonArray, return its length.
JsonArray value => value.Count,
@ -130,8 +130,13 @@ public readonly struct OpenIddictParameter : IEquatable<OpenIddictParameter>
// If the parameter is a JsonValue wrapping a JsonElement,
// apply the same logic as with direct JsonElement instances.
JsonValue value when value.TryGetValue(out JsonElement element)
=> element.ValueKind is JsonValueKind.Array or JsonValueKind.Object ? Count(element) : 0,
JsonValue value when value.TryGetValue(out JsonElement element) => element.ValueKind switch
{
JsonValueKind.Array => element.GetArrayLength(),
JsonValueKind.Object => element.GetPropertyCount(),
_ => 0
},
// If the parameter is a JsonValue wrapping a well-known primitive type
// (e.g int or string), always return 0 as these types can't have a length.
@ -145,42 +150,11 @@ public readonly struct OpenIddictParameter : IEquatable<OpenIddictParameter>
// and extract the number of items if the element is a JSON array or object.
JsonNode value when JsonSerializer.SerializeToElement(value, OpenIddictSerializer.Default.JsonNode)
is JsonElement { ValueKind: JsonValueKind.Array or JsonValueKind.Object } element
=> Count(element),
=> element.ValueKind is JsonValueKind.Array ? element.GetArrayLength() : element.GetPropertyCount(),
// Otherwise, return 0.
_ => 0
};
static int Count(JsonElement element)
{
switch (element.ValueKind)
{
case JsonValueKind.Array:
return element.GetArrayLength();
case JsonValueKind.Object:
#if SUPPORTS_JSON_ELEMENT_PROPERTY_COUNT
return element.GetPropertyCount();
#else
var count = 0;
using (var enumerator = element.EnumerateObject())
{
checked
{
while (enumerator.MoveNext())
{
count++;
}
}
}
return count;
#endif
default: return 0;
}
}
}
}
@ -290,75 +264,21 @@ public readonly struct OpenIddictParameter : IEquatable<OpenIddictParameter>
JsonSerializer.SerializeToElement(right, right.GetType(), OpenIddictSerializer.Default))
};
static bool DeepEquals(JsonElement left, JsonElement right)
static bool DeepEquals(JsonElement left, JsonElement right) => (left.ValueKind, right.ValueKind) switch
{
#if !SUPPORTS_JSON_ELEMENT_DEEP_EQUALS
RuntimeHelpers.EnsureSufficientExecutionStack();
#endif
switch ((left.ValueKind, right.ValueKind))
{
case (JsonValueKind.Undefined, JsonValueKind.Undefined):
case (JsonValueKind.Null, JsonValueKind.Null):
case (JsonValueKind.False, JsonValueKind.False):
case (JsonValueKind.True, JsonValueKind.True):
return true;
// Treat undefined JsonElement instances as null values.
case (JsonValueKind.Undefined, JsonValueKind.Null):
case (JsonValueKind.Null, JsonValueKind.Undefined):
return true;
#if SUPPORTS_JSON_ELEMENT_DEEP_EQUALS
default: return JsonElement.DeepEquals(left, right);
#else
case (JsonValueKind.Number, JsonValueKind.Number):
return string.Equals(left.GetRawText(), right.GetRawText(), StringComparison.Ordinal);
case (JsonValueKind.String, JsonValueKind.String):
return string.Equals(left.GetString(), right.GetString(), StringComparison.Ordinal);
case (JsonValueKind.Array, JsonValueKind.Array):
{
var length = left.GetArrayLength();
if (length != right.GetArrayLength())
{
return false;
}
for (var index = 0; index < length; index++)
{
if (!DeepEquals(left[index], right[index]))
{
return false;
}
}
return true;
}
case (JsonValueKind.Object, JsonValueKind.Object):
{
foreach (var property in left.EnumerateObject())
{
if (!right.TryGetProperty(property.Name, out JsonElement element) ||
property.Value.ValueKind != element.ValueKind)
{
return false;
}
if (!DeepEquals(property.Value, element))
{
return false;
}
}
return true;
}
default: return false;
#endif
}
}
(JsonValueKind.Undefined, JsonValueKind.Undefined) or
(JsonValueKind.Null, JsonValueKind.Null) or
(JsonValueKind.False, JsonValueKind.False) or
(JsonValueKind.True, JsonValueKind.True)
=> true,
// Treat undefined JsonElement instances as null values.
(JsonValueKind.Undefined, JsonValueKind.Null) or
(JsonValueKind.Null, JsonValueKind.Undefined)
=> true,
_ => JsonElement.DeepEquals(left, right)
};
}
/// <summary>

2
src/OpenIddict.AspNetCore/OpenIddict.AspNetCore.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<IncludeInternalExtensions>false</IncludeInternalExtensions>

20
src/OpenIddict.Client.AspNetCore/OpenIddict.Client.AspNetCore.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
@ -13,24 +13,8 @@
<ProjectReference Include="..\OpenIddict.Client\OpenIddict.Client.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<!--
Note: the versions of the System.Security.Cryptography.Xml package that are transitively referenced are
known to be affected by different vulnerabilities (see https://github.com/advisories/GHSA-w3x6-4m5h-cxqf
and https://github.com/advisories/GHSA-37gx-xxp4-5rgx for more information). To mitigate this issue,
the package is explicitly referenced here to ensure that a fixed version is used.
-->
<PackageReference Include="System.Security.Cryptography.Xml" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.AspNetCore.Authentication" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.Abstractions" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>

2
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreConfiguration.cs

@ -115,7 +115,6 @@ public sealed class OpenIddictClientAspNetCoreConfiguration : IConfigureOptions<
throw new InvalidOperationException(SR.GetResourceString(SR.ID0289));
}
#if SUPPORTS_AUTHENTICATION_HANDLER_SELECTION_FALLBACK
// Starting in ASP.NET 7.0, the authentication stack integrates a fallback
// mechanism to select the default scheme to use when no value is set, but
// only if a single handler has been registered in the authentication options.
@ -132,7 +131,6 @@ public sealed class OpenIddictClientAspNetCoreConfiguration : IConfigureOptions<
{
options.AddScheme<IAuthenticationHandler>(Guid.NewGuid().ToString(), displayName: null);
}
#endif
static bool TryValidate(IDictionary<string, AuthenticationSchemeBuilder> map, string? scheme)
{

15
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandler.cs

@ -29,7 +29,6 @@ public sealed class OpenIddictClientAspNetCoreHandler : AuthenticationHandler<Op
/// <summary>
/// Creates a new instance of the <see cref="OpenIddictClientAspNetCoreHandler"/> class.
/// </summary>
#if SUPPORTS_AUTHENTICATION_HANDLER_TIME_PROVIDER_ARGUMENT
public OpenIddictClientAspNetCoreHandler(
IOpenIddictClientDispatcher dispatcher,
IOpenIddictClientFactory factory,
@ -41,20 +40,6 @@ public sealed class OpenIddictClientAspNetCoreHandler : AuthenticationHandler<Op
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
_factory = factory ?? throw new ArgumentNullException(nameof(factory));
}
#else
public OpenIddictClientAspNetCoreHandler(
IOpenIddictClientDispatcher dispatcher,
IOpenIddictClientFactory factory,
IOptionsMonitor<OpenIddictClientAspNetCoreOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
_dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
_factory = factory ?? throw new ArgumentNullException(nameof(factory));
}
#endif
/// <inheritdoc/>
public async Task<bool> HandleRequestAsync()

14
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Authentication.cs

@ -72,7 +72,6 @@ public static partial class OpenIddictClientAspNetCoreHandlers
// with the same name are used by derived drafts like the OAuth 2.0 token exchange specification.
// For consistency, multiple parameters with the same name are also supported by this endpoint.
#if SUPPORTS_MULTIPLE_VALUES_IN_QUERYHELPERS
var location = QueryHelpers.AddQueryString(context.AuthorizationEndpoint,
from parameter in context.Request.GetParameters()
let values = (ImmutableArray<string?>?) parameter.Value
@ -80,20 +79,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
from value in values.GetValueOrDefault()
where !string.IsNullOrEmpty(value)
select KeyValuePair.Create(parameter.Key, value));
#else
var location = context.AuthorizationEndpoint;
foreach (var (key, value) in
from parameter in context.Request.GetParameters()
let values = (ImmutableArray<string?>?) parameter.Value
where values is not null
from value in values.GetValueOrDefault()
where !string.IsNullOrEmpty(value)
select (parameter.Key, Value: value))
{
location = QueryHelpers.AddQueryString(location, key, value);
}
#endif
response.Redirect(location);
context.HandleRequest();

14
src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.Session.cs

@ -72,7 +72,6 @@ public static partial class OpenIddictClientAspNetCoreHandlers
// with the same name are used by derived drafts like the OAuth 2.0 token exchange specification.
// For consistency, multiple parameters with the same name are also supported by this endpoint.
#if SUPPORTS_MULTIPLE_VALUES_IN_QUERYHELPERS
var location = QueryHelpers.AddQueryString(context.EndSessionEndpoint,
from parameter in context.Request.GetParameters()
let values = (ImmutableArray<string?>?) parameter.Value
@ -80,20 +79,7 @@ public static partial class OpenIddictClientAspNetCoreHandlers
from value in values.GetValueOrDefault()
where !string.IsNullOrEmpty(value)
select KeyValuePair.Create(parameter.Key, value));
#else
var location = context.EndSessionEndpoint;
foreach (var (key, value) in
from parameter in context.Request.GetParameters()
let values = (ImmutableArray<string?>?) parameter.Value
where values is not null
from value in values.GetValueOrDefault()
where !string.IsNullOrEmpty(value)
select (parameter.Key, Value: value))
{
location = QueryHelpers.AddQueryString(location, key, value);
}
#endif
response.Redirect(location);
context.HandleRequest();

14
src/OpenIddict.Client.DataProtection/OpenIddict.Client.DataProtection.csproj

@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>
$(NetFrameworkTargetFrameworks);
$(NetCoreTargetFrameworks);
$(NetStandardTargetFrameworks)
</TargetFrameworks>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
@ -18,15 +14,7 @@
</ItemGroup>
<ItemGroup>
<!--
Note: the versions of the System.Security.Cryptography.Xml package that are transitively referenced are
known to be affected by different vulnerabilities (see https://github.com/advisories/GHSA-w3x6-4m5h-cxqf
and https://github.com/advisories/GHSA-37gx-xxp4-5rgx for more information). To mitigate this issue,
the package is explicitly referenced here to ensure that a fixed version is used.
-->
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
<PackageReference Include="System.Security.Cryptography.Xml" />
</ItemGroup>
<ItemGroup>

20
src/OpenIddict.Client.SystemIntegration/OpenIddict.Client.SystemIntegration.csproj

@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>
@ -8,20 +8,8 @@
$(NetCoreIOSTargetFrameworks);
$(NetCoreMacCatalystTargetFrameworks);
$(NetCoreMacOSTargetFrameworks);
$(NetCoreWindowsTargetFrameworks);
$(NetStandardTargetFrameworks);
$(UniversalWindowsPlatformTargetFrameworks)
$(NetCoreWindowsTargetFrameworks)
</TargetFrameworks>
<!--
Note: MSBuild.Sdk.Extras has a bug that prevents the target framework identifier from being
correctly inferred for .NET 10+ target framework monikers. To work around that bug, the identifier
is explicitly set when the moniker corresponds to a .NET (Core) target framework moniker.
See https://github.com/novotnyllc/MSBuildSdkExtras/issues/305 for more information.
-->
<TargetFrameworkIdentifier
Condition=" $([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp' ">.NETCoreApp</TargetFrameworkIdentifier>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!--
@ -46,10 +34,6 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCore' Or '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<PackageReference Include="NamedPipeServerStream.NetFrameworkVersion" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.Windows.SDK.Contracts" />
</ItemGroup>

5
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationConfiguration.cs

@ -8,6 +8,7 @@ using System.ComponentModel;
using System.IO.Pipes;
using System.Net;
using System.Security.AccessControl;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
using Microsoft.Extensions.Hosting;
@ -136,7 +137,7 @@ public sealed class OpenIddictClientSystemIntegrationConfiguration : IConfigureO
throw new InvalidOperationException(SR.GetResourceString(SR.ID0386));
}
var digest = OpenIddictHelpers.ComputeSha256Hash(Encoding.UTF8.GetBytes(_environment.ApplicationName));
var digest = SHA256.HashData(Encoding.UTF8.GetBytes(_environment.ApplicationName));
// Note: only the left-most half of the hash is used to limit the length of the resulting discriminator,
// which is required on platforms like macOS, where the name of pipes is always prefixed with a static part
@ -147,7 +148,7 @@ public sealed class OpenIddictClientSystemIntegrationConfiguration : IConfigureO
// If no explicit instance identifier was specified, use a 96-bit random identifier.
if (string.IsNullOrEmpty(options.InstanceIdentifier))
{
options.InstanceIdentifier = Base64UrlEncoder.Encode(OpenIddictHelpers.CreateRandomArray(size: 96));
options.InstanceIdentifier = Base64UrlEncoder.Encode(RandomNumberGenerator.GetBytes(count: 96 / 8));
}
// If no explicit pipe name was specified, build one using the application discriminator.

2
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationHelpers.cs

@ -326,7 +326,7 @@ public static class OpenIddictClientSystemIntegrationHelpers
// Note: with the materialization of Project Centennial/Desktop Bridge in Windows 10 1607
// (also known as Anniversary Update), desktop applications that don't have a package
// identity are now allowed to use most of the WinRT APIs. Since OpenIddict's UWP support
// is implemented via a UAP 10.0.17763 TFM (which requires Windows 10 1809), it is assumed
// is implemented via a net*-windows10.0.17763 TFM (which requires Windows 10 1809), it is assumed
// at this point that Launcher.LaunchUriAsync() can be used in both types of applications.
try

6
src/OpenIddict.Client.SystemIntegration/OpenIddictClientSystemIntegrationPipeListener.cs

@ -131,12 +131,10 @@ public sealed class OpenIddictClientSystemIntegrationPipeListener : BackgroundSe
// Note: the ACL-based PipeSecurity class is only supported on Windows. On other operating systems,
// PipeOptions.CurrentUserOnly can be used as an alternative, but only for TFMs that implement it.
=> OperatingSystem.IsWindows() ?
#if SUPPORTS_NAMED_PIPE_CONSTRUCTOR_WITH_ACL
new NamedPipeServerStream(
#elif SUPPORTS_NAMED_PIPE_STATIC_FACTORY_WITH_ACL
#if SUPPORTS_NAMED_PIPE_STATIC_FACTORY_WITH_ACL
NamedPipeServerStreamAcl.Create(
#else
NamedPipeServerStreamConstructors.New(
new NamedPipeServerStream(
#endif
pipeName : $@"{options.PipeName}-{options.InstanceIdentifier}",
direction : PipeDirection.In,

9
src/OpenIddict.Client.SystemNetHttp/OpenIddict.Client.SystemNetHttp.csproj

@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>
$(NetFrameworkTargetFrameworks);
$(NetCoreTargetFrameworks);
$(NetStandardTargetFrameworks)
</TargetFrameworks>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
@ -21,8 +17,7 @@
<PackageReference Include="Microsoft.Extensions.Http.Polly" />
</ItemGroup>
<ItemGroup
Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' Or '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="System.Net.Http.Json" />
</ItemGroup>

23
src/OpenIddict.Client.SystemNetHttp/OpenIddictClientSystemNetHttpContext.cs

@ -5,8 +5,6 @@
*/
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@ -51,9 +49,10 @@ public sealed class OpenIddictClientSystemNetHttpContext
{
ArgumentNullException.ThrowIfNull(context);
using var algorithm = CreateAlgorithm();
using var algorithm = SHA256.Create();
TransformBlock(algorithm, context.Registration.RegistrationId!);
var buffer = Encoding.UTF8.GetBytes(context.Registration.RegistrationId!);
algorithm.TransformBlock(buffer, 0, buffer.Length, outputBuffer: null, outputOffset: 0);
if (context.LocalCertificate is X509Certificate2 certificate)
{
@ -63,21 +62,5 @@ public sealed class OpenIddictClientSystemNetHttpContext
algorithm.TransformFinalBlock([], 0, 0);
return Base64UrlEncoder.Encode(algorithm.Hash);
[UnconditionalSuppressMessage("Trimming", "IL2026",
Justification = "The default implementation is always used when no custom algorithm was registered.")]
static SHA256 CreateAlgorithm() => CryptoConfig.CreateFromName("OpenIddict SHA-256 Cryptographic Provider") switch
{
SHA256 result => result,
null => SHA256.Create(),
var result => throw new CryptographicException(SR.FormatID0351(result.GetType().FullName))
};
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static void TransformBlock(HashAlgorithm algorithm, string input)
{
var buffer = Encoding.UTF8.GetBytes(input);
algorithm.TransformBlock(buffer, 0, buffer.Length, outputBuffer: null, outputOffset: 0);
}
}
}

6
src/OpenIddict.Client.WebIntegration/OpenIddict.Client.WebIntegration.csproj

@ -1,11 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>
$(NetFrameworkTargetFrameworks);
$(NetCoreTargetFrameworks);
$(NetStandardTargetFrameworks)
</TargetFrameworks>
<TargetFrameworks>$(NetFrameworkTargetFrameworks);$(NetCoreTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save