You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add automatic application name extraction from csproj files
- Implemented TryExtractApplicationNameFromProject() to read app name from .csproj
- Searches up to 3 parent directories for project file
- Extracts <AssemblyName> property or falls back to csproj filename
- Applies platform-specific extensions (.exe on Windows, none on Linux/macOS)
- Added test for project file extraction functionality (36/36 tests passing)
- Updated documentation to explain auto-discovery feature
- All tests passing: 61/61 CoreTest, 36/36 ConfiginfoBuilder
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/c#/GeneralUpdate.Common/Shared/Object/ConfiginfoBuilder-Usage.md
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,31 @@ The `ConfiginfoBuilder` class provides a simple and convenient way to create `Co
4
4
5
5
**Design Philosophy**: Inspired by zero-configuration patterns from projects like [Velopack](https://github.com/velopack/velopack), this builder minimizes required configuration while maintaining flexibility through optional fluent setters.
6
6
7
+
## Automatic Configuration Detection
8
+
9
+
The ConfiginfoBuilder implements intelligent zero-configuration by automatically extracting information from your project:
10
+
11
+
### Application Name Auto-Detection
12
+
13
+
The builder automatically attempts to read the application name from your project file (`.csproj`):
14
+
15
+
1.**Searches** for csproj files in the application's directory and up to 3 parent directories
16
+
2.**Extracts** the `<AssemblyName>` property if specified
17
+
3.**Falls back** to the csproj file name if `AssemblyName` is not defined
18
+
4.**Applies** platform-specific extensions (`.exe` on Windows, none on Linux/macOS)
19
+
20
+
**Example:**
21
+
```xml
22
+
<!-- MyApp.csproj -->
23
+
<ProjectSdk="Microsoft.NET.Sdk">
24
+
<PropertyGroup>
25
+
<AssemblyName>MyApplication</AssemblyName>
26
+
</PropertyGroup>
27
+
</Project>
28
+
```
29
+
30
+
When the builder runs, it will automatically use `MyApplication.exe` on Windows or `MyApplication` on Linux/macOS, without any manual configuration needed!
31
+
7
32
## Basic Usage
8
33
9
34
### Minimal Configuration
@@ -26,6 +51,7 @@ var config2 = ConfiginfoBuilder
26
51
.Build();
27
52
28
53
// The config object now has all necessary defaults set based on the platform
54
+
// Application name is automatically detected from your project file!
29
55
```
30
56
31
57
## Platform-Specific Defaults
@@ -34,21 +60,21 @@ The builder automatically detects the runtime platform and sets appropriate defa
34
60
35
61
### Windows Platform
36
62
-**Install Path**: Current application's base directory (via `AppDomain.CurrentDomain.BaseDirectory`)
Copy file name to clipboardExpand all lines: src/c#/GeneralUpdate.Common/Shared/Object/README-ConfiginfoBuilder.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,12 @@ The `ConfiginfoBuilder` class provides a simple, fluent API for creating `Config
6
6
7
7
**Design Inspiration**: The zero-configuration approach is inspired by projects like [Velopack](https://github.com/velopack/velopack), focusing on sensible defaults extracted from the running application with minimal user input required.
8
8
9
+
## Auto-Configuration Features
10
+
11
+
🔍 **Application Name Detection**: Automatically reads from your `.csproj` file
12
+
📂 **Path Extraction**: Uses host program's base directory
13
+
🖥️ **Platform Detection**: Adapts to Windows, Linux, and macOS
14
+
9
15
## Quick Start
10
16
11
17
```csharp
@@ -23,17 +29,18 @@ var config2 = ConfiginfoBuilder
0 commit comments