Skip to content

Commit e7937bc

Browse files
committed
Revert "Move some targets into a Directory.Build.targets file (#39712)"
This reverts commit 209ff13.
1 parent 0f5e802 commit e7937bc

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

src/Servers/IIS/IIS/test/testassets/Directory.Build.targets

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
23
<Import Project="..\..\..\..\build\testsite.props" />
34

45
<PropertyGroup>
56
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
67
<AssemblyName>InProcessWebSite</AssemblyName>
8+
<TestAssetOutputName>InProcessNewShimWebSite</TestAssetOutputName>
79
<DefineConstants>FORWARDCOMPAT</DefineConstants>
810
<CompileUsingReferenceAssemblies>false</CompileUsingReferenceAssemblies>
911
<ImplicitUsings>disable</ImplicitUsings>
@@ -59,4 +61,5 @@
5961
</PackageReference>
6062
<Reference Include="xunit.assert" />
6163
</ItemGroup>
64+
6265
</Project>

src/Servers/IIS/build/testsite.props

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<Project>
2+
23
<PropertyGroup>
34
<RuntimeIdentifiers>$(RuntimeIdentifiers);win-x64;win-x86</RuntimeIdentifiers>
45
<Platforms>x64;x86</Platforms>
56
<IISExpressAppHostConfig>$(MSBuildThisFileDirectory)applicationhost.config</IISExpressAppHostConfig>
67
<IISAppHostConfig>$(MSBuildThisFileDirectory)applicationhost.iis.config</IISAppHostConfig>
78
<PreserveCompilationContext>false</PreserveCompilationContext>
9+
<!-- Work around until we get a new WebSdk -->
10+
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
11+
<HasTestAssetProfile Condition="'$(TestAssetProfile)' != ''">true</HasTestAssetProfile>
12+
<TestAssetOutputName Condition="'$(TestAssetOutputName)' == ''">$(MSBuildProjectName)</TestAssetOutputName>
813
</PropertyGroup>
914

1015
<Import Project="assets.props" />
@@ -26,9 +31,9 @@
2631
<IISArguments>-h "$(IISAppHostConfig)"</IISArguments>
2732

2833
<AncmInProcessRHPath>aspnetcorev2_inprocess.dll</AncmInProcessRHPath>
29-
30-
<DotNetPath>$(DotNetRoot)dotnet.exe</DotNetPath>
31-
<DotNetPath Condition="'$(NativePlatform)' != 'x64'">$(DotNetRoot)$(NativePlatform)\dotnet.exe</DotNetPath>
34+
<!-- TODO: use LocalDotNetRoot instead to find dotnet.exe (see reporoot/Directory.Build.props). Requires a fix to https://github.com/dotnet/aspnetcore/issues/7196 -->
35+
<DotNetPath>$(RepoRoot).dotnet\dotnet.exe</DotNetPath>
36+
<DotNetPath Condition="'$(NativePlatform)' != 'x64'">$(RepoRoot).dotnet\$(NativePlatform)\dotnet.exe</DotNetPath>
3237
</PropertyGroup>
3338

3439
<Target Name="CopyLaunchSettings" AfterTargets="CoreBuild">
@@ -76,4 +81,44 @@
7681
DependsOnTargets="GeneratePublishDependencyFile;CopyFilesToPublishDirectory;PrepareInjectionApp">
7782
<Exec Command="$(InjectDepsApp) &quot;$(PublishDepsFilePath)&quot; $(RuntimeIdentifier) " />
7883
</Target>
84+
85+
<Target Name="PreventProjectReferencesFromBuilding" BeforeTargets="BeforeResolveReferences" Condition="'@(TestAssetPublishProfile->Count())' != '0'">
86+
<PropertyGroup>
87+
<BuildProjectReferences Condition="'$(HasTestAssetProfile)' == 'true'">false</BuildProjectReferences>
88+
</PropertyGroup>
89+
</Target>
90+
91+
<Target Name="PrepareForTestAssetPublish" BeforeTargets="PrepareForPublish" Condition="'@(TestAssetPublishProfile->Count())' != '0'">
92+
<PropertyGroup Condition="'$(HasTestAssetProfile)' == 'true'">
93+
<PublishDir>$(PublishDir)\$(TestAssetOutputName)-$(TestAssetProfile)\</PublishDir>
94+
</PropertyGroup>
95+
96+
<PropertyGroup Condition="'$(HasTestAssetProfile)' != 'true'">
97+
<IsPublishable>false</IsPublishable>
98+
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
99+
</PropertyGroup>
100+
</Target>
101+
102+
<Target Name="PublishTestsAsset" DependsOnTargets="Publish" Returns="@(PublishedTestAsset)">
103+
<ConvertToAbsolutePath Paths="$(PublishDir)">
104+
<Output TaskParameter="AbsolutePaths" PropertyName="PublishAbsoluteDir" />
105+
</ConvertToAbsolutePath>
106+
107+
<ItemGroup>
108+
<PublishedTestAsset Include="$(TestAssetOutputName)-$(TestAssetProfile)" Path="$(PublishAbsoluteDir)" />
109+
</ItemGroup>
110+
</Target>
111+
112+
<Target Name="PublishTestsAssets" Condition="'$(TestAssetProfile)' == '' AND '@(TestAssetPublishProfile->Count())' != '0'" Returns="@(PublishedTestAsset)">
113+
114+
<!--
115+
_InsidePublishTestsAssets is to avoid invoking this target recursively
116+
Platform;PlatformTarget removal is fix builds inside VS -->
117+
<MSBuild Projects="$(MSBuildProjectFullPath)"
118+
Targets="PublishTestsAsset"
119+
RemoveProperties="Platform;PlatformTarget"
120+
Properties="PublishDir=$(PublishDir);TestAssetProfile=%(TestAssetPublishProfile.Identity);ReferenceTestTasks=false;%(TestAssetPublishProfile.Properties)">
121+
<Output TaskParameter="TargetOutputs" ItemName="PublishedTestAsset" />
122+
</MSBuild>
123+
</Target>
79124
</Project>

src/Servers/testassets/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
33

44
<PropertyGroup>
5-
<!-- Local testing does not work when bin/ directory is not in project directory due to deployer expectations. -->
5+
<!-- Tests do not work on Helix or when bin/ directory is not in project directory due to undeclared dependency on test content. -->
66
<BaseOutputPath />
77
<OutputPath />
88
</PropertyGroup>

0 commit comments

Comments
 (0)