Skip to content

Multi-target-framework support #334

@rkoeninger

Description

@rkoeninger

There are a lot of #if NET40 ... #endif found in the code. These surround IO functions that are available in .NET Framework >= 4.0, but were not available in .NET Standard 1.0 < 2.0.

Some of these are now available in .NET Standard 2.0, but are not supported by the library, so the directive could be changed to #if ! netstandard1.4 or whatever the exact naming would be.

Framework-specific methods could be made adjacent, or event moved to their own file using partial classes. For example, remove the 4 methods in #if's from MockFileInfo.cs and add a file called MockFileInfo.net40.cs containing something like this:

#if NET40

namespace System.IO.Abstractions.TestingHelpers
{
    public partial class MockFileInfo
    {
        public override void Decrypt() { ... }
        public override void Encrypt() { ... }
        public override FileInfoBase Replace(string x, string y) { ... }
        public override FileInfoBase Replace(string x, string y, bool z) { ... }
    }
}

#endif

Not sure what the name would be if it was for net40 and netstandard2.0, or not for netstandard1.4, however you represent it. Wouldn't want to have 2 separate files or blocks with the same thing in it.

Need to do a survey of methods and see what's supported in netstandard2.0 compared to netstandard1.4 and net40. Might be some in netstandard2.0 but not net40. look at the diff files here.


Don't know if this is an issue, but the libraries are build for net40;netstandard1.4;netstandard2.0;, but the TestHelpers.Tests project targets net40;netcoreapp2.0, leaving out Core 1.4. Brief reading makes it sound like all 3 should target standard instead of core, since all 3 are libraries?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues that address the core abstractions & the wrapperstype: enhancementIssues that propose new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions