From 1df423813abbd6fb678be2b1038f2fb9fc1aad4b Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Wed, 6 Oct 2021 16:14:44 -0700 Subject: [PATCH 1/6] Add some msbuild magic to deploy dependent ASP.NET Core app --- IISCrossover.Deploy.targets | 75 +++++++++++++++++++++++++++++++++++++ LegacyApi/LegacyApi.csproj | 5 +++ LegacyApi/Web.config | 1 - 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 IISCrossover.Deploy.targets diff --git a/IISCrossover.Deploy.targets b/IISCrossover.Deploy.targets new file mode 100644 index 0000000..f102946 --- /dev/null +++ b/IISCrossover.Deploy.targets @@ -0,0 +1,75 @@ + + + + false + _DeployedProjectOutput + Never + true + $([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))) + false + + + + + + <_DeployedProjectOutput Update="@(_DeployedProjectOutput)"> + projects\%(_DeployedProjectOutput.DeployName)\$([System.IO.Path]::GetFileName('%(Identity)')) + + + + + + + + + + <_AllDeployedProjectFilesContent Include="@(_DeployedProjectsContents)"> + projects\%(_DeployedProjectsContents.DeployName)\%(_DeployedProjectsContents.TargetPath) + + <_AllDeployedProjectFilesContent Include="@(_DeployedProjectOutput)" /> + + PreserveNewest + + + + + + + <__DeployedProjectTransformPath>$(IntermediateOutputPath)deployed_transform.xml + <__WebConfigPath>web.config + + + + <_DeployProjectPaths Include="$(OutDir)%(_DeployedProjectOutput.TargetPath)"> + %(_DeployedProjectOutput.HostingModel) + + <_DeployProjectPaths Update="@(_DeployedProjectOutput)" Condition=" '%(HostingModel)' == '' "> + outofprocess + + + + + + + <__DeployedProjectTransformLines Include='<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">' /> + <__DeployedProjectTransformLines Include="<system.webServer>" /> + <__DeployedProjectTransformLines Include='<aspNetCore arguments="%(_DeployProjectPaths.Identity)" xdt:Transform="InsertIfMissing" xdt:locator="Match(arguments)" />' /> + <__DeployedProjectTransformLines Include='<aspNetCore processPath="dotnet" arguments="%(_DeployProjectPaths.Identity)" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="%(_DeployProjectPaths.HostingModel)" xdt:Transform="Replace" xdt:locator="Match(arguments)" />' /> + <__DeployedProjectTransformLines Include="</system.webServer>" /> + <__DeployedProjectTransformLines Include="</configuration>" /> + + + + + + + + \ No newline at end of file diff --git a/LegacyApi/LegacyApi.csproj b/LegacyApi/LegacyApi.csproj index 1b14e14..fa837c8 100644 --- a/LegacyApi/LegacyApi.csproj +++ b/LegacyApi/LegacyApi.csproj @@ -43,6 +43,9 @@ prompt 4 + + + @@ -177,6 +180,8 @@ + + + <__DeployedProjectTransformLines Include='<aspNetCore xdt:Transform="InsertIfMissing" />' /> + <__DeployedProjectTransformLines Include='<aspNetCore xdt:Transform="Remove" />' /> + <__DeployedProjectTransformLines Include='<aspNetCore processPath="dotnet" arguments="%(_DeployProjectPaths.Identity)" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="%(_DeployProjectPaths.HostingModel)" xdt:Transform="Insert" />' /> <__DeployedProjectTransformLines Include="</system.webServer>" /> <__DeployedProjectTransformLines Include="</configuration>" /> From 9a887d501cd7fec095878f470fd31f169d675333 Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Mon, 11 Oct 2021 10:14:06 -0700 Subject: [PATCH 4/6] Include web.config --- IISCrossover.Deploy.targets | 19 +++++++++++-- LegacyApi/Web.config | 57 ++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/IISCrossover.Deploy.targets b/IISCrossover.Deploy.targets index cf9d0ac..f567e99 100644 --- a/IISCrossover.Deploy.targets +++ b/IISCrossover.Deploy.targets @@ -1,4 +1,8 @@ + + true + + false @@ -23,7 +27,7 @@ - + <_DeployedProjectOutput Update="@(_DeployedProjectOutput)"> projects\%(_DeployedProjectOutput.DeployName)\$([System.IO.Path]::GetFileName('%(Identity)')) @@ -54,15 +58,22 @@ - + <__DeployedProjectTransformPath>$(IntermediateOutputPath)deployed_transform.xml <__WebConfigPath>web.config + <__IsPublishing>false + <__IsPublishing Condition=" '$(PublishProfile)' != '' ">true <_DeployProjectPaths Include="$(OutDir)%(_DeployedProjectOutput.TargetPath)"> %(_DeployedProjectOutput.HostingModel) + $([System.IO.Path]::GetDirectoryName(%(_DeployedProjectOutput.OriginalItemSpec))) + $([System.IO.Path]::GetDirectoryName(%(_DeployedProjectOutput.TargetPath))) + + <_DeployProjectPaths Condition="$(__IsPublishing)" Update="@(_DeployProjectPaths)"> + %(TargetDirectory) <_DeployProjectPaths Update="@(_DeployedProjectOutput)" Condition=" '%(HostingModel)' == '' "> outofprocess @@ -70,14 +81,16 @@ + + <__DeployedProjectTransformLines Include='<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">' /> <__DeployedProjectTransformLines Include="<system.webServer>" /> <__DeployedProjectTransformLines Include='<aspNetCore xdt:Transform="InsertIfMissing" />' /> <__DeployedProjectTransformLines Include='<aspNetCore xdt:Transform="Remove" />' /> - <__DeployedProjectTransformLines Include='<aspNetCore processPath="dotnet" arguments="%(_DeployProjectPaths.Identity)" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="%(_DeployProjectPaths.HostingModel)" xdt:Transform="Insert" />' /> + <__DeployedProjectTransformLines Include='<aspNetCore processPath="dotnet" arguments="%(_DeployProjectPaths.Identity) --contentRoot %(_DeployProjectPaths.ContentRoot)" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="%(_DeployProjectPaths.HostingModel)" xdt:Transform="Insert" />' /> <__DeployedProjectTransformLines Include="</system.webServer>" /> <__DeployedProjectTransformLines Include="</configuration>" /> diff --git a/LegacyApi/Web.config b/LegacyApi/Web.config index b462fc2..60060db 100644 --- a/LegacyApi/Web.config +++ b/LegacyApi/Web.config @@ -5,54 +5,59 @@ --> - - - - + + + + - - + + - - - - - - + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + From 0df1e7f92b78ebfc19e8964734f97a2826b7654e Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Mon, 11 Oct 2021 11:08:46 -0700 Subject: [PATCH 5/6] Update IISCrossover.Deploy.targets Co-authored-by: David Fowler --- IISCrossover.Deploy.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IISCrossover.Deploy.targets b/IISCrossover.Deploy.targets index f567e99..d575380 100644 --- a/IISCrossover.Deploy.targets +++ b/IISCrossover.Deploy.targets @@ -76,7 +76,7 @@ %(TargetDirectory) <_DeployProjectPaths Update="@(_DeployedProjectOutput)" Condition=" '%(HostingModel)' == '' "> - outofprocess + inprocess From a879bb1bf9738572606d8fdeda219b2feefd976e Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Mon, 11 Oct 2021 11:10:58 -0700 Subject: [PATCH 6/6] Change to inprocess --- LegacyApi/LegacyApi.csproj | 2 +- LegacyApi/Web.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LegacyApi/LegacyApi.csproj b/LegacyApi/LegacyApi.csproj index fa837c8..a9f7497 100644 --- a/LegacyApi/LegacyApi.csproj +++ b/LegacyApi/LegacyApi.csproj @@ -44,7 +44,7 @@ 4 - + diff --git a/LegacyApi/Web.config b/LegacyApi/Web.config index 60060db..eb8f2d4 100644 --- a/LegacyApi/Web.config +++ b/LegacyApi/Web.config @@ -27,7 +27,7 @@ preCondition="integratedMode,runtimeVersionv4.0"/> + stdoutLogFile=".\logs\stdout" hostingModel="inprocess"/>