Merge remote-tracking branch 'AzureIntegration/rybrande/masterToSrc' into rybrande/MondoMaster
This commit is contained in:
commit
1698beeee9
|
|
@ -0,0 +1,34 @@
|
||||||
|
[Oo]bj/
|
||||||
|
[Bb]in/
|
||||||
|
TestResults/
|
||||||
|
.nuget/
|
||||||
|
_ReSharper.*/
|
||||||
|
packages/
|
||||||
|
artifacts/
|
||||||
|
PublishProfiles/
|
||||||
|
*.user
|
||||||
|
*.suo
|
||||||
|
*.cache
|
||||||
|
*.docstates
|
||||||
|
_ReSharper.*
|
||||||
|
nuget.exe
|
||||||
|
*net45.csproj
|
||||||
|
*net451.csproj
|
||||||
|
*k10.csproj
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.pidb
|
||||||
|
*.userprefs
|
||||||
|
*DS_Store
|
||||||
|
*.ncrunchsolution
|
||||||
|
*.*sdf
|
||||||
|
*.ipch
|
||||||
|
*.sln.ide
|
||||||
|
project.lock.json
|
||||||
|
.vs
|
||||||
|
.build/
|
||||||
|
.testPublish/
|
||||||
|
global.json
|
||||||
|
msbuild.binlog
|
||||||
|
.test-dotnet/
|
||||||
|
.deps/
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.27016.1
|
||||||
|
MinimumVisualStudioVersion = 15.0.26730.03
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServicesIntegration", "src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj", "{5916BEB5-0969-469B-976C-A392E015DFAC}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FF9B744E-6C59-40CC-9E41-9D2EBD292435}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
src\Directory.Build.props = src\Directory.Build.props
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2FFE2B87-BF8A-4B38-ADAB-2FE2F9BC4A7C}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
build\dependencies.props = build\dependencies.props
|
||||||
|
Directory.Build.props = Directory.Build.props
|
||||||
|
Directory.Build.targets = Directory.Build.targets
|
||||||
|
NuGet.config = NuGet.config
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureAppServicesSample", "sample\AzureAppServicesSample\AzureAppServicesSample.csproj", "{05A4D308-B162-4194-BC5E-88CCB4DBD318}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{37237C93-6855-40D9-9E60-418B093EF49A}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CD650B4B-81C2-4A44-AEF2-A251A877C1F0}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
test\Directory.Build.props = test\Directory.Build.props
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServicesIntegration.Tests", "test\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests\Microsoft.AspNetCore.AzureAppServicesIntegration.Tests.csproj", "{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.HostingStartup", "src\Microsoft.AspNetCore.AzureAppServices.HostingStartup\Microsoft.AspNetCore.AzureAppServices.HostingStartup.csproj", "{AC023B45-7995-4D4A-8108-E512AE8E5734}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureAppServicesHostingStartupSample", "sample\AzureAppServicesHostingStartupSample\AzureAppServicesHostingStartupSample.csproj", "{939EA897-CA31-4F2E-BA51-22B570B64671}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Xdt.Extensions", "src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj", "{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.AzureAppServices.SiteExtension", "extensions\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj", "{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Xdt.Extensions.Tests", "test\Microsoft.Web.Xdt.Extensions.Tests\Microsoft.Web.Xdt.Extensions.Tests.csproj", "{809AEE05-1B28-4E31-8959-776B249BD725}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApplicationModelDetection", "src\Microsoft.Extensions.ApplicationModelDetection\Microsoft.Extensions.ApplicationModelDetection.csproj", "{F0CABFE8-A5B1-487B-A451-A486D26742D3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.ApplicationModelDetection.Tests", "test\Microsoft.Extensions.ApplicationModelDetection.Tests\Microsoft.Extensions.ApplicationModelDetection.Tests.csproj", "{15664836-2B94-4D2D-AC18-6DED01FCCCBD}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Runtime.SiteExtension", "extensions\Microsoft.AspNetCore.Runtime.SiteExtension\Microsoft.AspNetCore.Runtime.SiteExtension.csproj", "{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5916BEB5-0969-469B-976C-A392E015DFAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5916BEB5-0969-469B-976C-A392E015DFAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5916BEB5-0969-469B-976C-A392E015DFAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5916BEB5-0969-469B-976C-A392E015DFAC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{05A4D308-B162-4194-BC5E-88CCB4DBD318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{05A4D308-B162-4194-BC5E-88CCB4DBD318}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{05A4D308-B162-4194-BC5E-88CCB4DBD318}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{05A4D308-B162-4194-BC5E-88CCB4DBD318}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{AC023B45-7995-4D4A-8108-E512AE8E5734}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{939EA897-CA31-4F2E-BA51-22B570B64671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{939EA897-CA31-4F2E-BA51-22B570B64671}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{939EA897-CA31-4F2E-BA51-22B570B64671}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{939EA897-CA31-4F2E-BA51-22B570B64671}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{5916BEB5-0969-469B-976C-A392E015DFAC} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{05A4D308-B162-4194-BC5E-88CCB4DBD318} = {37237C93-6855-40D9-9E60-418B093EF49A}
|
||||||
|
{9BA1B692-B313-4E22-A864-F0ADBBE3C3FA} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{AC023B45-7995-4D4A-8108-E512AE8E5734} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{939EA897-CA31-4F2E-BA51-22B570B64671} = {37237C93-6855-40D9-9E60-418B093EF49A}
|
||||||
|
{9B22E525-FEC9-4C7C-9F9C-598C15BD0250} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{1CE2D76B-39E6-46C0-8F6F-C63E370955A9} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{809AEE05-1B28-4E31-8959-776B249BD725} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{F0CABFE8-A5B1-487B-A451-A486D26742D3} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
{15664836-2B94-4D2D-AC18-6DED01FCCCBD} = {CD650B4B-81C2-4A44-AEF2-A251A877C1F0}
|
||||||
|
{E1E9BC7A-6951-4B60-8DFB-DBB9AC3CDEB0} = {FF9B744E-6C59-40CC-9E41-9D2EBD292435}
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5743DFE7-1AA5-439D-84AE-A480EA389927}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<Project>
|
||||||
|
<Import
|
||||||
|
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
|
||||||
|
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
|
||||||
|
|
||||||
|
<Import Project="version.props" />
|
||||||
|
<Import Project="build\dependencies.props" />
|
||||||
|
<Import Project="build\sources.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Product>Microsoft ASP.NET Core</Product>
|
||||||
|
<RepositoryUrl>https://github.com/aspnet/AzureIntegration</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
||||||
|
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
|
||||||
|
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"adx": { // Packages written by the ADX team and that ship on NuGet.org
|
||||||
|
"rules": [
|
||||||
|
"AdxVerificationCompositeRule"
|
||||||
|
],
|
||||||
|
"packages": {
|
||||||
|
"Microsoft.AspNetCore.AzureAppServicesIntegration": { },
|
||||||
|
"Microsoft.Extensions.ApplicationModelDetection": { }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Default": { // Rules to run for packages not listed in any other set.
|
||||||
|
"rules": [
|
||||||
|
"DefaultCompositeRule"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
AzureIntegration
|
||||||
|
===
|
||||||
|
|
||||||
|
Features that integrate ASP.NET Core with Azure.
|
||||||
|
|
||||||
|
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.
|
||||||
|
|
||||||
|
|
||||||
|
SiteExtensions
|
||||||
|
===
|
||||||
|
|
||||||
|
To install a nightly preview of the ASP.NET Core runtime site extension for testing purposes:
|
||||||
|
1. In the Azure portal select App Services -> your site -> Application settings
|
||||||
|
1. Set `SCM_SITEEXTENSIONS_FEED_URL` application setting to `https://dotnet.myget.org/F/aspnetcore-dev/`
|
||||||
|
1. Go to `DEVELOPMENT TOOLS` -> `Advanced Tools` -> `Site extensions` -> `Gallery`
|
||||||
|
1. Enter `AspNetCoreRuntime` into `Search` box and click `Search`
|
||||||
|
1. Click `+` to install site extension and wait untill installation animation finishes
|
||||||
|
1. `Extensions` tab should now show newly installed site extension
|
||||||
|
1. Click `Restart site` on the right side of the page when installation finishes (this would only restart Kudu site, not the main one)
|
||||||
|
1. Restart site in `Overview` tab of `App service`
|
||||||
|
|
||||||
|
|
||||||
|
To update ASP.NET Core runtime site extension:
|
||||||
|
1. Stop site in `Overview` tab of `App service`
|
||||||
|
1. Go to `DEVELOPMENT TOOLS` -> `Advanced Tools` -> `Site extensions`
|
||||||
|
1. Click update on site extension
|
||||||
|
1. Start site in `Overview` tab of `App service`
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,47 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Label="Package Versions">
|
||||||
|
<InternalAspNetCoreSdkPackageVersion>3.0.0-build-20181114.5</InternalAspNetCoreSdkPackageVersion>
|
||||||
|
<InternalAspNetCoreSiteExtensionSdkPackageVersion>3.0.0-build-20181114.5</InternalAspNetCoreSiteExtensionSdkPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>
|
||||||
|
<MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDataProtectionAzureKeyVaultPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreMvcPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreRazorRuntimePackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreRazorRuntimePackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.7.0-alpha1-10742</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||||
|
<MicrosoftAspNetCoreTestHostPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreTestHostPackageVersion>
|
||||||
|
<MicrosoftAzureManagementFluentPackageVersion>1.1.3</MicrosoftAzureManagementFluentPackageVersion>
|
||||||
|
<MicrosoftAzureServicesAppAuthenticationPackageVersion>1.0.3</MicrosoftAzureServicesAppAuthenticationPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsConfigurationAzureKeyVaultPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
|
||||||
|
<MicrosoftExtensionsConfigurationJsonPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
||||||
|
<MicrosoftExtensionsDiagnosticAdapterPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsDiagnosticAdapterPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingAzureAppServicesPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingConfigurationPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingConfigurationPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingPackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingTestingPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||||
|
<MicrosoftExtensionsProcessSourcesPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsProcessSourcesPackageVersion>
|
||||||
|
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
|
||||||
|
<MicrosoftNETSdkRazorPackageVersion>3.0.0-alpha1-10742</MicrosoftNETSdkRazorPackageVersion>
|
||||||
|
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
||||||
|
<MicrosoftWebXdtPackageVersion>1.4.0</MicrosoftWebXdtPackageVersion>
|
||||||
|
<MoqPackageVersion>4.10.0</MoqPackageVersion>
|
||||||
|
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||||
|
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
||||||
|
<SystemReflectionMetadataPackageVersion>1.7.0-preview1-26907-04</SystemReflectionMetadataPackageVersion>
|
||||||
|
<WindowsAzureStoragePackageVersion>8.1.4</WindowsAzureStoragePackageVersion>
|
||||||
|
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||||
|
<XunitRunnerVisualStudioPackageVersion>2.4.0</XunitRunnerVisualStudioPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||||
|
<PropertyGroup Label="Package Versions: Pinned" />
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<Project>
|
||||||
|
<Target Name="PackTaskDependencies" BeforeTargets="GenerateNuspec">
|
||||||
|
<ItemGroup>
|
||||||
|
<_PackageFiles Include="$(ProjectDepsFilePath)">
|
||||||
|
<PackagePath>lib\$(TargetFramework)</PackagePath>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
<BuildAction>Content</BuildAction>
|
||||||
|
</_PackageFiles>
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="dependencies.props" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<FunctionalTestsProject>$(RepositoryRoot)test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\Microsoft.AspNetCore.AzureAppServices.FunctionalTests.csproj</FunctionalTestsProject>
|
||||||
|
|
||||||
|
<!-- These properties are use by the automation that updates dependencies.props -->
|
||||||
|
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
|
||||||
|
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<SiteExtensions Include="$(RepositoryRoot)extensions\Microsoft.AspNetCore.Runtime.SiteExtension\Microsoft.AspNetCore.Runtime.SiteExtension.csproj" PackageName="AspNetCoreRuntime.3.0.x64" BuildProperties="RuntimeArch=x64;" />
|
||||||
|
<SiteExtensions Include="$(RepositoryRoot)extensions\Microsoft.AspNetCore.Runtime.SiteExtension\Microsoft.AspNetCore.Runtime.SiteExtension.csproj" PackageName="AspNetCoreRuntime.3.0.x86" BuildProperties="RuntimeArch=x86;" />
|
||||||
|
<SiteExtensions Include="$(RepositoryRoot)extensions\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj" PackageName="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ExcludeFromTest
|
||||||
|
Condition="'$(AntaresTests)' != ''"
|
||||||
|
Include="$(RepositoryRoot)test\*\*.csproj"
|
||||||
|
Exclude="$(FunctionalTestsProject)" />
|
||||||
|
|
||||||
|
<ExcludeFromTest
|
||||||
|
Condition="'$(AntaresTests)' == ''"
|
||||||
|
Include="$(FunctionalTestsProject)" />
|
||||||
|
|
||||||
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.AzureAppServices.SiteExtension.Tests\*.csproj" Condition="'$(OS)' != 'Windows_NT'" />
|
||||||
|
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.Web.Xdt.Extensions.Tests\*.csproj" Condition="'$(OS)' != 'Windows_NT'" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
<Project>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ComposeSdk Condition="$(SITE_EXTENSION_SDK_VERSION) == ''">True</ComposeSdk>
|
||||||
|
<_SdkVersion>$(SITE_EXTENSION_SDK_VERSION)</_SdkVersion>
|
||||||
|
<_SdkVersion Condition="'$(_SdkVersion)' == ''">$([System.IO.Path]::GetFileName($([System.IO.Path]::GetDirectoryName('$(MSBuildExtensionsPath)'))))</_SdkVersion>
|
||||||
|
<_SdkFeed>$(SITE_EXTENSION_SDK_FEED)</_SdkFeed>
|
||||||
|
<_SdkFeed Condition="'$(_SdkFeed)' == ''">$(DefaultDotNetAssetFeed)</_SdkFeed>
|
||||||
|
<TestDotNetPath>$(RepositoryRoot).test-dotnet\</TestDotNetPath>
|
||||||
|
<AppsArtifactDirectory>$(RepositoryRoot)artifacts\apps</AppsArtifactDirectory>
|
||||||
|
<SiteExtensionWorkingDirectory>$(TestDotNetPath)extension\$(SiteExtensionArch)\</SiteExtensionWorkingDirectory>
|
||||||
|
<SiteExtensionOutputDirectory>$(RepositoryRoot)artifacts\build</SiteExtensionOutputDirectory>
|
||||||
|
<TestProjectDirectory>$(RepositoryRoot)\test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\</TestProjectDirectory>
|
||||||
|
<SiteExtensionFeed Condition="$(SiteExtensionFeed) == ''">https://dotnet.myget.org/F/aspnetcore-dev/</SiteExtensionFeed>
|
||||||
|
<SiteExtensionNETCoreAppPackageVersion>$(MicrosoftNETCoreAppPackageVersion)</SiteExtensionNETCoreAppPackageVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Target Name="_AddTestRuntimes">
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreSdk Include="2.0.0" InstallDir="$(TestDotNetPath)2.0\" FallbackPackageCache="True" />
|
||||||
|
<DotNetCoreSdk Include="$(_SdkVersion)" InstallDir="$(TestDotNetPath)latest\" FallbackPackageCache="True" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_CleanSiteExtension">
|
||||||
|
<RemoveDir Directories="$(SiteExtensionWorkingDirectory)" Condition="Exists($(SiteExtensionWorkingDirectory))" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="_AddSiteExtensionRuntime">
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCoreRuntime
|
||||||
|
Include="$(SiteExtensionNETCoreAppPackageVersion)"
|
||||||
|
InstallDir="$(SiteExtensionWorkingDirectory)"
|
||||||
|
Arch="$(SiteExtensionArch)"
|
||||||
|
Feed="$(DotNetAssetRootUrl)"
|
||||||
|
FeedCredential="$(DotNetAssetRootAccessTokenSuffix)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PrepareSiteExtensionSdk" DependsOnTargets="_AddSiteExtensionRuntime;InstallDotNet">
|
||||||
|
<UnzipArchive File="$(ArtifactDependencyLocation)\aspnetcore-runtime-internal-$(PackageVersion)-win-$(SiteExtensionArch).zip" Destination="$(SiteExtensionWorkingDirectory)" Overwrite="true" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PrepareSiteExtensionSdks">
|
||||||
|
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="PrepareSiteExtensionSdk" Properties="SiteExtensionArch=x86" />
|
||||||
|
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="PrepareSiteExtensionSdk" Properties="SiteExtensionArch=x64" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="BuildSiteExtension" DependsOnTargets="_CleanSiteExtension;PrepareSiteExtensionSdks">
|
||||||
|
<MSBuild Projects="%(SiteExtensions.Identity)"
|
||||||
|
Targets="Restore"
|
||||||
|
Properties="BuildNumber=$(BuildNumber)" />
|
||||||
|
|
||||||
|
<MSBuild Projects="%(SiteExtensions.Identity)"
|
||||||
|
Targets="Pack"
|
||||||
|
Properties="%(SiteExtensions.BuildProperties);DotnetHomeDirectory=$(SiteExtensionWorkingDirectory);BuildNumber=$(BuildNumber);PackageOutputPath=$(SiteExtensionOutputDirectory)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="PushSiteExtension" DependsOnTargets="BuildSiteExtension">
|
||||||
|
<ItemGroup>
|
||||||
|
<RepositoryNupkgs Include="$(SiteExtensionOutputDirectory)\%(SiteExtensions.PackageName).*.nupkg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PushNuGetPackages
|
||||||
|
Packages="@(RepositoryNupkgs)"
|
||||||
|
Feed="$(SiteExtensionFeed)"
|
||||||
|
ApiKey="$(APIKey)"
|
||||||
|
TimeoutSeconds="600"/>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="TestSiteExtension" DependsOnTargets="_AddTestRuntimes;InstallDotNet;Restore">
|
||||||
|
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)NuGet.config.template" DestinationFiles="$(RepositoryRoot)artifacts\NuGet.config" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)global.json.template" DestinationFiles="$(RepositoryRoot)artifacts\global.json" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)Directory.Build.props.template" DestinationFiles="$(RepositoryRoot)artifacts\Directory.Build.props" />
|
||||||
|
<Copy SourceFiles="$(TestProjectDirectory)Directory.Build.targets.template" DestinationFiles="$(RepositoryRoot)artifacts\Directory.Build.targets" />
|
||||||
|
|
||||||
|
<Exec Command="%(DotNetCoreSdk.InstallDir)dotnet msbuild /version" WorkingDirectory="$(RepositoryRoot)artifacts\" />
|
||||||
|
|
||||||
|
<Exec Command="dotnet run" WorkingDirectory="$(TestProjectDirectory)"/>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="CleanArtifactsApplications" BeforeTargets="CleanArtifacts" >
|
||||||
|
<!--
|
||||||
|
git deploy creates read-only files which msbuild is unable to remove
|
||||||
|
NOTE: we run tests only on windows
|
||||||
|
-->
|
||||||
|
<Exec Command="rmdir /S /Q "$(AppsArtifactDirectory)"" Condition="Exists($(AppsArtifactDirectory))" />
|
||||||
|
<RemoveDir Directories="$(SiteExtensionOutputDirectory)" Condition="Exists($(SiteExtensionOutputDirectory))" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
|
||||||
|
|
||||||
|
<PropertyGroup Label="RestoreSources">
|
||||||
|
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
|
||||||
|
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true' AND '$(AspNetUniverseBuildOffline)' != 'true' ">
|
||||||
|
$(RestoreSources);
|
||||||
|
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
|
||||||
|
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||||
|
https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json;
|
||||||
|
</RestoreSources>
|
||||||
|
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
|
||||||
|
$(RestoreSources);
|
||||||
|
https://api.nuget.org/v3/index.json;
|
||||||
|
</RestoreSources>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
<PackageType>AzureSiteExtension</PackageType>
|
||||||
|
<NoPackageAnalysis>true</NoPackageAnalysis>
|
||||||
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
|
<IncludeSymbols>false</IncludeSymbols>
|
||||||
|
<IncludeSource>false</IncludeSource>
|
||||||
|
<ContentTargetFolders>content</ContentTargetFolders>
|
||||||
|
<!--
|
||||||
|
NuGet skips files ending .nuget producing warning at the same time
|
||||||
|
there is no way to disable default excludes from MsBuild (see:https://github.com/NuGet/Home/issues/6450)
|
||||||
|
and we don't care about item templates on Antares
|
||||||
|
-->
|
||||||
|
<NoWarn>$(NoWarn);NU5119</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
|
||||||
|
<title>ASP.NET Core Extensions</title>
|
||||||
|
<Description>This extension enables additional functionality for ASP.NET Core on Azure WebSites, such as enabling Azure logging.</Description>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnet;logging;aspnetcore;AzureSiteExtension;keyvault;configuration;dataprotection</PackageTags>
|
||||||
|
<ContentTargetFolders>content</ContentTargetFolders>
|
||||||
|
<HostingStartupRuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</HostingStartupRuntimeFrameworkVersion>
|
||||||
|
<PackageId>Microsoft.AspNetCore.AzureAppServices.SiteExtension.$(TrimmedVersion)</PackageId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<HostingStartupPackageReference Include="Microsoft.AspNetCore.AzureAppServices.HostingStartup" Version="$(MicrosoftAspNetCoreAzureAppServicesHostingStartupPackageVersion)" />
|
||||||
|
|
||||||
|
<PackageReference Include="Internal.AspNetCore.SiteExtension.Sdk" Version="$(InternalAspNetCoreSiteExtensionSdkPackageVersion)" PrivateAssets="All" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TrimmedVersion>$(VersionPrefix.Substring(0, $(VersionPrefix.LastIndexOf('.'))))</TrimmedVersion>
|
||||||
|
<Title>ASP.NET Core $(TrimmedVersion) ($(RuntimeArch)) Runtime </Title>
|
||||||
|
<Description>This site extension installs Microsoft.AspNetCore.All, Microsoft.AspNetCore.App and Microsoft.NetCore.App shared runtimes.</Description>
|
||||||
|
<PackageTags>aspnetcore;AzureSiteExtension</PackageTags>
|
||||||
|
<PackageId>AspNetCoreRuntime.$(TrimmedVersion).$(RuntimeArch)</PackageId>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="applicationHost.xdt" />
|
||||||
|
<Content Include="scmApplicationHost.xdt" />
|
||||||
|
<Content Include="install.cmd" />
|
||||||
|
<Content Include="$(OutputPath)\Microsoft.Web.Xdt.Extensions.dll" PackagePath="content" />
|
||||||
|
|
||||||
|
<Content Include="$(DotnetHomeDirectory)\$(RuntimeArch)\**\*.*" Condition="$(DotnetHomeDirectory) != ''" PackagePath="content\%(RecursiveDir)%(FileName)%(Extension)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(RuntimeArch)' == 'x86'">
|
||||||
|
<Content Include="$(AspNetCoreModuleX86Location)" PackagePath="content\ancm" />
|
||||||
|
<Content Include="$(OutOfProcessRequestHandlerX86Location)" PackagePath="content\ancm\$(AspNetCoreModuleOutOfProcessVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(RuntimeArch)' == 'x64'">
|
||||||
|
<Content Include="$(AspNetCoreModuleX64Location)" PackagePath="content\ancm" />
|
||||||
|
<Content Include="$(OutOfProcessRequestHandlerX64Location)" PackagePath="content\ancm\$(AspNetCoreModuleOutOfProcessVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj" PrivateAssets="All" />
|
||||||
|
<PackageReference Condition="'$(OS)' == 'Windows_NT'" Include="Microsoft.AspNetCore.AspNetCoreModuleV2" Version="$(MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
|
||||||
|
<xdt:Import path="%XDT_EXTENSIONPATH%\Microsoft.Web.Xdt.Extensions.dll"
|
||||||
|
namespace="Microsoft.Web.Xdt.Extensions" />
|
||||||
|
|
||||||
|
<system.webServer xdt:Transform="InsertIfMissing">
|
||||||
|
<runtime xdt:Transform="InsertIfMissing" >
|
||||||
|
<environmentVariables xdt:Transform="InsertIfMissing">
|
||||||
|
<add name="PATH" value="%XDT_EXTENSIONPATH%;%USERPROFILE%\.dotnet\tools;%PATH%" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
<add name="DOTNET_SKIP_FIRST_TIME_EXPERIENCE" value="1" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
<add name="DOTNET_ROOT" value="%XDT_EXTENSIONPATH%" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
</environmentVariables>
|
||||||
|
</runtime>
|
||||||
|
|
||||||
|
<globalModules>
|
||||||
|
<add name="AspNetCoreModuleV2" image="%XDT_EXTENSIONPATH%\ancm\aspnetcorev2.dll" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
</globalModules>
|
||||||
|
</system.webServer>
|
||||||
|
|
||||||
|
<location>
|
||||||
|
<system.webServer>
|
||||||
|
<modules>
|
||||||
|
<add name="AspNetCoreModuleV2" lockItem="true" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />
|
||||||
|
</modules>
|
||||||
|
</system.webServer>
|
||||||
|
</location>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
FOR /R %%x IN (*.nupkg_) DO REN "%%x" "*.nupkg"
|
||||||
|
|
||||||
|
|
||||||
|
SET DOTNET=D:\Program Files (x86)\dotnet
|
||||||
|
SET RUNTIMES=%DOTNET%\shared\Microsoft.NETCore.App
|
||||||
|
|
||||||
|
IF "%ASPNETCORE_COPY_EXISTING_RUNTIMES%" NEQ "1" EXIT /b 0
|
||||||
|
|
||||||
|
robocopy "%DOTNET%" "." /E /XC /XN /XO /NFL /NDL ^
|
||||||
|
/XD "%DOTNET%\sdk" ^
|
||||||
|
/XD "%RUNTIMES%\1.0.8" ^
|
||||||
|
/XD "%RUNTIMES%\1.1.5" ^
|
||||||
|
/XD "%RUNTIMES%\2.0.3"
|
||||||
|
|
||||||
|
IF %errorlevel% geq 8 EXIT /b 1
|
||||||
|
EXIT /b 0
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
<!-- This file exists to prevent applicationHost.xdt from being applied to scm host that runs
|
||||||
|
other dotnet processes (dotnet build, csc etc. )-->
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServices.HostingStartup\Microsoft.AspNetCore.AzureAppServices.HostingStartup.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:22071/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.AzureAppServices.HostingStartup;Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AzureAppServicesHostingStartupSample": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace IISSample
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
|
{
|
||||||
|
var logger = loggerfactory.CreateLogger("Requests");
|
||||||
|
|
||||||
|
app.Run(async (context) =>
|
||||||
|
{
|
||||||
|
logger.LogDebug("Received request: " + context.Request.Method + " " + context.Request.Path);
|
||||||
|
|
||||||
|
context.Response.ContentType = "text/plain";
|
||||||
|
await context.Response.WriteAsync("Hello World - " + DateTimeOffset.Now + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Address:" + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Scheme: " + context.Request.Scheme + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("PathBase: " + context.Request.PathBase.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Path: " + context.Request.Path.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Query: " + context.Request.QueryString.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Connection:" + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("RemoteIp: " + context.Connection.RemoteIpAddress + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("RemotePort: " + context.Connection.RemotePort + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("LocalIp: " + context.Connection.LocalIpAddress + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("LocalPort: " + context.Connection.LocalPort + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("ClientCert: " + context.Connection.ClientCertificate + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("User: " + context.User.Identity.Name + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Headers:" + Environment.NewLine);
|
||||||
|
foreach (var header in context.Request.Headers)
|
||||||
|
{
|
||||||
|
await context.Response.WriteAsync(header.Key + ": " + header.Value + Environment.NewLine);
|
||||||
|
}
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Environment Variables:" + Environment.NewLine);
|
||||||
|
var vars = Environment.GetEnvironmentVariables();
|
||||||
|
foreach (var key in vars.Keys.Cast<string>().OrderBy(key => key, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var value = vars[key];
|
||||||
|
await context.Response.WriteAsync(key + ": " + value + Environment.NewLine);
|
||||||
|
}
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
|
.UseKestrel()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:64358/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
|
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Server.IISIntegration"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AzureAppServicesSample": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace IISSample
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
// These two middleware are registered via an IStartupFilter in UseIISIntegration but you can configure them here.
|
||||||
|
services.Configure<IISOptions>(options =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||||
|
{
|
||||||
|
var logger = loggerfactory.CreateLogger("Requests");
|
||||||
|
|
||||||
|
app.Run(async (context) =>
|
||||||
|
{
|
||||||
|
logger.LogDebug("Received request: " + context.Request.Method + " " + context.Request.Path);
|
||||||
|
|
||||||
|
context.Response.ContentType = "text/plain";
|
||||||
|
await context.Response.WriteAsync("Hello World - " + DateTimeOffset.Now + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Address:" + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Scheme: " + context.Request.Scheme + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Host: " + context.Request.Headers["Host"] + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("PathBase: " + context.Request.PathBase.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Path: " + context.Request.Path.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("Query: " + context.Request.QueryString.Value + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Connection:" + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("RemoteIp: " + context.Connection.RemoteIpAddress + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("RemotePort: " + context.Connection.RemotePort + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("LocalIp: " + context.Connection.LocalIpAddress + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("LocalPort: " + context.Connection.LocalPort + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync("ClientCert: " + context.Connection.ClientCertificate + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("User: " + context.User.Identity.Name + Environment.NewLine);
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Headers:" + Environment.NewLine);
|
||||||
|
foreach (var header in context.Request.Headers)
|
||||||
|
{
|
||||||
|
await context.Response.WriteAsync(header.Key + ": " + header.Value + Environment.NewLine);
|
||||||
|
}
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
|
||||||
|
await context.Response.WriteAsync("Environment Variables:" + Environment.NewLine);
|
||||||
|
var vars = Environment.GetEnvironmentVariables();
|
||||||
|
foreach (var key in vars.Keys.Cast<string>().OrderBy(key => key, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var value = vars[key];
|
||||||
|
await context.Response.WriteAsync(key + ": " + value + Environment.NewLine);
|
||||||
|
}
|
||||||
|
await context.Response.WriteAsync(Environment.NewLine);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.ConfigureLogging(factory =>
|
||||||
|
{
|
||||||
|
factory.AddConsole();
|
||||||
|
})
|
||||||
|
.UseKestrel()
|
||||||
|
.UseAzureAppServices()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.AzureAppServicesIntegration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
[assembly: HostingStartup(typeof(Microsoft.AspNetCore.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup))]
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.AzureAppServices.HostingStartup
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A dynamic azure lightup experiance
|
||||||
|
/// </summary>
|
||||||
|
public class AzureAppServicesHostingStartup : IHostingStartup
|
||||||
|
{
|
||||||
|
private const string HostingStartupName = "AppServices";
|
||||||
|
private const string DiagnosticsFeatureName = "DiagnosticsEnabled";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls UseAzureAppServices
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder"></param>
|
||||||
|
public void Configure(IWebHostBuilder builder)
|
||||||
|
{
|
||||||
|
var baseConfiguration = HostingStartupConfigurationExtensions.GetBaseConfiguration();
|
||||||
|
|
||||||
|
if (baseConfiguration.IsEnabled(HostingStartupName, DiagnosticsFeatureName))
|
||||||
|
{
|
||||||
|
builder.UseAzureAppServices();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Hosting
|
||||||
|
{
|
||||||
|
internal static class HostingStartupConfigurationExtensions
|
||||||
|
{
|
||||||
|
public static IConfiguration GetBaseConfiguration()
|
||||||
|
{
|
||||||
|
return new ConfigurationBuilder()
|
||||||
|
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
public static bool IsEnabled(this IConfiguration configuration, string hostingStartupName, string featureName)
|
||||||
|
{
|
||||||
|
if (configuration.TryGetOption(hostingStartupName, featureName, out var value))
|
||||||
|
{
|
||||||
|
value = value.ToLowerInvariant();
|
||||||
|
return value != "false" && value != "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool TryGetOption(this IConfiguration configuration, string hostingStartupName, string featureName, out string value)
|
||||||
|
{
|
||||||
|
value = configuration[$"HostingStartup:{hostingStartupName}:{featureName}"];
|
||||||
|
return !string.IsNullOrEmpty(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<Import Project="..\..\build\hostingstartup.targets" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core lightup integration with Azure AppServices.</Description>
|
||||||
|
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServices.HostingStartup, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServices.HostingStartup, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.AzureAppServices.HostingStartup.AzureAppServicesHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [
|
||||||
|
"Microsoft.AspNetCore.Hosting.IHostingStartup"
|
||||||
|
],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Configure",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "builder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Sealed": true,
|
||||||
|
"Virtual": true,
|
||||||
|
"ImplementedInterface": "Microsoft.AspNetCore.Hosting.IHostingStartup",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Hosting
|
||||||
|
{
|
||||||
|
public static class AppServicesWebHostBuilderExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Configures application to use Azure AppServices integration.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hostBuilder"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IWebHostBuilder UseAzureAppServices(this IWebHostBuilder hostBuilder)
|
||||||
|
{
|
||||||
|
if (hostBuilder == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(hostBuilder));
|
||||||
|
}
|
||||||
|
#pragma warning disable 618
|
||||||
|
hostBuilder.ConfigureLogging(builder => builder.AddAzureWebAppDiagnostics());
|
||||||
|
#pragma warning restore 618
|
||||||
|
return hostBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core integration with Azure AppServices.</Description>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="$(MicrosoftExtensionsLoggingAzureAppServicesPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.AspNetCore.AzureAppServicesIntegration, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.AspNetCore.Hosting.AppServicesWebHostBuilderExtensions",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"Abstract": true,
|
||||||
|
"Static": true,
|
||||||
|
"Sealed": true,
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "UseAzureAppServices",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "hostBuilder",
|
||||||
|
"Type": "Microsoft.AspNetCore.Hosting.IWebHostBuilder"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "Microsoft.AspNetCore.Hosting.IWebHostBuilder",
|
||||||
|
"Static": true,
|
||||||
|
"Extension": true,
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public class AppModelDetectionResult
|
||||||
|
{
|
||||||
|
public RuntimeFramework? Framework { get; set; }
|
||||||
|
public string FrameworkVersion { get; set; }
|
||||||
|
public string AspNetCoreVersion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,250 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
|
using System.Reflection.PortableExecutable;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public class AppModelDetector
|
||||||
|
{
|
||||||
|
// We use Hosting package to detect AspNetCore version
|
||||||
|
// it contains light-up implemenation that we care about and
|
||||||
|
// would have to be used by aspnet core web apps
|
||||||
|
private const string AspNetCoreAssembly = "Microsoft.AspNetCore.Hosting";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reads the following sources
|
||||||
|
/// - web.config to detect dotnet framework kind
|
||||||
|
/// - *.runtimeconfig.json to detect target framework version
|
||||||
|
/// - *.deps.json to detect Asp.Net Core version
|
||||||
|
/// - Microsoft.AspNetCore.Hosting.dll to detect Asp.Net Core version
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="directory">The application directory</param>
|
||||||
|
/// <returns>The <see cref="AppModelDetectionResult"/> instance containing information about application</returns>
|
||||||
|
public AppModelDetectionResult Detect(DirectoryInfo directory)
|
||||||
|
{
|
||||||
|
string entryPoint = null;
|
||||||
|
|
||||||
|
// Try reading web.config and resolving framework and app path
|
||||||
|
var webConfig = directory.GetFiles("web.config").FirstOrDefault();
|
||||||
|
|
||||||
|
bool webConfigExists = webConfig != null;
|
||||||
|
bool? usesDotnetExe = null;
|
||||||
|
|
||||||
|
if (webConfigExists &&
|
||||||
|
TryParseWebConfig(webConfig, out var dotnetExe, out entryPoint))
|
||||||
|
{
|
||||||
|
usesDotnetExe = dotnetExe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we found entry point let's look for .deps.json
|
||||||
|
// in some cases it exists in desktop too
|
||||||
|
FileInfo depsJson = null;
|
||||||
|
FileInfo runtimeConfig = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(entryPoint))
|
||||||
|
{
|
||||||
|
depsJson = new FileInfo(Path.ChangeExtension(entryPoint, ".deps.json"));
|
||||||
|
runtimeConfig = new FileInfo(Path.ChangeExtension(entryPoint, ".runtimeconfig.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depsJson == null || !depsJson.Exists)
|
||||||
|
{
|
||||||
|
depsJson = directory.GetFiles("*.deps.json").FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (runtimeConfig == null || !runtimeConfig.Exists)
|
||||||
|
{
|
||||||
|
runtimeConfig = directory.GetFiles("*.runtimeconfig.json").FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
string aspNetCoreVersionFromDeps = null;
|
||||||
|
string aspNetCoreVersionFromDll = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Try to detect ASP.NET Core version from .deps.json
|
||||||
|
if (depsJson != null &&
|
||||||
|
depsJson.Exists &&
|
||||||
|
TryParseDependencies(depsJson, out var aspNetCoreVersion))
|
||||||
|
{
|
||||||
|
aspNetCoreVersionFromDeps = aspNetCoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to detect ASP.NET Core version from .deps.json
|
||||||
|
var aspNetCoreDll = directory.GetFiles(AspNetCoreAssembly + ".dll").FirstOrDefault();
|
||||||
|
if (aspNetCoreDll != null &&
|
||||||
|
TryParseAssembly(aspNetCoreDll, out aspNetCoreVersion))
|
||||||
|
{
|
||||||
|
aspNetCoreVersionFromDll = aspNetCoreVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to detect dotnet core runtime version from runtimeconfig.json
|
||||||
|
string runtimeVersionFromRuntimeConfig = null;
|
||||||
|
if (runtimeConfig != null &&
|
||||||
|
runtimeConfig.Exists)
|
||||||
|
{
|
||||||
|
TryParseRuntimeConfig(runtimeConfig, out runtimeVersionFromRuntimeConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new AppModelDetectionResult();
|
||||||
|
if (usesDotnetExe == true)
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetCore;
|
||||||
|
result.FrameworkVersion = runtimeVersionFromRuntimeConfig;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (depsJson?.Exists == true &&
|
||||||
|
runtimeConfig?.Exists == true)
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetCoreStandalone;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Framework = RuntimeFramework.DotNetFramework;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.AspNetCoreVersion = aspNetCoreVersionFromDeps ?? aspNetCoreVersionFromDll;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseAssembly(FileInfo aspNetCoreDll, out string aspNetCoreVersion)
|
||||||
|
{
|
||||||
|
aspNetCoreVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = aspNetCoreDll.OpenRead())
|
||||||
|
using (var peReader = new PEReader(stream))
|
||||||
|
{
|
||||||
|
var metadataReader = peReader.GetMetadataReader();
|
||||||
|
var assemblyDefinition = metadataReader.GetAssemblyDefinition();
|
||||||
|
aspNetCoreVersion = assemblyDefinition.Version.ToString();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search for Microsoft.AspNetCore.Hosting entry in deps.json and get it's version number
|
||||||
|
/// </summary>
|
||||||
|
private bool TryParseDependencies(FileInfo depsJson, out string aspnetCoreVersion)
|
||||||
|
{
|
||||||
|
aspnetCoreVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var streamReader = depsJson.OpenText())
|
||||||
|
using (var jsonReader = new JsonTextReader(streamReader))
|
||||||
|
{
|
||||||
|
var json = JObject.Load(jsonReader);
|
||||||
|
|
||||||
|
var libraryPrefix = AspNetCoreAssembly+ "/";
|
||||||
|
|
||||||
|
var library = json.Descendants().OfType<JProperty>().FirstOrDefault(property => property.Name.StartsWith(libraryPrefix));
|
||||||
|
if (library != null)
|
||||||
|
{
|
||||||
|
aspnetCoreVersion = library.Name.Substring(libraryPrefix.Length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseRuntimeConfig(FileInfo runtimeConfig, out string frameworkVersion)
|
||||||
|
{
|
||||||
|
frameworkVersion = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var streamReader = runtimeConfig.OpenText())
|
||||||
|
using (var jsonReader = new JsonTextReader(streamReader))
|
||||||
|
{
|
||||||
|
var json = JObject.Load(jsonReader);
|
||||||
|
frameworkVersion = (string)json?["runtimeOptions"]
|
||||||
|
?["framework"]
|
||||||
|
?["version"];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryParseWebConfig(FileInfo webConfig, out bool usesDotnetExe, out string entryPoint)
|
||||||
|
{
|
||||||
|
usesDotnetExe = false;
|
||||||
|
entryPoint = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var xdocument = XDocument.Load(webConfig.FullName);
|
||||||
|
var aspNetCoreHandler = xdocument.Root?
|
||||||
|
.Element("system.webServer")
|
||||||
|
.Element("aspNetCore");
|
||||||
|
|
||||||
|
if (aspNetCoreHandler == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var processPath = (string) aspNetCoreHandler.Attribute("processPath");
|
||||||
|
var arguments = (string) aspNetCoreHandler.Attribute("arguments");
|
||||||
|
|
||||||
|
if (processPath.EndsWith("dotnet", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
processPath.EndsWith("dotnet.exe", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!string.IsNullOrWhiteSpace(arguments))
|
||||||
|
{
|
||||||
|
usesDotnetExe = true;
|
||||||
|
var entryPointPart = arguments.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(entryPointPart))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
entryPoint = Path.GetFullPath(Path.Combine(webConfig.DirectoryName, entryPointPart));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usesDotnetExe = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
entryPoint = Path.GetFullPath(Path.Combine(webConfig.DirectoryName, processPath));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>ASP.NET Core integration with Azure AppServices.</Description>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>aspnetcore;azure;appservices</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
||||||
|
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection
|
||||||
|
{
|
||||||
|
public enum RuntimeFramework
|
||||||
|
{
|
||||||
|
DotNetCore,
|
||||||
|
DotNetCoreStandalone,
|
||||||
|
DotNetFramework
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.Extensions.ApplicationModelDetection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetectionResult",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_Framework",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Nullable<Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework>",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_Framework",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.Nullable<Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework>"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_FrameworkVersion",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_FrameworkVersion",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_AspNetCoreVersion",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "set_AspNetCoreVersion",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "value",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetector",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Detect",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "directory",
|
||||||
|
"Type": "System.IO.DirectoryInfo"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "Microsoft.Extensions.ApplicationModelDetection.AppModelDetectionResult",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Extensions.ApplicationModelDetection.RuntimeFramework",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Enumeration",
|
||||||
|
"Sealed": true,
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetCore",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetCoreStandalone",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Field",
|
||||||
|
"Name": "DotNetFramework",
|
||||||
|
"Parameters": [],
|
||||||
|
"GenericParameter": [],
|
||||||
|
"Literal": "2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Xml;
|
||||||
|
using Microsoft.Web.XmlTransform;
|
||||||
|
|
||||||
|
namespace Microsoft.Web.Xdt.Extensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Insert or append to the given attribute
|
||||||
|
/// </summary>
|
||||||
|
public class InsertOrAppendAttribute : Transform
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public InsertOrAppendAttribute()
|
||||||
|
: base(TransformFlags.UseParentAsTargetNode, MissingTargetMessage.Error)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _attributeName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected string AttributeName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_attributeName == null)
|
||||||
|
{
|
||||||
|
_attributeName = GetArgumentValue("Attribute");
|
||||||
|
}
|
||||||
|
return _attributeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts a value from the arguments provided
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected string GetArgumentValue(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
string result = null;
|
||||||
|
if (Arguments != null && Arguments.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var arg in Arguments)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(arg))
|
||||||
|
{
|
||||||
|
var trimmedArg = arg.Trim();
|
||||||
|
if (trimmedArg.StartsWith(name, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var start = arg.IndexOf('\'');
|
||||||
|
var last = arg.LastIndexOf('\'');
|
||||||
|
if (start <= 0 || last <= 0 || last <= start)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Expected two ['] characters");
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = trimmedArg.Substring(start, last - start);
|
||||||
|
|
||||||
|
// remove any leading or trailing '
|
||||||
|
value = value.Trim().TrimStart('\'').TrimStart('\'');
|
||||||
|
result = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected override void Apply()
|
||||||
|
{
|
||||||
|
if (TargetChildNodes == null || TargetChildNodes.Count == 0)
|
||||||
|
{
|
||||||
|
TargetNode.AppendChild(TransformNode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlAttribute transformAtt = null;
|
||||||
|
|
||||||
|
foreach (XmlAttribute att in TransformNode.Attributes)
|
||||||
|
{
|
||||||
|
if (string.Equals(att.Name, AttributeName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
transformAtt = att;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transformAtt == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("No target attribute to append");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (XmlNode targetNode in TargetChildNodes)
|
||||||
|
{
|
||||||
|
var foundAttribute = false;
|
||||||
|
foreach (XmlAttribute att in targetNode.Attributes)
|
||||||
|
{
|
||||||
|
if (string.Equals(att.Name, AttributeName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
foundAttribute = true;
|
||||||
|
if (string.IsNullOrEmpty(att.Value))
|
||||||
|
{
|
||||||
|
att.Value = transformAtt.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: This doesn't compose well with insertOrAppend being applied on the TargetNode.
|
||||||
|
// The target node is created with the children it has in the transform, which means we would
|
||||||
|
// duplicate the value here.
|
||||||
|
if (att.Value == transformAtt.Value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
att.Value = $"{att.Value};{transformAtt.Value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!foundAttribute)
|
||||||
|
{
|
||||||
|
var attribute = targetNode.OwnerDocument.CreateAttribute(AttributeName);
|
||||||
|
attribute.Value = transformAtt.Value;
|
||||||
|
targetNode.Attributes.Append(attribute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<Description>Additional functionality for Xdt transforms.</Description>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageTags>xdt</PackageTags>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Web.Xdt" Version="$(MicrosoftWebXdtPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"AssemblyIdentity": "Microsoft.Web.Xdt.Extensions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||||
|
"Types": [
|
||||||
|
{
|
||||||
|
"Name": "Microsoft.Web.Xdt.Extensions.InsertOrAppendAttribute",
|
||||||
|
"Visibility": "Public",
|
||||||
|
"Kind": "Class",
|
||||||
|
"BaseType": "Microsoft.Web.XmlTransform.Transform",
|
||||||
|
"ImplementedInterfaces": [],
|
||||||
|
"Members": [
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "get_AttributeName",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "GetArgumentValue",
|
||||||
|
"Parameters": [
|
||||||
|
{
|
||||||
|
"Name": "name",
|
||||||
|
"Type": "System.String"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReturnType": "System.String",
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Method",
|
||||||
|
"Name": "Apply",
|
||||||
|
"Parameters": [],
|
||||||
|
"ReturnType": "System.Void",
|
||||||
|
"Virtual": true,
|
||||||
|
"Override": true,
|
||||||
|
"Visibility": "Protected",
|
||||||
|
"GenericParameter": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Kind": "Constructor",
|
||||||
|
"Name": ".ctor",
|
||||||
|
"Parameters": [],
|
||||||
|
"Visibility": "Public",
|
||||||
|
"GenericParameter": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"GenericParameters": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project>
|
||||||
|
<Import Project="..\Directory.Build.props" />
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(IsTestProject)' != 'false'">
|
||||||
|
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||||
|
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
|
||||||
|
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Hosting.Azure.AppServices.Tests
|
||||||
|
{
|
||||||
|
public class AppServicesWebHostBuilderExtensionsTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void UseAzureAppServices_RegisterLogger()
|
||||||
|
{
|
||||||
|
var mock = new Mock<IWebHostBuilder>();
|
||||||
|
|
||||||
|
mock.Object.UseAzureAppServices();
|
||||||
|
|
||||||
|
mock.Verify(builder => builder.ConfigureServices(It.IsNotNull<Action<IServiceCollection>>()), Times.Once);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServicesIntegration\Microsoft.AspNetCore.AzureAppServicesIntegration.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.AzureAppServices.HostingStartup\Microsoft.AspNetCore.AzureAppServices.HostingStartup.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(MicrosoftAspNetCoreTestHostPackageVersion)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
// // Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.ApplicationModelDetection.Tests
|
||||||
|
{
|
||||||
|
public class AppModelTests
|
||||||
|
{
|
||||||
|
private const string EmptyWebConfig = @"<?xml version=""1.0"" encoding=""utf-8""?><configuration></configuration>";
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("dotnet")]
|
||||||
|
[InlineData("dotnet.exe")]
|
||||||
|
[InlineData("%HOME%/dotnet")]
|
||||||
|
[InlineData("%HOME%/dotnet.exe")]
|
||||||
|
[InlineData("DoTNeT.ExE")]
|
||||||
|
public void DetectsCoreFrameworkFromWebConfig(string processPath)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config",GenerateWebConfig(processPath, ".\\app.dll")))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCore, result.Framework);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("app")]
|
||||||
|
[InlineData("app.exe")]
|
||||||
|
[InlineData("%HOME%/app")]
|
||||||
|
[InlineData("%HOME%/app.exe")]
|
||||||
|
public void DetectsFullFrameworkFromWebConfig(string processPath)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig(processPath, ".\\app.dll")))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetFramework, result.Framework);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("2.0.0")]
|
||||||
|
[InlineData("2.0.0-preview1")]
|
||||||
|
[InlineData("1.1.3")]
|
||||||
|
public void DetectsRuntimeVersionFromRuntimeConfig(string runtimeVersion)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig("dotnet", ".\\app.dll"))
|
||||||
|
.WithFile("app.runtimeconfig.json", @"{
|
||||||
|
""runtimeOptions"": {
|
||||||
|
""tfm"": ""netcoreapp2.0"",
|
||||||
|
""framework"": {
|
||||||
|
""name"": ""Microsoft.NETCore.App"",
|
||||||
|
""version"": """+ runtimeVersion + @"""
|
||||||
|
},
|
||||||
|
""configProperties"": {
|
||||||
|
""System.GC.Server"": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCore, result.Framework);
|
||||||
|
Assert.Equal(runtimeVersion, result.FrameworkVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("2.0.0")]
|
||||||
|
[InlineData("2.0.0-preview1")]
|
||||||
|
[InlineData("1.1.3")]
|
||||||
|
public void DetectsRuntimeVersionFromRuntimeConfigWitoutEntryPoint(string runtimeVersion)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig("dotnet", "%HOME%\\app.dll"))
|
||||||
|
.WithFile("app.runtimeconfig.json", @"{
|
||||||
|
""runtimeOptions"": {
|
||||||
|
""tfm"": ""netcoreapp2.0"",
|
||||||
|
""framework"": {
|
||||||
|
""name"": ""Microsoft.NETCore.App"",
|
||||||
|
""version"": """+ runtimeVersion + @"""
|
||||||
|
},
|
||||||
|
""configProperties"": {
|
||||||
|
""System.GC.Server"": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCore, result.Framework);
|
||||||
|
Assert.Equal(runtimeVersion, result.FrameworkVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("2.0.0")]
|
||||||
|
[InlineData("2.0.0-preview1")]
|
||||||
|
[InlineData("1.1.3")]
|
||||||
|
public void DetectsAspNetCoreVersionFromDepsFile(string runtimeVersion)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig("dotnet", "app.dll"))
|
||||||
|
.WithFile("app.deps.json", @"{
|
||||||
|
""targets"": {
|
||||||
|
"".NETCoreApp,Version=v2.7"": {
|
||||||
|
""Microsoft.AspNetCore.Hosting/" + runtimeVersion + @""": { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCore, result.Framework);
|
||||||
|
Assert.Equal(runtimeVersion, result.AspNetCoreVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("2.0.0")]
|
||||||
|
[InlineData("2.0.0-preview1")]
|
||||||
|
[InlineData("1.1.3")]
|
||||||
|
public void DetectsAspNetCoreVersionFromDepsFileWithoutEntryPoint(string runtimeVersion)
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig("dotnet", "%HOME%\\app.dll"))
|
||||||
|
.WithFile("app.deps.json", @"{
|
||||||
|
""targets"": {
|
||||||
|
"".NETCoreApp,Version=v2.7"": {
|
||||||
|
""Microsoft.AspNetCore.Hosting/" + runtimeVersion + @""": { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}"))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCore, result.Framework);
|
||||||
|
Assert.Equal(runtimeVersion, result.AspNetCoreVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DetectsFullFrameworkWhenWebConfigExists()
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", EmptyWebConfig))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetFramework, result.Framework);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DetectsStandalone_WhenBothDepsAndRuntimeConfigExist()
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile("web.config", GenerateWebConfig("app.exe", ""))
|
||||||
|
.WithFile("app.runtimeconfig.json", "{}")
|
||||||
|
.WithFile("app.deps.json", "{}"))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(RuntimeFramework.DotNetCoreStandalone, result.Framework);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DetectsAspNetCoreVersionFromHostingDll()
|
||||||
|
{
|
||||||
|
using (var temp = new TemporaryDirectory()
|
||||||
|
.WithFile(typeof(WebHostBuilder).Assembly.Location))
|
||||||
|
{
|
||||||
|
var result = new AppModelDetector().Detect(temp.Directory);
|
||||||
|
Assert.Equal(typeof(WebHostBuilder).Assembly.GetName().Version.ToString(), result.AspNetCoreVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GenerateWebConfig(string processPath, string arguments)
|
||||||
|
{
|
||||||
|
return $@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||||
|
<configuration>
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name=""aspNetCore"" path=""*"" verb=""*"" modules=""AspNetCoreModule"" resourceType=""Unspecified"" />
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath=""{processPath}"" arguments=""{arguments}"" stdoutLogEnabled=""false"" stdoutLogFile="".\logs\stdout"" />
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TemporaryDirectory: IDisposable
|
||||||
|
{
|
||||||
|
public TemporaryDirectory()
|
||||||
|
{
|
||||||
|
Directory = new DirectoryInfo(Path.GetTempPath())
|
||||||
|
.CreateSubdirectory(Guid.NewGuid().ToString("N"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DirectoryInfo Directory { get; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(true);
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TemporaryDirectory WithFile(string name, string value)
|
||||||
|
{
|
||||||
|
File.WriteAllText(Path.Combine(Directory.FullName, name), value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TemporaryDirectory WithFile(string name)
|
||||||
|
{
|
||||||
|
File.Copy(name, Path.Combine(Directory.FullName, Path.GetFileName(name)));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.Extensions.ApplicationModelDetection\Microsoft.Extensions.ApplicationModelDetection.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using Microsoft.Web.XmlTransform;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.Web.Xdt.Extensions
|
||||||
|
{
|
||||||
|
public class InsertOrAppendAttributeTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void InsertOrAppend_NoExesitingLine_InsertsLine()
|
||||||
|
{
|
||||||
|
var transform = new XmlTransformation(Path.GetFullPath("transform.xdt"));
|
||||||
|
var doc = new XmlDocument();
|
||||||
|
doc.Load("config_empty.xml");
|
||||||
|
Assert.True(transform.Apply(doc));
|
||||||
|
|
||||||
|
Assert.Equal(2, doc.ChildNodes.Count);
|
||||||
|
var configurationNode = doc["configuration"];
|
||||||
|
|
||||||
|
Assert.Equal(2, configurationNode.ChildNodes.Count);
|
||||||
|
|
||||||
|
var firstChild = configurationNode.FirstChild;
|
||||||
|
Assert.Equal("add", firstChild.Name);
|
||||||
|
Assert.Equal("KeyName1", firstChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue1", firstChild.Attributes["value"].Value);
|
||||||
|
|
||||||
|
var secondChild = firstChild.NextSibling;
|
||||||
|
Assert.Equal("add", secondChild.Name);
|
||||||
|
Assert.Equal("KeyName2", secondChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue2", secondChild.Attributes["value"].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InsertOrAppend_LineExistsButNoValueField_FieldInserted()
|
||||||
|
{
|
||||||
|
var transform = new XmlTransformation(Path.GetFullPath("transform.xdt"));
|
||||||
|
var doc = new XmlDocument();
|
||||||
|
doc.Load("config_existingline.xml");
|
||||||
|
Assert.True(transform.Apply(doc));
|
||||||
|
|
||||||
|
Assert.Equal(2, doc.ChildNodes.Count);
|
||||||
|
var configurationNode = doc["configuration"];
|
||||||
|
|
||||||
|
Assert.Equal(2, configurationNode.ChildNodes.Count);
|
||||||
|
|
||||||
|
var firstChild = configurationNode.FirstChild;
|
||||||
|
Assert.Equal("add", firstChild.Name);
|
||||||
|
Assert.Equal("KeyName1", firstChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue1", firstChild.Attributes["value"].Value);
|
||||||
|
|
||||||
|
var secondChild = firstChild.NextSibling;
|
||||||
|
Assert.Equal("add", secondChild.Name);
|
||||||
|
Assert.Equal("KeyName2", secondChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue2", secondChild.Attributes["value"].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InsertOrAppend_ExistingEmptyValue_InsertsValue()
|
||||||
|
{
|
||||||
|
var transform = new XmlTransformation(Path.GetFullPath("transform.xdt"));
|
||||||
|
var doc = new XmlDocument();
|
||||||
|
doc.Load("config_existingemptyvalue.xml");
|
||||||
|
Assert.True(transform.Apply(doc));
|
||||||
|
|
||||||
|
Assert.Equal(2, doc.ChildNodes.Count);
|
||||||
|
var configurationNode = doc["configuration"];
|
||||||
|
|
||||||
|
Assert.Equal(2, configurationNode.ChildNodes.Count);
|
||||||
|
|
||||||
|
var firstChild = configurationNode.FirstChild;
|
||||||
|
Assert.Equal("add", firstChild.Name);
|
||||||
|
Assert.Equal("KeyName1", firstChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue1", firstChild.Attributes["value"].Value);
|
||||||
|
|
||||||
|
var secondChild = firstChild.NextSibling;
|
||||||
|
Assert.Equal("add", secondChild.Name);
|
||||||
|
Assert.Equal("KeyName2", secondChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("InsertValue2", secondChild.Attributes["value"].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InsertOrAppend_ExistingValue_AppendsValue()
|
||||||
|
{
|
||||||
|
var transform = new XmlTransformation(Path.GetFullPath("transform.xdt"));
|
||||||
|
var doc = new XmlDocument();
|
||||||
|
doc.Load("config_existingvalue.xml");
|
||||||
|
Assert.True(transform.Apply(doc));
|
||||||
|
|
||||||
|
Assert.Equal(2, doc.ChildNodes.Count);
|
||||||
|
var configurationNode = doc["configuration"];
|
||||||
|
|
||||||
|
Assert.Equal(2, configurationNode.ChildNodes.Count);
|
||||||
|
|
||||||
|
var firstChild = configurationNode.FirstChild;
|
||||||
|
Assert.Equal("add", firstChild.Name);
|
||||||
|
Assert.Equal("KeyName1", firstChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("ExistingValue1;InsertValue1", firstChild.Attributes["value"].Value);
|
||||||
|
|
||||||
|
var secondChild = firstChild.NextSibling;
|
||||||
|
Assert.Equal("add", secondChild.Name);
|
||||||
|
Assert.Equal("KeyName2", secondChild.Attributes["name"].Value);
|
||||||
|
Assert.Equal("ExistingValue2;InsertValue2", secondChild.Attributes["value"].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net461</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="transform.xdt" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="config_existingemptyvalue.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="config_existingvalue.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="config_existingline.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="config_empty.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="transform.xdt">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.Web.Xdt.Extensions\Microsoft.Web.Xdt.Extensions.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<add name="KeyName1" value="" />
|
||||||
|
<add name="KeyName2" value="" />
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<add name="KeyName1" />
|
||||||
|
<add name="KeyName2" />
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<add name="KeyName1" value="ExistingValue1" />
|
||||||
|
<add name="KeyName2" value="ExistingValue2" />
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||||
|
|
||||||
|
<xdt:Import path="Microsoft.Web.Xdt.Extensions.dll"
|
||||||
|
namespace="Microsoft.Web.Xdt.Extensions" />
|
||||||
|
|
||||||
|
<add name="KeyName1" value="InsertValue1" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
|
||||||
|
<add name="KeyName2" value="InsertValue2" xdt:Locator="Match(name)" xdt:Transform="InsertOrAppendAttribute(Attribute='value')" />
|
||||||
|
</configuration>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<VersionPrefix>3.0.0</VersionPrefix>
|
||||||
|
<VersionSuffix>alpha1</VersionSuffix>
|
||||||
|
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
|
||||||
|
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
|
||||||
|
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
|
||||||
|
<FeatureBranchVersionPrefix Condition="'$(FeatureBranchVersionPrefix)' == ''">a-</FeatureBranchVersionPrefix>
|
||||||
|
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(FeatureBranchVersionSuffix)' != ''">$(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-'))</VersionSuffix>
|
||||||
|
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue