aspnetcore-tooling migration fixups

This commit is contained in:
John Luo 2020-05-16 18:07:24 -07:00
Родитель c565c2a4f1
Коммит 50f3a16571
75 изменённых файлов: 425 добавлений и 388 удалений

Просмотреть файл

@ -151,7 +151,7 @@ stages:
$(_InternalRuntimeDownloadArgs)
displayName: Build x86
# This is in a separate build step with -forceCoreMsbuild to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53
# This is in a separate build step with to workaround MAX_PATH limitations - https://github.com/Microsoft/msbuild/issues/53
- script: .\src\SiteExtensions\build.cmd
-ci
-nobl

Просмотреть файл

@ -56,6 +56,7 @@
<IncludeSymbols>true</IncludeSymbols>
<!-- Also update the DefaultNetCoreTargetFramework defined at src/Razor/test/testassets/Directory.Build.props -->
<DefaultNetCoreTargetFramework>net5.0</DefaultNetCoreTargetFramework>
</PropertyGroup>
@ -70,6 +71,9 @@
<NoWarn>$(NoWarn);NU5131</NoWarn>
<!-- Needed until we resolve https://github.com/dotnet/aspnetcore-internal/issues/3103 -->
<NoWarn>$(NoWarn);NU5048</NoWarn>
<!-- TODO: Figure out why these warnings are occuring -->
<NoWarn Condition="'$(IsAnalyzersProject)' == 'true'">$(NoWarn);RS1024;RS1025;RS1026</NoWarn>
</PropertyGroup>
<!-- Source code settings -->

Просмотреть файл

@ -166,6 +166,7 @@
Exclude="
@(ProjectToBuild);
@(ProjectToExclude);
$(RepoRoot)src\Razor\test\testassets\**\*.*proj;
$(RepoRoot)**\node_modules\**\*;
$(RepoRoot)**\bin\**\*;
$(RepoRoot)**\obj\**\*;"
@ -202,6 +203,7 @@
Exclude="
@(ProjectToBuild);
@(ProjectToExclude);
$(RepoRoot)src\Razor\test\testassets\**\*.*proj;
$(RepoRoot)**\node_modules\**\*;
$(RepoRoot)**\bin\**\*;
$(RepoRoot)**\obj\**\*;"

Просмотреть файл

@ -20,13 +20,10 @@ and are generated based on the last package release.
</ItemDefinitionGroup>
<ItemGroup Label=".NET team dependencies">
<LatestPackageReference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion)" />
<LatestPackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="$(MicrosoftAspNetCoreRazorLanguagePackageVersion)" />
<LatestPackageReference Include="Microsoft.Azure.SignalR" Version="$(MicrosoftAzureSignalRPackageVersion)" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(MicrosoftCodeAnalysisCommonPackageVersion)" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion)" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpPackageVersion)" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.Razor" Version="$(MicrosoftCodeAnalysisRazorPackageVersion)" />
<LatestPackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpPackageVersion)" />
<LatestPackageReference Include="Microsoft.DotNet.GenAPI" Version="$(MicrosoftDotNetGenApiPackageVersion)" />
<LatestPackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftExtensionsCachingAbstractionsPackageVersion)" />
@ -71,6 +68,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="System.CommandLine.Experimental" Version="$(SystemCommandlineExperimentalPackageVersion)" />
<LatestPackageReference Include="System.ComponentModel" Version="$(SystemComponentModelPackageVersion)" />
<LatestPackageReference Include="System.ComponentModel.Annotations" Version="$(SystemComponentModelAnnotationsPackageVersion)" />
<LatestPackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<LatestPackageReference Include="System.Diagnostics.EventLog" Version="$(SystemDiagnosticsEventLogPackageVersion)" />
<LatestPackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonPackageVersion)" />
<LatestPackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />

Просмотреть файл

@ -41,6 +41,13 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.NodeServices" ProjectPath="$(RepoRoot)src\Middleware\NodeServices\src\Microsoft.AspNetCore.NodeServices.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.SpaServices.Extensions" ProjectPath="$(RepoRoot)src\Middleware\SpaServices.Extensions\src\Microsoft.AspNetCore.SpaServices.Extensions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.SpaServices" ProjectPath="$(RepoRoot)src\Middleware\SpaServices\src\Microsoft.AspNetCore.SpaServices.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X" ProjectPath="$(RepoRoot)src\Razor\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X" ProjectPath="$(RepoRoot)src\Razor\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" ProjectPath="$(RepoRoot)src\Razor\Microsoft.AspNetCore.Mvc.Razor.Extensions\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Razor.Language" ProjectPath="$(RepoRoot)src\Razor\Microsoft.AspNetCore.Razor.Language\src\Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReferenceProvider Include="rzc" ProjectPath="$(RepoRoot)src\Razor\Microsoft.AspNetCore.Razor.Tools\src\Microsoft.AspNetCore.Razor.Tools.csproj" />
<ProjectReferenceProvider Include="Microsoft.CodeAnalysis.Razor" ProjectPath="$(RepoRoot)src\Razor\Microsoft.CodeAnalysis.Razor\src\Microsoft.CodeAnalysis.Razor.csproj" />
<ProjectReferenceProvider Include="Microsoft.NET.Sdk.Razor" ProjectPath="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\Microsoft.NET.Sdk.Razor.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" ProjectPath="$(RepoRoot)src\Mvc\Mvc.NewtonsoftJson\src\Microsoft.AspNetCore.Mvc.NewtonsoftJson.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" ProjectPath="$(RepoRoot)src\Mvc\Mvc.Razor.RuntimeCompilation\src\Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Mvc.Testing" ProjectPath="$(RepoRoot)src\Mvc\Mvc.Testing\src\Microsoft.AspNetCore.Mvc.Testing.csproj" />

Просмотреть файл

@ -13,22 +13,6 @@
<Uri>https://github.com/dotnet/blazor</Uri>
<Sha>dd7fb4d3931d556458f62642c2edfc59f6295bfb</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Razor.Language" Version="5.0.0-preview.6.20265.5">
<Uri>https://github.com/dotnet/aspnetcore-tooling</Uri>
<Sha>e759982cb63d5205b87ad0d968b09033ab778d12</Sha>
</Dependency>
<Dependency Name="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="5.0.0-preview.6.20265.5">
<Uri>https://github.com/dotnet/aspnetcore-tooling</Uri>
<Sha>e759982cb63d5205b87ad0d968b09033ab778d12</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Razor" Version="5.0.0-preview.6.20265.5">
<Uri>https://github.com/dotnet/aspnetcore-tooling</Uri>
<Sha>e759982cb63d5205b87ad0d968b09033ab778d12</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.Razor" Version="5.0.0-preview.6.20265.5">
<Uri>https://github.com/dotnet/aspnetcore-tooling</Uri>
<Sha>e759982cb63d5205b87ad0d968b09033ab778d12</Sha>
</Dependency>
<Dependency Name="dotnet-ef" Version="5.0.0-preview.6.20264.4">
<Uri>https://github.com/dotnet/efcore</Uri>
<Sha>7f81b608c2ceb19f6072b8b3cec6ad45fcc2d6a9</Sha>
@ -205,6 +189,10 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>bdd7235c43d762cea051cfc2071e14de48175f0c</Sha>
</Dependency>
<Dependency Name="System.Diagnostics.DiagnosticSource" Version="5.0.0-preview.6.20264.1" CoherentParentDependency="Microsoft.AspNetCore.Razor.Language">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>bdd7235c43d762cea051cfc2071e14de48175f0c</Sha>
</Dependency>
<Dependency Name="System.Diagnostics.EventLog" Version="5.0.0-preview.6.20264.1" CoherentParentDependency="Microsoft.AspNetCore.Razor.Language">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>bdd7235c43d762cea051cfc2071e14de48175f0c</Sha>

