Skip to content

Support building System.DirectoryServices ref assembly against net5.0 #39401

@jeffhandley

Description

@jeffhandley

For dotnet/designs#139, I need to be able to mark 2 types in System.DirectoryServices as [Obsolete] starting in .NET 5: DirectoryServicesPermission and DirectoryServicesPermissionAttribute.

At present, the src project has the following:

<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;netstandard2.0;netcoreapp2.0-Windows_NT;_$(NetFrameworkCurrent)</TargetFrameworks>

And the ref assembly has simply:

<TargetFrameworks>netstandard2.0;_$(NetFrameworkCurrent)</TargetFrameworks>

I can conditionally add the attributes to the src project, but I cannot currently add the attributes to the ref assembly without also affecting netstandard2.0.

I attempted to add $(NetCoreAppCurrent) into the target frameworks for the ref assembly but that produced the following build errors that I was unable to overcome:

System.DirectoryServices.cs(61,73): error CS0115: 'ActiveDirectorySecurity.AccessRuleFactory(IdentityReference, int, bool, InheritanceFlags, PropagationFlags, AccessControlType, Guid, Guid)': no suitable method found to override [C:\Users\jeffhand\git\dotnet\runtime\src\libraries\System.DirectoryServices\ref\System.DirectoryServices.csproj]
System.DirectoryServices.cs(65,72): error CS0115: 'ActiveDirectorySecurity.AuditRuleFactory(IdentityReference, int, bool, InheritanceFlags, PropagationFlags, AuditFlags, Guid, Guid)': no suitable method found to override [C:\Users\jeffhand\git\dotnet\runtime\src\libraries\System.DirectoryServices\ref\System.DirectoryServices.csproj]
CSC : error CS0012: The type 'CLSCompliantAttribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [C:\Users\jeffhand\git\dotnet\runtime\src\libraries\System.DirectoryServices\ref\System.DirectoryServices.csproj]

The AccessRuleFactory AuditRuleFactory methods that are expressed as not being found seem to be available in netstandard2.0 as far as I could tell, and they're shown on the .NET API Catalog too. I can't figure out why they're not visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-librariesquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions