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.
<PackageVersion Include="XFEExtension.NetCore.AutoPath" Version="1.0.1" />
<PackageReference Include="XFEExtension.NetCore.AutoPath" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XFEExtension.NetCore.AutoPath --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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.
#:package XFEExtension.NetCore.AutoPath@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XFEExtension.NetCore.AutoPath&version=1.0.1
#tool nuget:?package=XFEExtension.NetCore.AutoPath&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 (1)
Showing the top 1 NuGet packages that depend on XFEExtension.NetCore.AutoPath:
Package | Downloads |
---|---|
XFEExtension.NetCore.WinUIHelper
WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目 |
GitHub repositories
This package is not used by any popular GitHub repositories.
更新项目类型和元素值,删除属性和元素
在`PathPropertyAutoGenerator.cs`文件中,删除了`Options`属性的`ProfileInstanceAttribute`属性列表。在`XFEExtension.NetCore.AutoPath.sln`解决方案文件中,项目类型已从旧的项目系统迁移到新的项目系统。在`XFEExtension.NetCore.AutoPath.csproj`项目文件中,进行了一系列更改,包括更新`Title`元素的值,删除`PackageProjectUrl`和`RepositoryUrl`元素,更新`PackageTags`元素的值,并添加了新的`Version`元素。