/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Razor/Directory.Build.targets
158 строк
8 KB
David Wengier
Shape non-official Razor VSIXes for test installs
25 май 2026, 11:26
25 май 2026, 11:26
1ce0d59
Код
Авторство
О чём код?
<?xml version="1.0" encoding="utf-8"?> <Project> <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" /> <Import Project="$(MSBuildThisFileDirectory)eng\targets\RewriteRazorVsixManifest.targets" /> <PropertyGroup> <PackageVersion Condition=" '$(PackageVersion)' == '' ">$(Version)</PackageVersion> </PropertyGroup> <!-- Match Roslyn's non-official CI build shape so correctness rebuild compares unsigned/public-signed artifacts. --> <PropertyGroup Condition="('$(CI)' == 'true' OR '$(ContinuousIntegrationBuild)' == 'true') AND '$(OfficialBuild)' != 'true' AND '$(SignAssembly)' != 'false' AND '$(StrongNameKeyId)' == 'MicrosoftAspNetCore'"> <PublicSign>true</PublicSign> </PropertyGroup> <Target Name="MoveRazorShippingSymbolsPackageToNonShipping" AfterTargets="Pack" Condition="'$(IsPackable)' == 'true' and '$(PackageOutputPath)' != '' and ($([System.String]::Copy('$(PackageOutputPath)').Contains('\Shipping\')) or $([System.String]::Copy('$(PackageOutputPath)').Contains('/Shipping/')))"> <ItemGroup> <_RazorShippingSymbolsPackage Include="$(PackageOutputPath)$(PackageId).$(PackageVersion).symbols.nupkg" Condition="Exists('$(PackageOutputPath)$(PackageId).$(PackageVersion).symbols.nupkg')" /> <_MovedRazorShippingSymbolsPackage Include="@(_RazorShippingSymbolsPackage)"> <TargetPath>$(ArtifactsNonShippingPackagesDir)%(_RazorShippingSymbolsPackage.Filename)%(_RazorShippingSymbolsPackage.Extension)</TargetPath> </_MovedRazorShippingSymbolsPackage> </ItemGroup> <Delete Files="@(_MovedRazorShippingSymbolsPackage->'%(TargetPath)')" Condition="'@(_MovedRazorShippingSymbolsPackage)' != ''" /> <Move SourceFiles="@(_RazorShippingSymbolsPackage)" DestinationFiles="@(_MovedRazorShippingSymbolsPackage->'%(TargetPath)')" Condition="'@(_RazorShippingSymbolsPackage)' != ''"> <Output TaskParameter="DestinationFiles" ItemName="_FilesWritten" /> </Move> </Target> <PropertyGroup> <!-- Disable nullable warnings when targeting anything other than our supported .NET core version(s). This condition will be evaluated multiple times in multi-targeted projects hence need to be careful to only set in the inner builds, not the outer build where only $(TargetFrameworks) is defined. We still check $(TargetFrameworks) for empty though, because for single-targeted builds we want to allow nullable warnings regardless of target framework. --> <DisableNullableWarnings Condition="'$(DisableNullableWarnings)' == '' AND '$(TargetFrameworks)' != '' AND '$(TargetFramework)' != '' AND '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">true</DisableNullableWarnings> </PropertyGroup> <PropertyGroup Condition="'$(DisableNullableWarnings)' == 'true'"> <NoWarn>$(NoWarn);Nullable</NoWarn> </PropertyGroup> <!-- Global Analyzer Config --> <ItemGroup> <!-- Always include Common.globalconfig --> <EditorConfigFiles Include="$(MSBuildThisFileDirectory)Common.globalconfig" /> <!-- Include Shipping.globalconfig for shipping projects --> <EditorConfigFiles Condition="'$(IsShipping)' == 'true'" Include="$(MSBuildThisFileDirectory)Shipping.globalconfig" /> <!-- Include NonShipping.globalconfig for non-shipping projects, except for API shims --> <EditorConfigFiles Condition="'$(IsShipping)' != 'true' AND '$(IsApiShim)' != 'true'" Include="$(MSBuildThisFileDirectory)NonShipping.globalconfig" /> <!-- Include ApiShim.globalconfig for API shim projects --> <EditorConfigFiles Condition="'$(IsApiShim)' == 'true'" Include="$(MSBuildThisFileDirectory)ApiShim.globalconfig" /> </ItemGroup> <!-- Where necessary, do not pretend we support iOS or Android. This file is imported after project has a chance to set $(RemoveDevicePlatformSupport) and long after @(SupportedPlatforms) is initialized. --> <ItemGroup Condition=" '$(RemoveDevicePlatformSupport)' == 'true' "> <SupportedPlatform Remove="Android" /> <SupportedPlatform Remove="iOS" /> </ItemGroup> <!-- We provide a simple mechanism for including NetFx-only files. If a C# file should only be compiled under NetFx, it can be named with a ".NetFx.cs" extension. Or, the file can be included in a folder called "NetFx" or has a name that ends in "_NetFx". --> <ItemGroup Condition="'$(TargetFramework)' != '$(NetFxVS)'"> <Compile Remove="**\*.NetFx.cs" /> <Compile Remove="**\NetFx\**\*.*" /> <Compile Remove="**\*_NetFx\**\*.*" /> <None Include="**\*.NetFx.cs" /> <None Include="**\NetFx\**\*.*" /> <None Include="**\*_NetFx\**\*.*" /> </ItemGroup> <!-- We provide a simple mechanism for including NetCore-only files. If a C# file should only be compiled under NetCore, it can be named with a ".NetCore.cs" extension. Or, the file can be included in a folder called "NetCore" or has a name that ends in "_NetCore". --> <ItemGroup Condition="'$(TargetFramework)' != '$(NetVS)' AND '$(TargetFramework)' != '$(NetVSCode)' AND '$(TargetFramework)' != '$(NetCurrent)' AND '$(TargetFramework)' != '$(NetPrevious)'"> <Compile Remove="**\*.NetCore.cs" /> <Compile Remove="**\NetCore\**\*.*" /> <Compile Remove="**\*_NetCore\**\*.*" /> <None Include="**\*.NetCore.cs" /> <None Include="**\NetCore\**\*.*" /> <None Include="**\*_NetCore\**\*.*" /> </ItemGroup> <Target Name="GetCustomAssemblyAttributes" BeforeTargets="GetAssemblyAttributes" Condition=" '$(MSBuildProjectExtension)' == '.csproj' " DependsOnTargets="InitializeSourceControlInformation"> <ItemGroup> <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(Serviceable)' == 'true'"> <_Parameter1>Serviceable</_Parameter1> <_Parameter2>True</_Parameter2> </AssemblyAttribute> </ItemGroup> </Target> <!-- RestrictedInternalsVisibleTo --> <ItemDefinitionGroup> <RestrictedInternalsVisibleTo> <Visible>false</Visible> </RestrictedInternalsVisibleTo> </ItemDefinitionGroup> <ItemGroup> <InternalsVisibleTo Include="@(RestrictedInternalsVisibleTo)" Key="%(Key)" /> </ItemGroup> <Target Name="PrepareGenerateRestrictedInternalsVisibleTo" BeforeTargets="PrepareGenerateInternalsVisibleToFile" Condition="'@(RestrictedInternalsVisibleTo)' != ''"> <ItemGroup> <_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.RestrictedInternalsVisibleToAttribute"> <_Parameter1>%(RestrictedInternalsVisibleTo.Identity)</_Parameter1> <_Parameter2 Condition="'%(RestrictedInternalsVisibleTo.Namespace)' != ''">%(RestrictedInternalsVisibleTo.Namespace)</_Parameter2> </_InternalsVisibleToAttribute> </ItemGroup> <Warning Condition="'%(RestrictedInternalsVisibleTo.Partner)' == '' and '%(RestrictedInternalsVisibleTo.Namespace)' == ''" Text="RestrictedInternalsVisibleTo items must specify the 'Partner' or 'Namespace' attribute. Target assembly: %(Identity)" /> </Target> <Target Name="CopyRazorTestAssetsToOutput" AfterTargets="Build" Condition="'$(TargetFramework)' != '' and '$(TargetDir)' != '' and ('$(IsUnitTestProject)' == 'true' or '$(IsIntegrationTestProject)' == 'true')"> <ItemGroup> <_RazorTestFilesToOutput Include="$(MSBuildProjectDirectory)\**\TestFiles\**\*" Exclude="$(MSBuildProjectDirectory)\bin\**\*;$(MSBuildProjectDirectory)\obj\**\*" /> <_RazorRepositoryFilesToOutput Include="$(RepositoryRoot)..\..\eng\targets\RazorServices.props" Condition="Exists('$(RepositoryRoot)..\..\eng\targets\RazorServices.props')"> <TargetPath>eng\targets\RazorServices.props</TargetPath> </_RazorRepositoryFilesToOutput> </ItemGroup> <Copy SourceFiles="@(_RazorTestFilesToOutput)" DestinationFiles="@(_RazorTestFilesToOutput->'$(TargetDir)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" Condition="'@(_RazorTestFilesToOutput)' != ''"> <Output TaskParameter="CopiedFiles" ItemName="FileWrites" /> </Copy> <Copy SourceFiles="@(_RazorRepositoryFilesToOutput)" DestinationFiles="@(_RazorRepositoryFilesToOutput->'$(TargetDir)%(TargetPath)')" SkipUnchangedFiles="true" Condition="'@(_RazorRepositoryFilesToOutput)' != ''"> <Output TaskParameter="CopiedFiles" ItemName="FileWrites" /> </Copy> </Target> </Project>