Просмотреть файл

@ -107,6 +107,7 @@
<MicrosoftExtensionsPrimitivesPackageVersion>5.0.0-preview.6.20264.1</MicrosoftExtensionsPrimitivesPackageVersion>
<MicrosoftExtensionsInternalTransportPackageVersion>5.0.0-preview.6.20264.1</MicrosoftExtensionsInternalTransportPackageVersion>
<SystemComponentModelAnnotationsPackageVersion>5.0.0-preview.6.20264.1</SystemComponentModelAnnotationsPackageVersion>
<SystemDiagnosticsDiagnosticSourcePackageVersion>5.0.0-preview.6.20264.1</SystemDiagnosticsDiagnosticSourcePackageVersion>
<SystemDiagnosticsEventLogPackageVersion>5.0.0-preview.6.20264.1</SystemDiagnosticsEventLogPackageVersion>
<SystemDrawingCommonPackageVersion>5.0.0-preview.6.20264.1</SystemDrawingCommonPackageVersion>
<SystemIOPipelinesPackageVersion>5.0.0-preview.6.20264.1</SystemIOPipelinesPackageVersion>
@ -136,11 +137,6 @@
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>5.0.0-preview.6.20264.4</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>5.0.0-preview.6.20264.4</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>5.0.0-preview.6.20264.4</MicrosoftEntityFrameworkCorePackageVersion>
<!-- Packages from dotnet/aspnetcore-tooling -->
<MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>5.0.0-preview.6.20265.5</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
<MicrosoftAspNetCoreRazorLanguagePackageVersion>5.0.0-preview.6.20265.5</MicrosoftAspNetCoreRazorLanguagePackageVersion>
<MicrosoftCodeAnalysisRazorPackageVersion>5.0.0-preview.6.20265.5</MicrosoftCodeAnalysisRazorPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>5.0.0-preview.6.20265.5</MicrosoftNETSdkRazorPackageVersion>
</PropertyGroup>
<!--
@ -187,9 +183,9 @@
<MicrosoftBuildFrameworkPackageVersion>15.8.166</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildLocatorPackageVersion>1.2.6</MicrosoftBuildLocatorPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.8.166</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>3.0.0</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>3.0.0</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>3.0.0</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>3.4.0</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>3.4.0</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>3.4.0</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>
<MicrosoftIdentityModelLoggingPackageVersion>5.5.0</MicrosoftIdentityModelLoggingPackageVersion>
<MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>5.5.0</MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>
@ -226,6 +222,9 @@
<MonoCecilPackageVersion>0.10.1</MonoCecilPackageVersion>
<NewtonsoftJsonBsonPackageVersion>1.0.2</NewtonsoftJsonBsonPackageVersion>
<NewtonsoftJsonPackageVersion>12.0.2</NewtonsoftJsonPackageVersion>
<!-- Begin: STOP!!! Razor need to reference the version of JSON that our HOSTS support. -->
<Razor_NewtonsoftJsonPackageVersion>9.0.1</Razor_NewtonsoftJsonPackageVersion>
<!-- End: STOP!!! Razor need to reference the version of JSON that our HOSTS support. -->
<NSwagApiDescriptionClientPackageVersion>13.0.4</NSwagApiDescriptionClientPackageVersion>
<SeleniumSupportPackageVersion>3.12.1</SeleniumSupportPackageVersion>
<SeleniumWebDriverMicrosoftDriverPackageVersion>17.17134.0</SeleniumWebDriverMicrosoftDriverPackageVersion>

Просмотреть файл

