diff --git a/build/assets.props b/build/assets.props
new file mode 100644
index 0000000000..13b30556bd
--- /dev/null
+++ b/build/assets.props
@@ -0,0 +1,269 @@
+
+
+
+ true
+ x64
+ $(Platform)
+ Win32
+ $(NativePlatform)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\$(NativeVCPlatform)\aspnetcore.dll
+ $(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\$(NativeVCPlatform)\aspnetcorev2.dll
+ $(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\InProcessRequestHandler\bin\$(Configuration)\$(NativeVCPlatform)\aspnetcorev2_inprocess.dll
+ $(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\OutOfProcessRequestHandler\bin\$(Configuration)\$(NativeVCPlatform)\aspnetcorev2_outofprocess.dll
+
+
diff --git a/build/launchSettings.json b/build/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/build/launchSettings.json
+++ b/build/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/build/repo.targets b/build/repo.targets
index 5fe12660fe..5a2620ec75 100644
--- a/build/repo.targets
+++ b/build/repo.targets
@@ -1,7 +1,7 @@
- InitializeComponents;$(PrepareDependsOn)
+ $(PrepareDependsOn)
$(GetArtifactInfoDependsOn);GetNativeArtifactsInfo
BuildNativeAssets;$(CompileDependsOn)
$(PackageDependsOn);PackageNativeProjects
@@ -14,36 +14,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -62,7 +34,7 @@
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
-
+
NuGetPackage
@@ -116,8 +88,8 @@
BasePath="$(RepositoryRoot)" />
-
-
+
+
diff --git a/build/testsite.props b/build/testsite.props
index 3f84d67f31..d412ac84b3 100644
--- a/build/testsite.props
+++ b/build/testsite.props
@@ -5,11 +5,11 @@
x64;x86
$(MSBuildThisFileDirectory)applicationhost.config
$(MSBuildThisFileDirectory)applicationhost.iis.config
- x64
- $(Platform)
false
-
+
+
+
$(MSBuildProgramFiles32)\IIS Express\iisexpress.exe
$(SystemRoot)\SysWOW64\inetsrv\w3wp.exe
@@ -22,30 +22,21 @@
x64
+
-
$(NativePlatform)\
-
+
-
-
-
-
-
-
-
-
-
-
-
+
/config:"$(IISExpressAppHostConfig)" /systray:false
-h "$(IISAppHostConfig)"
- $(NativePlatform)\aspnetcore.dll
- $(NativePlatform)\aspnetcorev2.dll
+ $(AspNetCoreModuleV1ShimDll)
+ $(AspNetCoreModuleV2ShimDll)
$(NativePlatform)\aspnetcorev2_inprocess.dll
$(userprofile)\.dotnet\$(NativePlatform)\dotnet.exe
@@ -62,8 +53,7 @@
-
-
+
$(MSBuildThisFileDirectory)..\test\TestTasks\bin\$(Configuration)\$(TargetFramework)\TestTasks
$(InjectDepsAssembly)
@@ -82,11 +72,11 @@
-
+
-
+
diff --git a/samples/NativeIISSample/Properties/launchSettings.json b/samples/NativeIISSample/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/samples/NativeIISSample/Properties/launchSettings.json
+++ b/samples/NativeIISSample/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj b/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj
index c2fa16aa42..6025b459fb 100644
--- a/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj
+++ b/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj
@@ -12,6 +12,8 @@
netcoreapp2.2
+
+
@@ -23,12 +25,40 @@
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs
index aa35ac92da..4a3caadd8e 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs
@@ -5,6 +5,7 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Xml.Linq;
@@ -71,7 +72,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
ConfigureSite(contentRoot, port);
- ConfigureAppHostConfig(contentRoot);
+ ConfigureAppHostConfig();
_serverManager.CommitChanges();
@@ -280,11 +281,11 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
return site;
}
- private Configuration ConfigureAppHostConfig(string dllRoot)
+ private Configuration ConfigureAppHostConfig()
{
var config = _serverManager.GetApplicationHostConfiguration();
- SetGlobalModuleSection(config, dllRoot);
+ SetGlobalModuleSection(config);
SetModulesSection(config);
@@ -305,9 +306,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
appPool.Stop();
}
- private void SetGlobalModuleSection(Configuration config, string dllRoot)
+ private void SetGlobalModuleSection(Configuration config)
{
- var ancmFile = GetAncmLocation(dllRoot);
+ var ancmFile = GetAncmLocation();
var globalModulesSection = config.GetSection("system.webServer/globalModules");
var globalConfigElement = globalModulesSection
@@ -355,8 +356,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
}
}
- private string GetAncmLocation(string dllRoot)
+ private string GetAncmLocation()
{
+ var dllRoot = AppContext.BaseDirectory;
var arch = _deploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x64 ? $@"x64\{_ancmDllName}" : $@"x86\{_ancmDllName}";
var ancmFile = Path.Combine(dllRoot, arch);
if (!File.Exists(Environment.ExpandEnvironmentVariables(ancmFile)))
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployer.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployer.cs
index ffbc8ba034..4e6c71c1c4 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployer.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployer.cs
@@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
DefaultWebConfigActions.Add(WebConfigHelpers.AddOrModifyHandlerSection(
key: "modules",
value: DeploymentParameters.AncmVersion.ToString()));
- RunWebConfigActions();
+ RunWebConfigActions(contentRoot);
}
var uri = TestUriHelper.BuildTestUri(ServerType.IIS, DeploymentParameters.ApplicationBaseUriHint);
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployerBase.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployerBase.cs
index 5042a192e3..8dcc3e135e 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployerBase.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeployerBase.cs
@@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
{
public IISDeploymentParameters IISDeploymentParameters { get; }
- protected List> DefaultWebConfigActions { get; } = new List>();
+ protected List> DefaultWebConfigActions { get; } = new List>();
public IISDeployerBase(IISDeploymentParameters deploymentParameters, ILoggerFactory loggerFactory)
: base(deploymentParameters, loggerFactory)
@@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
IISDeploymentParameters = deploymentParameters;
}
- public void RunWebConfigActions()
+ public void RunWebConfigActions(string contentRoot)
{
if (IISDeploymentParameters == null)
{
@@ -42,19 +42,19 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
foreach (var action in DefaultWebConfigActions)
{
- action.Invoke(xElement);
+ action.Invoke(xElement, contentRoot);
}
foreach (var action in IISDeploymentParameters.WebConfigActionList)
{
- action.Invoke(xElement);
+ action.Invoke(xElement, contentRoot);
}
webconfig.Save(path);
}
- public string RunServerConfigActions(string serverConfigString)
+ public string RunServerConfigActions(string serverConfigString, string contentRoot)
{
if (IISDeploymentParameters == null)
{
@@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
foreach (var action in IISDeploymentParameters.ServerConfigActionList)
{
- action.Invoke(xElement);
+ action.Invoke(xElement, contentRoot);
}
return xElement.ToString();
}
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameterExtensions.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameterExtensions.cs
index ff2365a82a..f1e90f1a24 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameterExtensions.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameterExtensions.cs
@@ -16,13 +16,18 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
}
public static void AddServerConfigAction(this IISDeploymentParameters parameters, Action action)
+ {
+ parameters.ServerConfigActionList.Add((config, _) => action(config));
+ }
+
+ public static void AddServerConfigAction(this IISDeploymentParameters parameters, Action action)
{
parameters.ServerConfigActionList.Add(action);
}
public static void AddHttpsToServerConfig(this IISDeploymentParameters parameters)
{
- parameters.ServerConfigActionList.Add(
+ parameters.AddServerConfigAction(
element =>
{
element.Descendants("binding")
@@ -37,7 +42,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
public static void AddWindowsAuthToServerConfig(this IISDeploymentParameters parameters)
{
- parameters.ServerConfigActionList.Add(
+ parameters.AddServerConfigAction(
element =>
{
element.Descendants("windowsAuthentication")
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameters.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameters.cs
index a22116d557..8d96236295 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameters.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISDeploymentParameters.cs
@@ -48,14 +48,14 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
}
}
- private IList> CreateDefaultWebConfigActionList()
+ private IList> CreateDefaultWebConfigActionList()
{
- return new List>() { AddWebConfigEnvironmentVariables(), AddHandlerSettings() };
+ return new List>() { AddWebConfigEnvironmentVariables(), AddHandlerSettings() };
}
- public IList> WebConfigActionList { get; }
+ public IList> WebConfigActionList { get; }
- public IList> ServerConfigActionList { get; } = new List>();
+ public IList> ServerConfigActionList { get; } = new List>();
public IDictionary WebConfigBasedEnvironmentVariables { get; set; } = new Dictionary();
@@ -63,9 +63,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
public bool GracefulShutdown { get; set; }
- private Action AddWebConfigEnvironmentVariables()
+ private Action AddWebConfigEnvironmentVariables()
{
- return xElement =>
+ return (xElement, _) =>
{
if (WebConfigBasedEnvironmentVariables.Count == 0)
{
@@ -86,9 +86,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
};
}
- private Action AddHandlerSettings()
+ private Action AddHandlerSettings()
{
- return xElement =>
+ return (xElement, _) =>
{
if (HandlerSettings.Count == 0)
{
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs
index 6d99edf0fd..ff02771ec0 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs
@@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
@@ -57,7 +58,6 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
{
DotnetPublish();
contentRoot = DeploymentParameters.PublishedApplicationRootPath;
- dllRoot = contentRoot;
}
else
{
@@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
var testUri = TestUriHelper.BuildTestUri(ServerType.IISExpress, DeploymentParameters.ApplicationBaseUriHint);
// Launch the host process.
- var (actualUri, hostExitToken) = await StartIISExpressAsync(testUri, contentRoot, dllRoot);
+ var (actualUri, hostExitToken) = await StartIISExpressAsync(testUri, contentRoot);
Logger.LogInformation("Application ready at URL: {appUrl}", actualUri);
@@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
return dllRoot;
}
- private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAsync(Uri uri, string contentRoot, string dllRoot)
+ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAsync(Uri uri, string contentRoot)
{
using (Logger.BeginScope("StartIISExpress"))
{
@@ -156,7 +156,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
}
Logger.LogInformation("Attempting to start IIS Express on port: {port}", port);
- PrepareConfig(contentRoot, dllRoot, port);
+ PrepareConfig(contentRoot, port);
var parameters = string.IsNullOrEmpty(DeploymentParameters.ServerConfigLocation) ?
string.Format("/port:{0} /path:\"{1}\" /trace:error /systray:false", uri.Port, contentRoot) :
@@ -257,7 +257,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
}
}
- private void PrepareConfig(string contentRoot, string dllRoot, int port)
+ private void PrepareConfig(string contentRoot, int port)
{
// Config is required. If not present then fall back to one we carry with us.
if (string.IsNullOrEmpty(DeploymentParameters.ServerConfigTemplateContent))
@@ -273,8 +273,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
// Pass on the applicationhost.config to iis express. With this don't need to pass in the /path /port switches as they are in the applicationHost.config
// We take a copy of the original specified applicationHost.Config to prevent modifying the one in the repo.
- serverConfig = ModifyANCMPathInConfig(replaceFlag: "[ANCMPath]", dllName: "aspnetcore.dll", serverConfig, dllRoot);
- serverConfig = ModifyANCMPathInConfig(replaceFlag: "[ANCMV2Path]", dllName: "aspnetcorev2.dll", serverConfig, dllRoot);
+ serverConfig = ModifyANCMPathInConfig(replaceFlag: "[ANCMPath]", dllName: "aspnetcore.dll", serverConfig);
+ serverConfig = ModifyANCMPathInConfig(replaceFlag: "[ANCMV2Path]", dllName: "aspnetcorev2.dll", serverConfig);
serverConfig = ReplacePlaceholder(serverConfig, "[PORT]", port.ToString(CultureInfo.InvariantCulture));
serverConfig = ReplacePlaceholder(serverConfig, "[ApplicationPhysicalPath]", contentRoot);
@@ -291,7 +291,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
value: DeploymentParameters.AncmVersion.ToString()));
ModifyDotNetExePathInWebConfig();
serverConfig = RemoveRedundantElements(serverConfig);
- RunWebConfigActions();
+ RunWebConfigActions(contentRoot);
}
else
{
@@ -299,7 +299,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
serverConfig = ReplacePlaceholder(serverConfig, "[HostingModel]", DeploymentParameters.HostingModel.ToString());
serverConfig = ReplacePlaceholder(serverConfig, "[AspNetCoreModule]", DeploymentParameters.AncmVersion.ToString());
}
- serverConfig = RunServerConfigActions(serverConfig);
+ serverConfig = RunServerConfigActions(serverConfig, contentRoot);
DeploymentParameters.ServerConfigLocation = Path.GetTempFileName();
Logger.LogDebug("Saving Config to {configPath}", DeploymentParameters.ServerConfigLocation);
@@ -317,8 +317,9 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
return content;
}
- private string ModifyANCMPathInConfig(string replaceFlag, string dllName, string serverConfig, string dllRoot)
+ private string ModifyANCMPathInConfig(string replaceFlag, string dllName, string serverConfig)
{
+ var dllRoot = AppContext.BaseDirectory;
if (serverConfig.Contains(replaceFlag))
{
var arch = DeploymentParameters.RuntimeArchitecture == RuntimeArchitecture.x64 ? $@"x64\{dllName}" : $@"x86\{dllName}";
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj
index 363de4e34f..766b470a50 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj
@@ -9,14 +9,44 @@
aspnetcore;iis
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/WebConfigHelpers.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/WebConfigHelpers.cs
index 8d2af5eb1d..31f103fee2 100644
--- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/WebConfigHelpers.cs
+++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/WebConfigHelpers.cs
@@ -9,20 +9,20 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
{
public static class WebConfigHelpers
{
- public static Action AddOrModifyAspNetCoreSection(string key, string value)
+ public static Action AddOrModifyAspNetCoreSection(string key, string value)
=> AddAction(key, value, section: "aspNetCore");
- public static Action AddAction(string key, string value, string section)
+ public static Action AddAction(string key, string value, string section)
{
- return (element) =>
+ return (element, _) =>
{
element.Descendants(section).SingleOrDefault().SetAttributeValue(key, value);
};
}
- public static Action AddOrModifyHandlerSection(string key, string value)
+ public static Action AddOrModifyHandlerSection(string key, string value)
{
- return element =>
+ return (element, _) =>
{
element.Descendants("handlers")
.FirstOrDefault()
diff --git a/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj b/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj
index 73c2d11f70..dfe65f9b56 100644
--- a/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj
+++ b/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj
@@ -10,8 +10,6 @@
-
-
@@ -23,13 +21,6 @@
-
-
-
-
-
-
-
@@ -45,7 +36,7 @@
-
+
PreserveNewest
diff --git a/test/IIS.Tests/IIS.Tests.csproj b/test/IIS.Tests/IIS.Tests.csproj
index 1037d93c25..614a286626 100644
--- a/test/IIS.Tests/IIS.Tests.csproj
+++ b/test/IIS.Tests/IIS.Tests.csproj
@@ -1,22 +1,16 @@
-
+
netcoreapp2.2
+
-
-
-
-
-
-
-
@@ -31,6 +25,7 @@
+
diff --git a/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj b/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj
index 3ae8fcffe8..455f453431 100644
--- a/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj
+++ b/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj
@@ -9,8 +9,6 @@
-
-
@@ -22,13 +20,6 @@
-
-
-
-
-
-
-
@@ -44,7 +35,7 @@
-
+
PreserveNewest
diff --git a/test/IISExpress.FunctionalTests/OutOfProcess/GlobalVersionTests.cs b/test/IISExpress.FunctionalTests/OutOfProcess/GlobalVersionTests.cs
index 3ab5918753..7ad5d9c9f6 100644
--- a/test/IISExpress.FunctionalTests/OutOfProcess/GlobalVersionTests.cs
+++ b/test/IISExpress.FunctionalTests/OutOfProcess/GlobalVersionTests.cs
@@ -23,7 +23,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
_fixture = fixture;
}
- private const string _aspNetCoreDll = "aspnetcorev2_outofprocess.dll";
private const string _handlerVersion20 = "2.0.0";
private const string _helloWorldRequest = "HelloWorld";
private const string _helloWorldResponse = "Hello World";
@@ -72,6 +71,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public async Task GlobalVersion_NewVersionNumber(string version)
{
var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
+ CopyShimToOutput(deploymentParameters);
deploymentParameters.HandlerSettings["handlerVersion"] = version;
var deploymentResult = await DeployAsync(deploymentParameters);
@@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public async Task GlobalVersion_MultipleRequestHandlers_PicksHighestOne(string version)
{
var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
-
+ CopyShimToOutput(deploymentParameters);
var deploymentResult = await DeployAsync(deploymentParameters);
var originalANCMPath = GetANCMRequestHandlerPath(deploymentResult, _handlerVersion20);
@@ -115,6 +115,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
public async Task GlobalVersion_MultipleRequestHandlers_UpgradeWorks(string version)
{
var deploymentParameters = GetGlobalVersionBaseDeploymentParameters();
+ CopyShimToOutput(deploymentParameters);
var deploymentResult = await DeployAsync(deploymentParameters);
var originalANCMPath = GetANCMRequestHandlerPath(deploymentResult, _handlerVersion20);
@@ -170,5 +171,43 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
Assert.Contains(TestSink.Writes, context => context.Message.Contains(version + @"\aspnetcorev2_outofprocess.dll"));
}
+
+ private static void CopyShimToOutput(IISDeploymentParameters parameters)
+ {
+ parameters.AddServerConfigAction(
+ (config, contentRoot) => {
+ var moduleNodes = config.DescendantNodesAndSelf()
+ .OfType()
+ .Where(element =>
+ element.Name == "add" &&
+ element.Attribute("name")?.Value.StartsWith("AspNetCoreModule") == true &&
+ element.Attribute("image") != null);
+
+ var sourceDirectory = new DirectoryInfo(Path.GetDirectoryName(moduleNodes.First().Attribute("image").Value));
+ var destinationDirectory = new DirectoryInfo(Path.Combine(contentRoot, sourceDirectory.Name));
+ destinationDirectory.Create();
+ foreach (var element in moduleNodes)
+ {
+ var imageAttribute = element.Attribute("image");
+ imageAttribute.Value = imageAttribute.Value.Replace(sourceDirectory.FullName, destinationDirectory.FullName);
+ }
+ CopyFiles(sourceDirectory, destinationDirectory);
+ });
+ }
+
+ private static void CopyFiles(DirectoryInfo source, DirectoryInfo target)
+ {
+ foreach (DirectoryInfo directoryInfo in source.GetDirectories())
+ {
+ CopyFiles(directoryInfo, target.CreateSubdirectory(directoryInfo.Name));
+ }
+
+ foreach (FileInfo fileInfo in source.GetFiles())
+ {
+ var destFileName = Path.Combine(target.FullName, fileInfo.Name);
+ fileInfo.CopyTo(destFileName);
+ }
+ }
+
}
}
diff --git a/test/WebSites/InProcessWebSite/InProcessWebSite.csproj b/test/WebSites/InProcessWebSite/InProcessWebSite.csproj
index b6d09409c1..393574d9c8 100644
--- a/test/WebSites/InProcessWebSite/InProcessWebSite.csproj
+++ b/test/WebSites/InProcessWebSite/InProcessWebSite.csproj
@@ -1,10 +1,12 @@
-
-
+
netcoreapp2.2
+ true
+
+
diff --git a/test/WebSites/InProcessWebSite/Properties/launchSettings.json b/test/WebSites/InProcessWebSite/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/test/WebSites/InProcessWebSite/Properties/launchSettings.json
+++ b/test/WebSites/InProcessWebSite/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/test/WebSites/OutOfProcessWebSite/Properties/launchSettings.json b/test/WebSites/OutOfProcessWebSite/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/test/WebSites/OutOfProcessWebSite/Properties/launchSettings.json
+++ b/test/WebSites/OutOfProcessWebSite/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/test/WebSites/OverriddenServerWebSite/OverriddenServerWebSite.csproj b/test/WebSites/OverriddenServerWebSite/OverriddenServerWebSite.csproj
index 2b9db3ce4a..f7108dadc4 100644
--- a/test/WebSites/OverriddenServerWebSite/OverriddenServerWebSite.csproj
+++ b/test/WebSites/OverriddenServerWebSite/OverriddenServerWebSite.csproj
@@ -1,11 +1,12 @@
-
-
netcoreapp2.2
+ true
+
+
diff --git a/test/WebSites/OverriddenServerWebSite/Properties/launchSettings.json b/test/WebSites/OverriddenServerWebSite/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/test/WebSites/OverriddenServerWebSite/Properties/launchSettings.json
+++ b/test/WebSites/OverriddenServerWebSite/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/test/WebSites/StartupExceptionWebSite/Properties/launchSettings.json b/test/WebSites/StartupExceptionWebSite/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/test/WebSites/StartupExceptionWebSite/Properties/launchSettings.json
+++ b/test/WebSites/StartupExceptionWebSite/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/test/WebSites/StartupExceptionWebSite/StartupExceptionWebSite.csproj b/test/WebSites/StartupExceptionWebSite/StartupExceptionWebSite.csproj
index d279ce41b4..922196815f 100644
--- a/test/WebSites/StartupExceptionWebSite/StartupExceptionWebSite.csproj
+++ b/test/WebSites/StartupExceptionWebSite/StartupExceptionWebSite.csproj
@@ -1,11 +1,12 @@
-
-
netcoreapp2.2
+ true
+
+
diff --git a/test/WebSites/StressTestWebSite/Properties/launchSettings.json b/test/WebSites/StressTestWebSite/Properties/launchSettings.json
index 943d2ad712..8cd1df05e6 100644
--- a/test/WebSites/StressTestWebSite/Properties/launchSettings.json
+++ b/test/WebSites/StressTestWebSite/Properties/launchSettings.json
@@ -15,8 +15,8 @@
"nativeDebugging": true,
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
@@ -29,8 +29,8 @@
"commandLineArgs": "$(IISArguments)",
"environmentVariables": {
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
- "ANCM_PATH": "$(TargetDir)$(AncmPath)",
- "ANCMV2_PATH": "$(TargetDir)$(AncmV2Path)",
+ "ANCM_PATH": "$(AncmPath)",
+ "ANCMV2_PATH": "$(AncmV2Path)",
"LAUNCHER_ARGS": "$(TargetPath)",
"ASPNETCORE_ENVIRONMENT": "Development",
"LAUNCHER_PATH": "$(DotNetPath)",
diff --git a/test/WebSites/StressTestWebSite/StressTestWebSite.csproj b/test/WebSites/StressTestWebSite/StressTestWebSite.csproj
index 8c1b6b08e7..9a1ed0692f 100644
--- a/test/WebSites/StressTestWebSite/StressTestWebSite.csproj
+++ b/test/WebSites/StressTestWebSite/StressTestWebSite.csproj
@@ -4,6 +4,7 @@
$(StandardTestTfms)
+ true
diff --git a/tools/GenerateNativeAssets.ps1 b/tools/GenerateNativeAssets.ps1
new file mode 100644
index 0000000000..f4b98959ed
--- /dev/null
+++ b/tools/GenerateNativeAssets.ps1
@@ -0,0 +1,150 @@
+$targetFile = Join-Path (Split-Path -parent $PSCommandPath) "..\build\assets.props";
+
+$platforms = @(
+ @{
+ Platform = "x64";
+ VCPlatform = "x64";
+ },
+ @{
+ Platform = "x86";
+ VCPlatform = "Win32";
+ }
+);
+$srcDir = "`$(MSBuildThisFileDirectory)..\src";
+$projects = @(
+ @{
+ ProjectDirectory = "$srcDir\AspNetCoreModuleV1\AspNetCore";
+ ProjectName = "AspNetCore.vcxproj";
+ NativeAsset = "aspnetcore";
+ BaseOutputPath = "AspNetCoreModuleV1"
+ PropetyName = "AspNetCoreModuleV1Shim"
+ },
+ @{
+ ProjectDirectory = "$srcDir\AspNetCoreModuleV2\AspNetCore";
+ ProjectName = "`AspNetCore.vcxproj";
+ NativeAsset = "aspnetcorev2";
+ BaseOutputPath = "AspNetCoreModuleV2"
+ PropetyName = "AspNetCoreModuleV2Shim"
+ },
+ @{
+ ProjectDirectory = "$srcDir\AspNetCoreModuleV2\InProcessRequestHandler";
+ ProjectName = "InProcessRequestHandler.vcxproj";
+ NativeAsset = "aspnetcorev2_inprocess";
+ BaseOutputPath = "AspNetCoreModuleV2";
+ PropetyName = "AspNetCoreModuleV2InProcessHandler"
+ },
+ @{
+ ProjectDirectory = "$srcDir\AspNetCoreModuleV2\OutOfProcessRequestHandler";
+ ProjectName = "OutOfProcessRequestHandler.vcxproj";
+ NativeAsset = "aspnetcorev2_outofprocess";
+ BaseOutputPath = "AspNetCoreModuleV2";
+ PackageSubPath = "`$(AspNetCoreModuleOutOfProcessVersion)\";
+ PropetyName = "AspNetCoreModuleV2OutOfProcessHandler"
+ }
+);
+$currentPlatform = @{
+ Platform = "`$(NativePlatform)";
+ VCPlatform = "`$(NativeVCPlatform)";
+};
+$components = @();
+$shimComponents = @();
+$inProcessComponents = @();
+$runShimComponents = @();
+$runInProcessComponents = @();
+$properties = @();
+
+function CopyProperties($from, $to)
+{
+ foreach ($key in $from.Keys)
+ {
+ $to.Add($key, $from.$key);
+ }
+}
+
+function Write-Group($group, $name)
+{
+ return $(
+ foreach ($item in $group){
+ " <$name$(foreach ($pair in $item.GetEnumerator()) {
+ "`n $($pair.Key)=`"`"$($pair.Value)`"`""})
+ />`n"});
+}
+function Write-Properties($group)
+{
+ return $(
+ foreach ($item in $group){
+ "`n <$($item.Name)>$($item.Value)$($item.Name)>"});
+}
+
+function New-Component($project, $platform)
+{
+ $component = [ordered]@{};
+ CopyProperties -from $platform -to $component;
+ CopyProperties -from $project -to $component;
+ CopyProperties -from @{
+ Include = "$($project.ProjectDirectory)\$($project.ProjectName)";
+ DllLocation = "$($project.ProjectDirectory)\bin\`$(Configuration)\$($platform.VCPlatform)\$($project.NativeAsset).dll";
+ PdbLocation = "$($project.ProjectDirectory)\bin\`$(Configuration)\$($platform.VCPlatform)\$($project.NativeAsset).pdb";
+ } -to $component;
+
+ return $component;
+}
+
+foreach ($project in $projects)
+{
+ foreach ($platform in $platforms)
+ {
+ $component = New-Component $project $platform;
+ $components += $component;
+
+ if ($project.ProjectName.Contains("InProcess"))
+ {
+ $inProcessComponents += $component;
+ }
+ else
+ {
+ $shimComponents += $component;
+ }
+ }
+
+ $properties += @{
+ Name = "$($project.PropetyName)Dll";
+ Value = "$($project.ProjectDirectory)\bin\`$(Configuration)\`$(NativeVCPlatform)\$($project.NativeAsset).dll";
+ };
+
+ $runComponent = New-Component $project $currentPlatform;
+
+ if ($project.ProjectName.Contains("InProcess"))
+ {
+ $runInProcessComponents += $runComponent;
+ }
+ else
+ {
+ $runShimComponents += $runComponent;
+ }
+}
+
+$content = @"
+
+
+
+ true
+ x64
+ `$(Platform)
+ Win32
+ `$(NativePlatform)
+
+
+$(Write-Group $components "Components" )
+$(Write-Group $shimComponents "ShimComponents")
+$(Write-Group $inProcessComponents "InProcessComponents")
+$(Write-Group $runShimComponents "RunShimComponents")
+$(Write-Group $runInProcessComponents "RunInProcessComponents")
+
+
+$(Write-Properties $properties)
+
+
+"@;
+
+[IO.File]::WriteAllLines($targetFile, $content)