XFEExtension.NetCore.AutoPath 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package XFEExtension.NetCore.AutoPath --version 1.0.0                
NuGet\Install-Package XFEExtension.NetCore.AutoPath -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XFEExtension.NetCore.AutoPath" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XFEExtension.NetCore.AutoPath --version 1.0.0                
#r "nuget: XFEExtension.NetCore.AutoPath, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XFEExtension.NetCore.AutoPath as a Cake Addin
#addin nuget:?package=XFEExtension.NetCore.AutoPath&version=1.0.0

// Install XFEExtension.NetCore.AutoPath as a Cake Tool
#tool nuget:?package=XFEExtension.NetCore.AutoPath&version=1.0.0                

XFEExtension.NetCore.AutoPath

描述

自动路径创建工具,自动创建不存在的文件夹,对路径统一管理

自动实现路径管理

基础用法
//创建路径管理类
public partial class AppPath
{
    [AutoPath]
    readonly static string myTestPath = "MyTestPath/Test";
    [AutoPath]
    readonly static string mySecTestPath = $"{MyTestPath}/Sec";//路径可以引用自动生成的路径
}


//使用统一管理的路径
class Program
{
    static void Main(string[] args)
    {
        File.WriteAllText($"{AppPath.MyTestPath}/test.txt", "Hello World");//此时如果没有MyTestPath则会自动创建
        var exist = Directory.Exists(AppPath.MySecTestPath);
        Console.WriteLine(exist);//结果为True
    }
}
为路径添加注释
public partial class AppPath
{
    /// <summary>
    /// 测试路径
    /// 这段注释会自动添加至自动生成的Name属性上
    /// </summary>
    [AutoPath]
    readonly static string myTestPath = "MyTestPath/Test";
    [AutoPath]
    readonly static string mySecTestPath = $"{MyTestPath}/Sec";
}
使用部分方法来设置get方法
public partial class AppPath
{
    [AutoPath]
    readonly static string myTestPath = "MyTestPath/Test";
    [AutoPath]
    readonly static string mySecTestPath = $"{MyTestPath}/Sec";

    static partial void GetMyTestPathProperty()
    {
        Console.WriteLine("获取了MyTestPath");
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 131 6/7/2024
1.0.0 112 6/4/2024

First Release