aspnetcore/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj

147 lines
7.4 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<!-- Shared testing infrastructure for running E2E tests using selenium -->
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<TestGroupName>ProjectTemplates.E2ETests</TestGroupName>
<DefineConstants>$(DefineConstants);XPLAT</DefineConstants>
<RunTemplateTests Condition="'$(RunTemplateTests)' == ''" >true</RunTemplateTests>
<SkipTests Condition="'$(RunTemplateTests)' != 'true'">true</SkipTests>
<!--Do not run this test project on Helix.-->
<BuildHelixPayload>false</BuildHelixPayload>
<SkipHelixArm>true</SkipHelixArm>
<BaseOutputPath />
<OutputPath />
<!-- Properties that affect test runs -->
<!-- TestTemplateCreationFolder is the folder where the templates will be created. Will point out to $(OutputDir)$(TestTemplateCreationFolder) -->
<TestTemplateCreationFolder>TestTemplates\</TestTemplateCreationFolder>
<TestPackageRestorePath>$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))obj\template-restore\</TestPackageRestorePath>
<TestTemplateTestsProps>TemplateTests.props</TestTemplateTestsProps>
<TestDependsOnAspNetRuntime>true</TestDependsOnAspNetRuntime>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="template-baselines.json" />
<Compile Include="$(SharedSourceRoot)Process\*.cs" LinkBase="shared\Process" />
<Compile Include="..\Shared\**" LinkBase="Helpers" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
</ProjectReference>
<ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
<ProjectReference Include="../testassets/DotNetToolsInstaller/DotNetToolsInstaller.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj" ReferenceOutputAssembly="false" />
<Reference Include="Microsoft.NET.Sdk.Razor" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>DotNetEfFullPath</_Parameter1>
<_Parameter2>$([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)'))dotnet-ef/$(DotnetEfPackageVersion)/tools/netcoreapp3.1/any/dotnet-ef.dll</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>TestPackageRestorePath</_Parameter1>
<_Parameter2>$(TestPackageRestorePath)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Test.DefaultTargetFramework</_Parameter1>
<_Parameter2>$(DefaultNetCoreTargetFramework)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
<_Parameter2>true</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
<PropertyGroup>
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>
<CustomTemplateHivePath>$(TestTemplateCreationFolder)\Hives\$([System.Guid]::NewGuid())\.templateengine</CustomTemplateHivePath>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>ArtifactsShippingPackagesDir</_Parameter1>
<_Parameter2>$(ArtifactsShippingPackagesDir)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>ArtifactsLogDir</_Parameter1>
<_Parameter2>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log'))</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>ArtifactsNonShippingPackagesDir</_Parameter1>
<_Parameter2>$(ArtifactsNonShippingPackagesDir)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>TestTemplateCreationFolder</_Parameter1>
<_Parameter2>$(TestTemplateCreationFolder)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>CustomTemplateHivePath</_Parameter1>
<_Parameter2>$(CustomTemplateHivePath)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<Message Importance="high" Text="Preparing environment for tests" />
<!-- Remove the template creation folders and the package-restore folders to ensure that when we run the tests we don't
get cached results and changes show up.
-->
<ItemGroup>
<_ExistingFilesFromLastRun Include="$(TestTemplateCreationFolder)**\*" />
</ItemGroup>
<Delete Files="@(_ExistingFilesFromLastRun)" ContinueOnError="true" />
<Removedir Directories="$(TestTemplateCreationFolder)" Condition="Exists('$(TestTemplateCreationFolder)')" ContinueOnError="true">
<Output TaskParameter="RemovedDirectories" ItemName="_CleanedUpDirectories" />
</Removedir>
<Removedir Directories="$(TestPackageRestorePath)" Condition="Exists('$(TestPackageRestorePath)')" ContinueOnError="true">
<Output TaskParameter="RemovedDirectories" ItemName="_CleanedUpDirectories" />
</Removedir>
<Message Importance="high" Text="Removed directory %(_CleanedUpDirectories.Identity)" />
<MakeDir Directories="$(TestTemplateCreationFolder)">
<Output TaskParameter="DirectoriesCreated" ItemName="_CreatedDirectories" />
</MakeDir>
<MakeDir Directories="$(TestPackageRestorePath)">
<Output TaskParameter="DirectoriesCreated" ItemName="_CreatedDirectories" />
</MakeDir>
<Message Importance="high" Text="Created directory %(_CreatedDirectories.Identity)" />
<GenerateFileFromTemplate
TemplateFile="$(MSBuildThisFileDirectory)Infrastructure\Directory.Build.targets.in"
Properties="TemplateTestsPropsPath=$(TestTemplateTestsProps)"
OutputPath="$(TestTemplateCreationFolder)Directory.Build.targets" />
<GenerateFileFromTemplate
TemplateFile="$(MSBuildThisFileDirectory)Infrastructure\Directory.Build.props.in"
Properties="RepoRoot=$(RepoRoot)"
OutputPath="$(TestTemplateCreationFolder)Directory.Build.props" />
<!-- Workaround https://github.com/dotnet/core-setup/issues/6420 - there is no MSBuild setting for rollforward yet -->
<Copy SourceFiles="$(MSBuildThisFileDirectory)Infrastructure\runtimeconfig.norollforward.json" DestinationFolder="$(TestTemplateCreationFolder)" UseHardLinksIfPossible="true" />
<Delete Files="$(TestTemplateTestsProps)" />
</Target>
<!-- Shared testing infrastructure for running E2E tests using selenium -->
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.targets" />
</Project>