@ -14,13 +14,29 @@
<PackageReference Condition="'$(DotNetBuildFromSource)' != 'true'" Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" Version="$(MicrosoftDotNetGenApiPackageVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
<!--
Use the Razor SDK as a package reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
several versions older than latest. To avoid a cyclical dependency, this package reference is added to override the bundled version.
-->
<PackageReference Include="Microsoft.NET.Sdk.Razor" PrivateAssets="All" Version="$(MicrosoftNETSdkRazorPackageVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<Choose>
<When Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
<ItemGroup>
<!--
Use the Razor SDK as a project reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
several versions older than latest. We reference the project to ensure it's built before the other projects that use it. Since this
is a project reference, we must explicitly import the props file and also specify the output location of the SDK directory.
-->
<ProjectReference Include="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\Microsoft.NET.Sdk.Razor.csproj" PrivateAssets="All" IsImplicitlyDefined="true" ReferenceOutputAssembly="false" >
<!-- Use the same logic as Sdk.Razor.CurrentVersion.Targets -->
<SetTargetFramework Condition=" '$(MSBuildRuntimeType)' == 'Core'">TargetFramework=$(DefaultNetCoreTargetFramework)</SetTargetFramework>
<SetTargetFramework Condition=" '$(MSBuildRuntimeType)' != 'Core'">TargetFramework=net46</SetTargetFramework>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<RazorSdkDirectoryRoot>$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
</When>
</Choose>
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
<Reference Include="Microsoft.AspNetCore.Testing" />

Просмотреть файл

@ -86,7 +86,8 @@
@(AspNetCoreAppReferenceAndPackage);
@(ExternalAspNetCoreAppReference);
@(_CompilationOnlyReference);
@(Reference->WithMetadataValue('IsSharedSource', 'true'))" />
@(Reference->WithMetadataValue('IsSharedSource', 'true'));
@(Reference->WithMetadataValue('PrivateAssets', 'All'))" />
<_OriginalReferences Include="@(Reference)" />
<!--
Turn Reference items into a ProjectReference when UseProjectReferences is true.

Просмотреть файл

@ -6,6 +6,7 @@
"dotnet": "5.0.100-preview.5.20258.4",
"runtimes": {
"dotnet/x64": [
"2.1.11",
"$(MicrosoftNETCoreAppInternalPackageVersion)"
],
"dotnet/x86": [

Просмотреть файл

@ -100,10 +100,12 @@ namespace Microsoft.AspNetCore.Blazor.Build
static void SetupDirectoryBuildFiles(string repoRoot, string testAppsRoot, string projectDestination)
{
var razorSdkDirectoryRoot = Assembly.GetExecutingAssembly().GetCustomAttributes<AssemblyMetadataAttribute>().SingleOrDefault(a => a.Key == "RazorSdkDirectoryRoot").Value;
var beforeDirectoryPropsContent =
$@"<Project>
<PropertyGroup>
<RepoRoot>{repoRoot}</RepoRoot>
<RazorSdkDirectoryRoot>{razorSdkDirectoryRoot}</RazorSdkDirectoryRoot>
</PropertyGroup>
</Project>";
File.WriteAllText(Path.Combine(projectDestination, "Before.Directory.Build.props"), beforeDirectoryPropsContent);

Просмотреть файл

@ -47,6 +47,11 @@
<_Parameter1>Testing.RepoRoot</_Parameter1>
<_Parameter2>$(RepoRoot)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>RazorSdkDirectoryRoot</_Parameter1>
<_Parameter2>$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\sdk-output\</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<Target Name="RestoreTestAssets" AfterTargets="Restore;Build" Condition="'$(DotNetBuildFromSource)' != 'true'">

Просмотреть файл

@ -22,10 +22,7 @@
Version="$(MicrosoftNetCompilersToolsetPackageVersion)"
PrivateAssets="all"
IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.NET.Sdk.Razor"
Version="$(MicrosoftNETSdkRazorPackageVersion)"
PrivateAssets="All"
IsImplicitlyDefined="true" />
</ItemGroup>
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props"/>
</Project>

Просмотреть файл

@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis
return false;
}
private static IEnumerable<ITypeSymbol> GetTypeHierarchy(this ITypeSymbol typeSymbol)
private static IEnumerable<ITypeSymbol> GetTypeHierarchy(this ITypeSymbol? typeSymbol)
{
while (typeSymbol != null)
{

Просмотреть файл

@ -103,6 +103,11 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers
{
while (method.IsOverride)
{
if (method.OverriddenMethod == null)
{
throw new ArgumentNullException(nameof(method.OverriddenMethod));
}
method = method.OverriddenMethod;
}

Просмотреть файл

@ -101,6 +101,10 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
case ObjectCreationExpressionSyntax creation:
{
if (creation.ArgumentList == null)
{
throw new ArgumentNullException(nameof(creation.ArgumentList));
}
// Read values from 'return new StatusCodeResult(200) case.
var result = InspectMethodArguments(semanticModel, creation, creation.ArgumentList, cancellationToken);
statusCode = result.statusCode ?? statusCode;
@ -126,7 +130,7 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
private static (int? statusCode, ITypeSymbol? returnType) InspectInitializers(
in ApiControllerSymbolCache symbolCache,
SemanticModel semanticModel,
InitializerExpressionSyntax initializer,
InitializerExpressionSyntax? initializer,
CancellationToken cancellationToken)
{
int? statusCode = null;
@ -201,7 +205,13 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
private static ITypeSymbol GetExpressionObjectType(SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken)
{
var typeInfo = semanticModel.GetTypeInfo(expression, cancellationToken);
return typeInfo.Type;
if (typeInfo.Type == null)
{
throw new ArgumentNullException(nameof(typeInfo.Type));
}
return typeInfo.Type!;
}
private static bool TryGetExpressionStatusCode(

Просмотреть файл

@ -121,18 +121,40 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
}
}
if (root == null)
{
throw new ArgumentNullException(nameof(root));
}
return document.WithSyntaxRoot(root);
}
private async Task<CodeActionContext?> CreateCodeActionContext(CancellationToken cancellationToken)
{
var root = await _document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
if (root == null)
{
throw new ArgumentNullException(nameof(root));
}
var semanticModel = await _document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var methodReturnStatement = (ReturnStatementSyntax)root.FindNode(_diagnostic.Location.SourceSpan);
var methodSyntax = methodReturnStatement.FirstAncestorOrSelf<MethodDeclarationSyntax>();
var method = semanticModel.GetDeclaredSymbol(methodSyntax, cancellationToken);
if (semanticModel == null)
{
throw new ArgumentNullException(nameof(semanticModel));
}
var statusCodesType = semanticModel.Compilation.GetTypeByMetadataName(ApiSymbolNames.HttpStatusCodes);
if (statusCodesType == null)
{
throw new ArgumentNullException(nameof(statusCodesType));
}
var statusCodeConstants = GetStatusCodeConstants(statusCodesType);
if (!ApiControllerSymbolCache.TryCreate(semanticModel.Compilation, out var symbolCache))

Просмотреть файл

@ -1,6 +1,7 @@
// 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.Collections.Immutable;
using System.Composition;
using System.Threading;
@ -59,7 +60,12 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
var rootNode = await _document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var editor = await DocumentEditor.CreateAsync(_document, cancellationToken).ConfigureAwait(false);
var ifBlockSyntax = rootNode.FindNode(_ifBlockSpan);
if (rootNode == null)
{
throw new ArgumentNullException(nameof(rootNode));
}
var ifBlockSyntax = rootNode!.FindNode(_ifBlockSpan);
editor.RemoveNode(ifBlockSyntax);
return editor.GetChangedDocument();

Просмотреть файл

@ -61,14 +61,22 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
internal static SymbolApiConventionNameMatchBehavior GetNameMatchBehavior(ApiControllerSymbolCache symbolCache, ISymbol symbol)
{
var attribute = symbol.GetAttributes(symbolCache.ApiConventionNameMatchAttribute).FirstOrDefault();
if (attribute == null ||
if (attribute == null ||
attribute.ConstructorArguments.Length != 1 ||
attribute.ConstructorArguments[0].Kind != TypedConstantKind.Enum)
{
return SymbolApiConventionNameMatchBehavior.Exact;
}
var intValue = (int)attribute.ConstructorArguments[0].Value;
var argEnum = attribute.ConstructorArguments[0].Value;
if (argEnum == null)
{
throw new ArgumentNullException(nameof(argEnum));
}
var intValue = (int)argEnum;
return (SymbolApiConventionNameMatchBehavior)intValue;
}
@ -82,7 +90,15 @@ namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
return SymbolApiConventionTypeMatchBehavior.AssignableFrom;
}
var intValue = (int)attribute.ConstructorArguments[0].Value;
var argEnum = attribute.ConstructorArguments[0].Value;
if (argEnum == null)
{
throw new ArgumentNullException(nameof(argEnum));
}
var intValue = (int)argEnum;
return (SymbolApiConventionTypeMatchBehavior)intValue;
}

Просмотреть файл

@ -5,7 +5,7 @@
<IsTestAssetProject>true</IsTestAssetProject>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc" />
</ItemGroup>

Просмотреть файл

@ -37,6 +37,9 @@
MicrosoftAspNetCoreAppRuntimePackageVersion=@(_RuntimePackageVersionInfo->'%(PackageVersion)');
SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers);
DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework);
RepoRoot=$(RepoRoot);
Configuration=$(Configuration);
ArtifactsBinDir=$(ArtifactsBinDir);
</PropsProperties>
</PropertyGroup>

Просмотреть файл

@ -29,11 +29,14 @@
IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
<!--
Use the Razor SDK as a package reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
several versions older than latest. To avoid a cyclical dependency, this package reference is added to override the bundled version.
-->
<PackageReference Include="Microsoft.NET.Sdk.Razor" PrivateAssets="All" Version="${MicrosoftNETSdkRazorPackageVersion}" />
</ItemGroup>
<!--
Use the Razor SDK as a project reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
several versions older than latest. To avoid a cyclical dependency, this package reference is added to override the bundled version.
Since this is a project reference, we must explicitly import the props file and also specify the output location of the SDK directory.
-->
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
<PropertyGroup>
<RazorSdkDirectoryRoot>${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
</Project>

Просмотреть файл

@ -37,6 +37,9 @@
MicrosoftAspNetCoreAppRuntimePackageVersion=@(_RuntimePackageVersionInfo->'%(PackageVersion)');
SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers);
DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework);
RepoRoot=$(RepoRoot);
Configuration=$(Configuration);
ArtifactsBinDir=$(ArtifactsBinDir);
</PropsProperties>
</PropertyGroup>

Просмотреть файл

@ -29,11 +29,14 @@
IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
<!--
Use the Razor SDK as a package reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
several versions older than latest. To avoid a cyclical dependency, this package reference is added to override the bundled version.
-->
<PackageReference Include="Microsoft.NET.Sdk.Razor" PrivateAssets="All" Version="${MicrosoftNETSdkRazorPackageVersion}" />
</ItemGroup>
<!--
The version of the .NET Core SDK we build with often contains a version of the Razor SDK several versions older than latest.
We reference the project to ensure it's built before the other projects that use it. Since this is a project reference, we
must explicitly import the props file and also specify the output location of the SDK directory.
-->
<Import Project="${RepoRoot}src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''" />
<PropertyGroup>
<RazorSdkDirectoryRoot>${ArtifactsBinDir}Microsoft.NET.Sdk.Razor\${Configuration}\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
</Project>

Просмотреть файл

@ -6,17 +6,19 @@
<PackageTags>$(PackageTags);aspnetcoremvc</PackageTags>
<EnableApiCheck>false</EnableApiCheck>
<IsShipping>false</IsShipping>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Microsoft.AspNetCore.Razor.Language\CodeGeneration\CodeWriterExtensions.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Language\src\CodeGeneration\CodeWriterExtensions.cs">
<Link>Shared\CodeWriterExtensions.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microsoft.AspNetCore.Razor.Language/Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="../Microsoft.CodeAnalysis.Razor/Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
</ItemGroup>
</Project>

Просмотреть файл

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.IntegrationTests
private readonly static CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode");
public CodeGenerationIntegrationTest()
: base(generateBaselines: null)
: base(generateBaselines: null, projectDirectoryHint: "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X")
{
Configuration = RazorConfiguration.Create(
RazorLanguageVersion.Version_1_1,
@ -311,7 +311,7 @@ public class ThisShouldBeGenerated
var diagnotics = compiled.CodeDocument.GetCSharpDocument().Diagnostics;
Assert.Equal("RZ2001", Assert.Single(diagnotics).Id);
}
[Fact]
public void ModelExpressionTagHelper_DesignTime()
{

Просмотреть файл

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**</DefaultItemExcludes>
<!-- Work around https://github.com/microsoft/msbuild/issues/4740 -->
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -15,18 +19,13 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -5,17 +5,19 @@
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTags>$(PackageTags);aspnetcoremvc</PackageTags>
<IsShipping>false</IsShipping>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Microsoft.AspNetCore.Razor.Language\CodeGeneration\CodeWriterExtensions.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Language\src\CodeGeneration\CodeWriterExtensions.cs">
<Link>Shared\CodeWriterExtensions.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microsoft.AspNetCore.Razor.Language/Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="../Microsoft.CodeAnalysis.Razor/Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
</ItemGroup>
</Project>

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.IntegrationTests
private readonly static CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode");
public CodeGenerationIntegrationTest()
: base(generateBaselines: null)
: base(generateBaselines: null, projectDirectoryHint: "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X")
{
Configuration = RazorConfiguration.Create(
RazorLanguageVersion.Version_2_0,

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.IntegrationTests
private readonly static CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode");
public InstrumentationPassIntegrationTest()
: base(generateBaselines: null)
: base(generateBaselines: null, projectDirectoryHint: "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X")
{
Configuration = RazorConfiguration.Create(
RazorLanguageVersion.Version_2_0,
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.IntegrationTests
{
b.AddTagHelpers(descriptors);
b.Features.Add(new InstrumentationPass());
// This test includes templates
b.AddTargetExtension(new TemplateTargetExtension());
});

Просмотреть файл

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**</DefaultItemExcludes>
<!-- Work around https://github.com/microsoft/msbuild/issues/4740 -->
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -15,18 +19,13 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj" />
</ItemGroup>
<Target Name="CopyDepsFromShims" AfterTargets="Build">

Просмотреть файл

@ -4,17 +4,19 @@
<Description>ASP.NET Core design time hosting infrastructure for the Razor view engine.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageTags>$(PackageTags);aspnetcoremvc</PackageTags>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Microsoft.AspNetCore.Razor.Language\CodeGeneration\CodeWriterExtensions.cs" Link="Shared\CodeWriterExtensions.cs" />
<Compile Include="..\Microsoft.AspNetCore.Razor.Language\CSharpIdentifier.cs" Link="Shared\CSharpIdentifier.cs" />
<Compile Include="..\Microsoft.AspNetCore.Razor.Language\Checksum.cs" Link="Shared\Checksum.cs" />
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Language\src\CodeGeneration\CodeWriterExtensions.cs" Link="Shared\CodeWriterExtensions.cs" />
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Language\src\CSharpIdentifier.cs" Link="Shared\CSharpIdentifier.cs" />
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Language\src\Checksum.cs" Link="Shared\Checksum.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Microsoft.AspNetCore.Razor.Language/Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="../Microsoft.CodeAnalysis.Razor/Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
</ItemGroup>
</Project>

Просмотреть файл

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests
private readonly static CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode");
public CodeGenerationIntegrationTest()
: base(generateBaselines: null)
: base(generateBaselines: null, projectDirectoryHint: "Microsoft.AspNetCore.Mvc.Razor.Extensions")
{
Configuration = RazorConfiguration.Create(
RazorLanguageVersion.Version_3_0,

Просмотреть файл

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**</DefaultItemExcludes>
<!-- Work around https://github.com/microsoft/msbuild/issues/4740 -->
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -15,17 +19,12 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj" />
</ItemGroup>
<Target Name="CopyDepsFromShims" AfterTargets="Build">

Просмотреть файл

@ -3,10 +3,12 @@
<PropertyGroup>
<Description>Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor parser and code generation infrastructure.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.HashCodeCombiner.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion)" />
<Compile Include="$(SharedSourceRoot)HashCodeCombiner\*.cs" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**\*</DefaultItemExcludes>
<DefineConstants Condition="'$(GenerateBaselines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
<!-- Work around https://github.com/microsoft/msbuild/issues/4740 -->
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -15,14 +19,9 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Language\Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -20,24 +20,27 @@
<!-- Don't produce rzc.exe -->
<UseAppHost>false</UseAppHost>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Microsoft.CodeAnalysis.Razor.Workspaces\Serialization\TagHelperDescriptorJsonConverter.cs">
<Compile Include="$(SharedSourceRoot)RazorShared\TagHelperDescriptorJsonConverter.cs">
<Link>Shared\TagHelperDescriptorJsonConverter.cs</Link>
</Compile>
<Compile Include="..\Microsoft.VisualStudio.LanguageServices.Razor\Serialization\RazorDiagnosticJsonConverter.cs">
<Compile Include="$(SharedSourceRoot)RazorShared\RazorDiagnosticJsonConverter.cs">
<Link>Shared\RazorDiagnosticJsonConverter.cs</Link>
</Compile>
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
<Reference Include="Newtonsoft.Json" Version="$(Razor_NewtonsoftJsonPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
</ItemGroup>
<!-- This makes it so that the runtimeconfig.json is included as part of the build output of the project that references this project. -->

Просмотреть файл

@ -3,16 +3,14 @@
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**</DefaultItemExcludes>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<Reference Include="rzc" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -3,14 +3,13 @@
<PropertyGroup>
<Description>Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure.</Description>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Language\Microsoft.AspNetCore.Razor.Language.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(Runtime_MicrosoftCodeAnalysisCommonPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.Common" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
</ItemGroup>
</Project>

Просмотреть файл

@ -11,11 +11,6 @@ namespace Microsoft.CodeAnalysis.Razor
{
public static SourceChange AsSourceChange(this TextChange textChange)
{
if (textChange == null)
{
throw new ArgumentNullException(nameof(textChange));
}
return new SourceChange(textChange.Span.AsSourceSpan(), textChange.NewText);
}
}

Просмотреть файл

@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**\*</DefaultItemExcludes>
<PreserveCompilationContext>true</PreserveCompilationContext>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -12,18 +16,14 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Language\Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<!-- Included for definitions of Tag Helper types -->
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -13,47 +13,56 @@
<NoWarn>$(NoWarn);NU5100</NoWarn>
<!-- It is intentional to not include build/netstandard2.0/Microsoft.NET.Sdk.Razor.targets -->
<NoWarn>$(NoWarn);NU5129</NoWarn>
<!-- Ignore file copy warnings -->
<NoWarn>$(NoWarn);MSB3030;MSB4181</NoWarn>
<!-- Cannot run pubternal check on net46 -->
<DisablePubternalApiCheck>true</DisablePubternalApiCheck>
<!-- Need to build this project in source build -->
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataPackageVersion)" Condition="'$(TargetFramework)'=='net46'" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.Core" />
<Reference Include="System.Reflection.Metadata" Condition="'$(TargetFramework)'=='net46'" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='$(DefaultNetCoreTargetFramework)'" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='$(DefaultNetCoreTargetFramework)'" />
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='$(DefaultNetCoreTargetFramework)'" />
<Reference Include="rzc" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='$(DefaultNetCoreTargetFramework)'" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Microsoft.AspNetCore.Razor.Tools\ServerProtocol\*.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Tools\src\ServerProtocol\*.cs">
<Link>Shared\ServerProtocol\%(FileName)</Link>
</Compile>
<Compile Include="..\Microsoft.AspNetCore.Razor.Tools\PipeName.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Tools\src\PipeName.cs">
<Link>Shared\PipeName.cs</Link>
</Compile>
<Compile Include="..\Microsoft.AspNetCore.Razor.Tools\MutexName.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Tools\src\MutexName.cs">
<Link>Shared\MutexName.cs</Link>
</Compile>
<Compile Include="..\Microsoft.AspNetCore.Razor.Tools\Client.cs">
<Compile Include="..\..\Microsoft.AspNetCore.Razor.Tools\src\Client.cs">
<Link>Shared\Client.cs</Link>
</Compile>
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
<Content Include="_._" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<Target Name="LayoutDependencies" BeforeTargets="Build" Condition="'$(IsInnerBuild)' != 'true'">
<Target Name="LayoutDependencies" BeforeTargets="Build">
<!-- Layout tasks, compiler, and extensions in the sdk-output folder. The entire folder structure gets packaged as-is into the SDK -->
<MSBuild
Projects="..\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj"
Properties="PublishDir=$(SdkOutputPath)tools\netcoreapp3.0;TargetFramework=netcoreapp3.0"
Targets="Publish" />
Projects="..\..\Microsoft.AspNetCore.Razor.Tools\src\Microsoft.AspNetCore.Razor.Tools.csproj"
Properties="PublishDir=$(SdkOutputPath)temp;TargetFramework=netcoreapp3.0"
Targets="Publish"
ContinueOnError="true" />
<ItemGroup>
<RazorToolsOutput Include="$(SdkOutputPath)temp\**\*.*" />
<MvcRazorExtensionOutput Include="$(ArtifactsBinDir)Microsoft.AspNetCore.Mvc.Razor.Extensions\$(Configuration)\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.Extensions.dll" />
</ItemGroup>
<Copy SourceFiles="@(MvcRazorExtensionOutput)" DestinationFolder="$(SdkOutputPath)extensions\mvc-3-0\" SkipUnchangedFiles="true">
<Copy SourceFiles="@(RazorToolsOutput)" DestinationFolder="$(SdkOutputPath)tools\netcoreapp3.0\" SkipUnchangedFiles="true" ContinueOnError="true" />
<Copy SourceFiles="@(MvcRazorExtensionOutput)" DestinationFolder="$(SdkOutputPath)extensions\mvc-3-0\" SkipUnchangedFiles="true" ContinueOnError="true" Condition="'$(TargetFramework)'=='$(DefaultNetCoreTargetFramework)'">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
@ -65,9 +74,17 @@
<ProjectOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\net46*\System.Reflection.Metadata.dll" />
</ItemGroup>
<Copy SourceFiles="@(ProjectOutput)" DestinationFiles="$(SdkOutputPath)tasks\%(RecursiveDir)%(FileName)%(Extension)" SkipUnchangedFiles="true">
<Copy SourceFiles="@(ProjectOutput)" DestinationFiles="$(SdkOutputPath)tasks\%(RecursiveDir)%(FileName)%(Extension)" SkipUnchangedFiles="true" ContinueOnError="true" >
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
<Message Importance="High" Text="Prepared Razor SDK at $(SdkOutputPath)" />
<ItemGroup>
<_PreparedRazorSdkFiles Include="$(SdkOutputPath)**\*.*" />
</ItemGroup>
<Message Importance="High" Text="Prepared files:@(_PreparedRazorSdkFiles->'%0a%(Identity)')" />
</Target>
<Target Name="PopulateNuspec" BeforeTargets="InitializeStandardNuspecProperties" DependsOnTargets="LayoutDependencies">

Просмотреть файл

@ -1,41 +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.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
internal static partial class BuildVariables
{
private static string _msBuildPath = string.Empty;
private static string _MicrosoftNETCoreApp50PackageVersion = string.Empty;
private static string _microsoftNetCompilersToolsetPackageVersion = string.Empty;
private static readonly IEnumerable<AssemblyMetadataAttribute> TestAssemblyMetadata = Assembly.GetExecutingAssembly().GetCustomAttributes<AssemblyMetadataAttribute>();
static partial void InitializeVariables();
public static string MSBuildPath => TestAssemblyMetadata.SingleOrDefault(a => a.Key == "DesktopMSBuildPath").Value;
public static string MSBuildPath
{
get
{
InitializeVariables();
return _msBuildPath;
}
}
public static string MicrosoftNETCoreAppRuntimeVersion => TestAssemblyMetadata.SingleOrDefault(a => a.Key == "MicrosoftNETCoreAppRuntimeVersion").Value;
public static string MicrosoftNETCoreApp50PackageVersion
{
get
{
InitializeVariables();
return _MicrosoftNETCoreApp50PackageVersion;
}
}
public static string MicrosoftNetCompilersToolsetPackageVersion => TestAssemblyMetadata.SingleOrDefault(a => a.Key == "MicrosoftNetCompilersToolsetPackageVersion").Value;
public static string MicrosoftNetCompilersToolsetPackageVersion
{
get
{
InitializeVariables();
return _microsoftNetCompilersToolsetPackageVersion;
}
}
public static string RazorSdkDirectoryRoot => TestAssemblyMetadata.SingleOrDefault(a => a.Key == "RazorSdkDirectoryRoot").Value;
public static string RepoRoot => TestAssemblyMetadata.SingleOrDefault(a => a.Key == "Testing.RepoRoot").Value;
}
}

Просмотреть файл

@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Publish rzc tool to a temporary path. This is the location based on which the pipe name is generated.
var repositoryRoot = ProjectDirectory.SearchUp(AppContext.BaseDirectory, "global.json");
var solutionRoot = Path.Combine(repositoryRoot, "src", "Razor");
var toolAssemblyDirectory = Path.Combine(solutionRoot, "src", "Microsoft.AspNetCore.Razor.Tools");
var toolAssemblyDirectory = Path.Combine(solutionRoot, "Microsoft.AspNetCore.Razor.Tools", "src");
var toolAssemblyPath = Path.Combine(toolAssemblyDirectory, "Microsoft.AspNetCore.Razor.Tools.csproj");
var projectDirectory = new TestProjectDirectory(solutionRoot, toolAssemblyDirectory, toolAssemblyPath);
var publishDir = Path.Combine(Path.GetTempPath(), "Razor", Path.GetRandomFileName(), "RzcPublish");

Просмотреть файл

@ -80,8 +80,10 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
// Let the test app know it is running as part of a test.
"/p:RunningAsTest=true",
$"/p:MicrosoftNETCoreApp50PackageVersion={BuildVariables.MicrosoftNETCoreApp50PackageVersion}",
$"/p:MicrosoftNETCoreAppRuntimeVersion={BuildVariables.MicrosoftNETCoreAppRuntimeVersion}",
$"/p:MicrosoftNetCompilersToolsetPackageVersion={BuildVariables.MicrosoftNetCompilersToolsetPackageVersion}",
$"/p:RazorSdkDirectoryRoot={BuildVariables.RazorSdkDirectoryRoot}",
$"/p:RepoRoot={BuildVariables.RepoRoot}",
};
if (!suppressBuildServer)

Просмотреть файл

@ -30,18 +30,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
throw new InvalidOperationException($"{destinationPath} should be empty");
}
var repositoryRoot = SearchUp(AppContext.BaseDirectory, "global.json");
if (repositoryRoot == null)
{
throw new InvalidOperationException("Could not find repository root.");
}
var repositoryRoot = BuildVariables.RepoRoot;
var solutionRoot = Path.Combine(repositoryRoot, "src", "Razor");
var binariesRoot = Path.GetDirectoryName(typeof(ProjectDirectory).Assembly.Location);
foreach (var project in new string[] { originalProjectName, }.Concat(additionalProjects))
{
var testAppsRoot = Path.Combine(solutionRoot, "test", "testapps");
var testAppsRoot = Path.Combine(solutionRoot, "test", "testassets");
var projectRoot = Path.Combine(testAppsRoot, project);
if (!Directory.Exists(projectRoot))
{
@ -51,7 +46,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
var projectDestination = Path.Combine(destinationPath, project);
var projectDestinationDir = Directory.CreateDirectory(projectDestination);
CopyDirectory(new DirectoryInfo(projectRoot), projectDestinationDir);
SetupDirectoryBuildFiles(solutionRoot, binariesRoot, testAppsRoot, projectDestination);
SetupDirectoryBuildFiles(repositoryRoot, binariesRoot, testAppsRoot, projectDestination);
}
// Rename the csproj/fsproj
@ -120,12 +115,13 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
}
}
void SetupDirectoryBuildFiles(string solutionRoot, string binariesRoot, string testAppsRoot, string projectDestination)
void SetupDirectoryBuildFiles(string repoRoot, string binariesRoot, string testAppsRoot, string projectDestination)
{
var beforeDirectoryPropsContent =
$@"<Project>
<PropertyGroup>
<SolutionRoot>{solutionRoot}</SolutionRoot>
<RepoRoot>{repoRoot}</RepoRoot>
<RazorSdkDirectoryRoot>{BuildVariables.RazorSdkDirectoryRoot}</RazorSdkDirectoryRoot>
<BinariesRoot>{binariesRoot}</BinariesRoot>
</PropertyGroup>
</Project>";

Просмотреть файл

@ -13,6 +13,9 @@
<!-- Copy references locally so that we can use them in the test. -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<BuildVariablesGeneratedFile>$(MSBuildProjectDirectory)\obj\BuildVariables.generated.cs</BuildVariablesGeneratedFile>
<!-- Tests do not work on Helix yet -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup>
@ -21,16 +24,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Moq" Version="$(MoqPackageVersion)" />
<Reference Include="Microsoft.Build.Utilities.Core" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Testing.AdditionalRestoreSources</_Parameter1>
<_Parameter2>$(MSBuildThisFileDirectory)..\testapps\PregeneratedPackages</_Parameter2>
<_Parameter2>$(MSBuildThisFileDirectory)..\testassets\PregeneratedPackages</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
@ -48,84 +49,73 @@
<_Parameter2>$(RepoRoot)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>MicrosoftNETCoreAppRuntimeVersion</_Parameter1>
<_Parameter2>$(MicrosoftNETCoreAppRuntimeVersion)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>MicrosoftNetCompilersToolsetPackageVersion</_Parameter1>
<_Parameter2>$(MicrosoftNetCompilersToolsetPackageVersion)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>RazorSdkDirectoryRoot</_Parameter1>
<_Parameter2>$(ArtifactsBinDir)Microsoft.NET.Sdk.Razor\$(Configuration)\sdk-output\</_Parameter2>
</AssemblyAttribute>
<!-- The test projects rely on these binaries being available -->
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj" />
<ProjectReference Include="..\..\src\Microsoft.NET.Sdk.Razor\Microsoft.NET.Sdk.Razor.csproj" />
<!-- The test projects rely on these binaries being available -->
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="rzc" />
<Reference Include="Microsoft.NET.Sdk.Razor" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj" />
<!-- We don't need anything in this assembly, we just want to make sure it's built -->
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\..\Microsoft.AspNetCore.Mvc.Razor.Extensions\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" ReferenceOutputAssembly="false" >
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<MSBuildLocationFileOutput>$(IntermediateOutputPath)BuildVariables.generated.cs</MSBuildLocationFileOutput>
</PropertyGroup>
<Target
Name="GenerateMSBuildLocationFile"
Condition="'$(TargetFramework)'!=''"
AfterTargets="BeforeBuild"
Inputs="$(MSBuildAllProjects)"
Outputs="$(MSBuildLocationFileOutput)">
<Target Name="GenerateTestData" BeforeTargets="GetAssemblyAttributes">
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="&quot;$(NuGetPackageRoot)vswhere\$(VSWhereVersion)\tools\vswhere.exe&quot; -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild" ConsoleToMsBuild="true" StandardErrorImportance="high">
<Output TaskParameter="ConsoleOutput" PropertyName="_VSInstallDir" />
</Exec>
<Error Condition="'$(OS)' == 'Windows_NT' and '$(_VSInstallDir)'==''" Text="Visual Studio not found on Windows." />
<Error Condition="'$(OS)' == 'Windows_NT' and '$(_VSInstallDir)'=='' and '$(Test)' == 'true'" Text="Visual Studio not found on Windows." />
<PropertyGroup>
<_DesktopMSBuildPath Condition="'$(OS)' == 'Windows_NT' and Exists('$(_VSInstallDir)\MSBuild\Current\Bin\msbuild.exe')">$(_VSInstallDir)\MSBuild\Current\Bin\msbuild.exe</_DesktopMSBuildPath>
<_DesktopMSBuildPath Condition="'$(OS)' == 'Windows_NT' and Exists('$(_VSInstallDir)\MSBuild\15.0\Bin\msbuild.exe')">$(_VSInstallDir)\MSBuild\15.0\Bin\msbuild.exe</_DesktopMSBuildPath>
<_Content><![CDATA[
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
internal static partial class BuildVariables
{
static partial void InitializeVariables()
{
_msBuildPath = @"$(_DesktopMSBuildPath)";
_MicrosoftNETCoreApp50PackageVersion = "$(MicrosoftNETCoreApp50PackageVersion)";
_microsoftNetCompilersToolsetPackageVersion = "$(MicrosoftNetCompilersToolsetPackageVersion)";
}
}
}
]]>
</_Content>
</PropertyGroup>
<Error Condition="'$(OS)' == 'Windows_NT' and '$(_DesktopMSBuildPath)'==''" Text="MSBuild.exe not found on Windows." />
<Error Condition="'$(OS)' == 'Windows_NT' and '$(_DesktopMSBuildPath)'=='' and '$(Test)' == 'true'" Text="MSBuild.exe not found on Windows." />
<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteLinesToFile Lines="$([MSBuild]::Escape($(_Content)))" File="$(MSBuildLocationFileOutput)" Overwrite="True" WriteOnlyWhenDifferent="True" />
<ItemGroup>
<Compile Include="$(MSBuildLocationFileOutput)">
<Visible>false</Visible>
</Compile>
<FileWrites Include="$(MSBuildLocationFileOutput)" />
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>DesktopMSBuildPath</_Parameter1>
<_Parameter2>$(_DesktopMSBuildPath)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
<Target Name="RestoreTestProjects" BeforeTargets="Restore;Build" Condition="'$(DotNetBuildFromSource)' != 'true'">
<MSBuild Projects="..\testapps\RestoreTestProjects\RestoreTestProjects.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion)" />
<MSBuild Projects="..\testapps\PackageLibraryDirectDependency\PackageLibraryDirectDependency.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion)" />
<MSBuild Projects="..\testapps\PackageLibraryTransitiveDependency\PackageLibraryTransitiveDependency.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion)" />
<MSBuild Projects="..\..\test\testassets\RestoreTestProjects\RestoreTestProjects.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);RepoRoot=$(RepoRoot)" />
<MSBuild Projects="..\..\test\testassets\PackageLibraryDirectDependency\PackageLibraryDirectDependency.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);RepoRoot=$(RepoRoot)" />
<MSBuild Projects="..\..\test\testassets\PackageLibraryTransitiveDependency\PackageLibraryTransitiveDependency.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);RepoRoot=$(RepoRoot)" />
<!-- This target restores SimpleMvc11 and SimpleMvc11NetFx separately because otherwise the TFMs in SimpleMvc11.csproj and SimpleMvc11NetFx.csproj are not respected. -->
<PropertyGroup>
<TargetFramework11>netcoreapp1.1</TargetFramework11>
<TargetFrameworkNetFx>net461</TargetFrameworkNetFx>
</PropertyGroup>
<MSBuild Projects="..\testapps\SimpleMvc11\SimpleMvc11.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);TargetFramework=$(TargetFramework11)" />
<MSBuild Projects="..\testapps\SimpleMvc11NetFx\SimpleMvc11NetFx.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);TargetFramework=$(TargetFrameworkNetFx)" />
<MSBuild Projects="..\..\test\testassets\SimpleMvc11\SimpleMvc11.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);TargetFramework=$(TargetFramework11);RepoRoot=$(RepoRoot)" />
<MSBuild Projects="..\..\test\testassets\SimpleMvc11NetFx\SimpleMvc11NetFx.csproj" Targets="Restore" Properties="MicrosoftNetCompilersToolsetPackageVersion=$(MicrosoftNetCompilersToolsetPackageVersion);TargetFramework=$(TargetFrameworkNetFx);RepoRoot=$(RepoRoot)" />
</Target>
<Target Name="EnsureLogFolder" AfterTargets="Build">

Просмотреть файл

@ -0,0 +1,7 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
<PropertyGroup>
<DisablePubternalApiCheck>true</DisablePubternalApiCheck>
</PropertyGroup>
</Project>

Просмотреть файл

@ -47,9 +47,9 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
}
protected IntegrationTestBase(bool? generateBaselines = null)
protected IntegrationTestBase(bool? generateBaselines = null, string? projectDirectoryHint = null)
{
TestProjectRoot = TestProject.GetProjectDirectory(GetType());
TestProjectRoot = projectDirectoryHint == null ? TestProject.GetProjectDirectory(GetType()) : TestProject.GetProjectDirectory(projectDirectoryHint);
if (generateBaselines.HasValue)
{
@ -85,13 +85,13 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
protected virtual bool DesignTime { get; } = false;
/// <summary>
/// Gets the
/// Gets the
/// </summary>
internal VirtualRazorProjectFileSystem FileSystem { get; } = new VirtualRazorProjectFileSystem();
/// <summary>
/// Used to force a specific style of line-endings for testing. This matters for the baseline tests that exercise line mappings.
/// Even though we normalize newlines for testing, the difference between platforms affects the data through the *count* of
/// Used to force a specific style of line-endings for testing. This matters for the baseline tests that exercise line mappings.
/// Even though we normalize newlines for testing, the difference between platforms affects the data through the *count* of
/// characters written.
/// </summary>
protected virtual string LineEnding { get; } = "\r\n";
@ -160,7 +160,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
Content = text,
};
return projectItem;
}
@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
Content = fileContent,
};
return projectItem;
}
@ -491,12 +491,6 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
var span = spans[i];
var sourceSpan = span.GetSourceSpan(codeDocument.Source);
if (sourceSpan == null)
{
// Not in the main file, skip.
continue;
}
var expectedSpan = sourceContent.Substring(sourceSpan.AbsoluteIndex, sourceSpan.Length);
// See #2593

Просмотреть файл

@ -8,15 +8,35 @@ namespace Microsoft.AspNetCore.Razor.Language
{
public static class TestProject
{
public static string GetProjectDirectory(string directoryHint)
{
var repoRoot = SearchUp(AppContext.BaseDirectory, "global.json");
var projectDirectory = Path.Combine(repoRoot, "src", "Razor", directoryHint, "test");
if (!Directory.Exists(projectDirectory) &&
string.Equals(directoryHint, "Microsoft.AspNetCore.Razor.Language.Test", StringComparison.Ordinal))
{
projectDirectory = Path.Combine(repoRoot, "src", "Razor", "Microsoft.AspNetCore.Razor.Language", "test");
}
if (!Directory.Exists(projectDirectory))
{
throw new InvalidOperationException(
$@"Could not locate project directory for directory hint {directoryHint}. Directory probe path: {projectDirectory}.");
}
return projectDirectory;
}
public static string GetProjectDirectory(Type type)
{
var repoRoot = SearchUp(AppContext.BaseDirectory, "global.json");
var assemblyName = type.Assembly.GetName().Name;
var projectDirectory = Path.Combine(repoRoot, "src", "Razor", "test", assemblyName);
var projectDirectory = Path.Combine(repoRoot, "src", "Razor", assemblyName, "test");
if (!Directory.Exists(projectDirectory) &&
string.Equals(assemblyName, "Microsoft.AspNetCore.Razor.Language.Test", StringComparison.Ordinal))
{
projectDirectory = Path.Combine(repoRoot, "src", "Razor", "test", "RazorLanguage.Test");
projectDirectory = Path.Combine(repoRoot, "src", "Razor", "Microsoft.AspNetCore.Razor.Language", "test");
}
if (!Directory.Exists(projectDirectory))

Просмотреть файл

@ -8,15 +8,15 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Razor.Language\Microsoft.AspNetCore.Razor.Language.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(Runtime_MicrosoftCodeAnalysisCSharpPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<Reference Include="Microsoft.AspNetCore.Razor.Language" />
<Reference Include="Microsoft.CodeAnalysis.Razor" />
<Reference Include="Microsoft.CodeAnalysis.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyModel" />
<Reference Include="xunit.assert" />
<Reference Include="xunit.extensibility.execution" />
</ItemGroup>
</Project>

Просмотреть файл

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<DisablePubternalApiCheck>true</DisablePubternalApiCheck>
</PropertyGroup>
</Project>

Просмотреть файл

@ -5,9 +5,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="System.Text.Encodings.Web" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup>

Просмотреть файл

@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="System.Text.Encodings.Web" />
</ItemGroup>
</Project>

Просмотреть файл

@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="System.Text.Encodings.Web" />
</ItemGroup>
</Project>

Просмотреть файл

@ -6,8 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourcePackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="System.Text.Encodings.Web" />
<ProjectReference Include="..\Microsoft.AspNetCore.Razor.Test.ComponentShim\Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj" />
</ItemGroup>

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -26,7 +22,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,12 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<RuntimeAdditionalRestoreSources Condition="'$(RuntimeAdditionalRestoreSources)'==''">$(MSBuildThisFileDirectory)..\PregeneratedPackages\</RuntimeAdditionalRestoreSources>
<RuntimeAdditionalRestoreSources Condition="'$(RuntimeAdditionalRestoreSources)'=='' AND EXISTS('$(MSBuildThisFileDirectory)..\PregeneratedPackages\')">$(MSBuildThisFileDirectory)..\PregeneratedPackages\</RuntimeAdditionalRestoreSources>
<RestoreAdditionalProjectSources>$(RestoreAdditionalProjectSources);$(RuntimeAdditionalRestoreSources)</RestoreAdditionalProjectSources>
</PropertyGroup>
@ -32,7 +28,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
@ -36,7 +32,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
@ -23,7 +19,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
@ -20,7 +16,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<!--
This project references a shipped version of MVC and should not reference local builds of
<!--
This project references a shipped version of MVC and should not reference local builds of
the CodeGeneration targets, rzc, or any of the test shims.
-->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2">
<!-- Avoid exporting types from real MVC that will conflict with the test shim -->

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -20,7 +16,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->

Просмотреть файл

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
@ -16,7 +12,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<!-- DO NOT add addition references here. This is meant to simulate a non-MVC library -->

Просмотреть файл

@ -2,10 +2,6 @@
<Import Project="Before.Directory.Build.props" Condition="Exists('Before.Directory.Build.props')" />
<PropertyGroup>
<SolutionRoot Condition="'$(SolutionRoot)' == ''">$(MSBuildThisFileDirectory)..\..\</SolutionRoot>
<SolutionRoot>$([MSBuild]::EnsureTrailingSlash('$(SolutionRoot)'))</SolutionRoot>
<RepositoryRoot>$(SolutionRoot)..\..\</RepositoryRoot>
<!--
In the case that a user is building a sample directly the MicrosoftNetCompilersToolsetPackagerVersion will not be provided.
We'll fall back to whatever the current SDK provides in regards to Roslyn's Microsoft.Net.Compilers.Toolset.
@ -13,16 +9,18 @@
<BuildingTestAppsIndependently>false</BuildingTestAppsIndependently>
<BuildingTestAppsIndependently Condition="'$(MicrosoftNetCompilersToolsetPackageVersion)' == ''">true</BuildingTestAppsIndependently>
<!-- Retarget tests to use the copy of the Sdk from source -->
<RazorSdkArtifactsDirectory>$(SolutionRoot)..\..\artifacts\bin\Microsoft.NET.Sdk.Razor\</RazorSdkArtifactsDirectory>
<!-- Do not resolve Reference ItemGroup since it has a different semantic meaning in Razor test apps -->
<EnableCustomReferenceResolution>false</EnableCustomReferenceResolution>
<RazorSdkCurrentVersionProps>$(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.props</RazorSdkCurrentVersionProps>
<RazorSdkCurrentVersionTargets>$(SolutionRoot)src\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets</RazorSdkCurrentVersionTargets>
<DefaultNetCoreTargetFramework>net5.0</DefaultNetCoreTargetFramework>
</PropertyGroup>
<Import Project="$(SolutionRoot)..\..\eng\Versions.props" />
<Import Project="$(RepoRoot)eng\Versions.props" />
<PropertyGroup>
<!-- Reset version prefix to 1.0.0 for test projects -->
<VersionPrefix>1.0.0</VersionPrefix>
<!-- Working around an issue in XDT transforms -->
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
@ -40,13 +38,14 @@
<_MvcAssemblyName Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib" />
</ItemGroup>
<ItemGroup Condition="$(BuildingTestAppsIndependently) == false">
<ItemGroup Condition="$(BuildingTestAppsIndependently) == 'false'">
<PackageReference Include="Microsoft.Net.Compilers.Toolset"
Version="$(MicrosoftNetCompilersToolsetPackageVersion)"
PrivateAssets="all"
IsImplicitlyDefined="true" />
</ItemGroup>
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" />
<Import Project="After.Directory.Build.props" Condition="Exists('After.Directory.Build.props')" />
</Project>

Просмотреть файл

@ -2,7 +2,7 @@
<Import Project="RazorTest.Introspection.targets" />
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">$(MicrosoftNETCoreApp50PackageVersion)</RuntimeFrameworkVersion>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' ">$(MicrosoftNETCoreAppRuntimeVersion)</RuntimeFrameworkVersion>
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
</PropertyGroup>

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<!--
The AspNetCore repo depends on AspNetCore-Tooling, and we want to avoid creating a cylical dependency between the two
by adding a reference to Microsoft.AspNetCore.App. We'll instead simulate the presence of the reference.
@ -27,7 +23,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -20,7 +16,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
@ -25,7 +21,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
@ -26,7 +22,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -20,7 +16,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -3,9 +3,6 @@
<!--
This project references a shipped version of MVC. It will reference the local build of Tasks but not the compiler or any test shims.
-->
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

Просмотреть файл

@ -3,9 +3,6 @@
<!--
This project references a shipped version of MVC. It will reference the local build of Tasks but not the compiler or any test shims.
-->
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net461</TargetFramework>

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -25,7 +21,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">

Просмотреть файл

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<RazorSdkDirectoryRoot>$(RazorSdkArtifactsDirectory)$(Configuration)\sdk-output\</RazorSdkDirectoryRoot>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
</PropertyGroup>
@ -20,7 +16,7 @@
<PropertyGroup Condition="'$(BinariesRoot)'==''">
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
<BinariesRoot>$(RepositoryRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
<BinariesRoot>$(RepoRoot)artifacts\bin\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\$(Configuration)\netstandard2.0\</BinariesRoot>
</PropertyGroup>
<ItemGroup Condition="'$(BinariesRoot)'!=''">