提交 ebd2fb79 编写于 作者: S Sam Harwell

Define RestrictedInternalsVisibleToAttribute

See dotnet/roslyn-analyzers#2498
上级 1e8d4d20
...@@ -228,6 +228,29 @@ ...@@ -228,6 +228,29 @@
<None Include="$(MSBuildThisFileDirectory)\..\..\src\Setup\PowerShell\uninstall.ps1" PackagePath="tools\uninstall.ps1" Visible="false" Pack="true"/> <None Include="$(MSBuildThisFileDirectory)\..\..\src\Setup\PowerShell\uninstall.ps1" PackagePath="tools\uninstall.ps1" Visible="false" Pack="true"/>
</ItemGroup> </ItemGroup>
<!-- 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.Partner)' != ''">Microsoft.CodeAnalysis.ExternalAccess.%(RestrictedInternalsVisibleTo.Partner)</_Parameter2>
<_Parameter2 Condition="'%(RestrictedInternalsVisibleTo.Partner)' == ''">Microsoft.CodeAnalysis.ExternalAccess.UnknownPartner</_Parameter2>
</_InternalsVisibleToAttribute>
</ItemGroup>
</Target>
<!-- <!--
Ensure TargetFrameworkMonikerAssemblyAttributeText is treated as auto-generated Ensure TargetFrameworkMonikerAssemblyAttributeText is treated as auto-generated
--> -->
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class RestrictedInternalsVisibleToAttribute : Attribute
{
public RestrictedInternalsVisibleToAttribute(string assemblyName, params string[] allowedNamespaces)
{
AssemblyName = assemblyName;
AllowedNamespaces = allowedNamespaces.ToImmutableArray();
}
public string AssemblyName { get; }
public ImmutableArray<string> AllowedNamespaces { get; }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册