XFEExtension.NetCore.AutoPath 1.0.1

dotnet add package XFEExtension.NetCore.AutoPath --version 1.0.1
NuGet\Install-Package XFEExtension.NetCore.AutoPath -Version 1.0.1
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.1" />
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.1
#r "nuget: XFEExtension.NetCore.AutoPath, 1.0.1"
#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.1

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

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 71 6/7/2024
1.0.0 74 6/4/2024

更新项目类型和元素值,删除属性和元素

在`PathPropertyAutoGenerator.cs`文件中,删除了`Options`属性的`ProfileInstanceAttribute`属性列表。在`XFEExtension.NetCore.AutoPath.sln`解决方案文件中,项目类型已从旧的项目系统迁移到新的项目系统。在`XFEExtension.NetCore.AutoPath.csproj`项目文件中,进行了一系列更改,包括更新`Title`元素的值,删除`PackageProjectUrl`和`RepositoryUrl`元素,更新`PackageTags`元素的值,并添加了新的`Version`元素。