Atc.DotNet
3.0.174
dotnet add package Atc.DotNet --version 3.0.174
NuGet\Install-Package Atc.DotNet -Version 3.0.174
<PackageReference Include="Atc.DotNet" Version="3.0.174" />
<PackageVersion Include="Atc.DotNet" Version="3.0.174" />
<PackageReference Include="Atc.DotNet" />
paket add Atc.DotNet --version 3.0.174
#r "nuget: Atc.DotNet, 3.0.174"
#:package Atc.DotNet@3.0.174
#addin nuget:?package=Atc.DotNet&version=3.0.174
#tool nuget:?package=Atc.DotNet&version=3.0.174
Atc.DotNet
Target Framework: net9.0, net10.0
Programmatic interface to dotnet.exe and utilities for parsing .NET project files. Provides helpers for executing dotnet commands, analyzing project structure, and extracting metadata from solution and project files.
Why Use This Library?
Automating .NET build processes and analyzing project files requires executing dotnet.exe and parsing project XML. Atc.DotNet simplifies this by providing:
- DotnetHelper: Locate and execute dotnet.exe programmatically
- DotnetBuildHelper: Build projects and collect compilation errors
- DotnetCsProjFileHelper: Parse and analyze .csproj files
- DotnetNugetHelper: Extract NuGet package references
- VisualStudioSolutionFileHelper: Parse .sln files and extract metadata
- Project Type Detection: Identify console apps, libraries, test projects, etc.
Perfect for:
- Build automation tools
- Code generators analyzing project structure
- CI/CD pipeline utilities
- DevOps tooling for .NET projects
- Project scaffolding and templates
- Dependency analysis tools
Installation
dotnet add package Atc.DotNet
Target Framework
- .NET 9.0
Key Features
- Locate dotnet.exe installation directory and executable
- Execute dotnet build with error collection
- Parse .csproj files and extract project type
- Extract NuGet package references from projects
- Parse Visual Studio solution files
- Detect project types (Console, Library, Web, Test, etc.)
- Analyze project dependencies
- Support for both file-based and content-based parsing
Requirements
Key Dependencies
- Atc (foundation library)
Main Components
DotnetHelper
Utilities for locating and working with dotnet.exe:
GetDotnetDirectory(): Finds the dotnet installation directoryGetDotnetExecutable(): Gets the full path to dotnet.exe
DotnetBuildHelper
Build automation and error collection:
BuildAndCollectErrors(): Builds project and returns compilation errors
DotnetCsProjFileHelper
Project file analysis:
PredictProjectType(): Determines project type with file analyticsGetProjectType(): Determines project type from .csproj content
DotnetNugetHelper
NuGet package analysis:
GetAllPackageReferences(): Extracts all package references from project
VisualStudioSolutionFileHelper
Solution file parsing:
GetSolutionFileMetadata(): Extracts metadata from .sln files
Code documentation
DotnetHelper examples
Using GetDotnetDirectory() to find the directory path of dotnet.exe / dotnet - depends on the operating system
DirectoryInfo dotnetDirectory = DotnetHelper.GetDotnetDirectory();
Using GetDotnetExecutable() to find the file path of dotnet.exe / dotnet - depends on the operating system
FileInfo dotnetFile = DotnetHelper.GetDotnetExecutable();
DotnetBuildHelper examples
Using BuildAndCollectErrors(..) to build and collect errors
This method build and collect errors if any - 0 errors is the same as a successful build.
Dictionary<string, int> buildErrors = await DotnetBuildHelper.BuildAndCollectErrors(workingDirectory);
var workingDirectory = new DirectoryInfo(@"c:\code\myproject");
var runNumber = 5;
var buildFile = new FileInfo(@"c:\code\myproject\mylib.csproj"),
var useNugetRestore = true,
var useConfigurationReleaseMode = true,
var timeoutInSec = 20,
var logPrefix = "BUILD-PREFIX";
var cancellationToken = CancellationToken.None;
Dictionary<string, int> buildErrors = await DotnetBuildHelper.BuildAndCollectErrors(
workingDirectory,
runNumber,
buildFile,
useNugetRestore,
useConfigurationReleaseMode,
timeoutInSec,
logPrefix,
cancellationToken);
DotnetCsProjFileHelper examples
Using PredictProjectType(..) to find the DotnetProjectType in a file
var file = new FileInfo(@"c:\code\myproject\mylib.csproj"),
DotnetProjectType projectType = DotnetCsProjFileHelper.PredictProjectType(file);
Note: PredictProjectType use GetProjectType but extend the determinations with surrounded files analytics as looking into the Program.cs.
Using GetProjectType(..) to find the DotnetProjectType in a file or file-content
var file = new FileInfo(@"c:\code\myproject\mylib.csproj"),
DotnetProjectType projectType = DotnetCsProjFileHelper.GetProjectType(file);
DotnetNugetHelper examples
Using GetAllPackageReferences(..) to find package-references in a file or file-content
var file = new FileInfo(@"c:\code\myproject\mylib.csproj"),
List<DotnetNugetPackageMetadataBase> packages = DotnetNugetHelper.GetAllPackageReferences(file);
var file = new FileInfo(@"c:\code\myproject\mylib.csproj"),
var fileContent = File.ReadAllText(file.FullName);
List<DotnetNugetPackageMetadataBase> packages = DotnetNugetHelper.GetAllPackageReferences(fileContent);
VisualStudioSolutionFileHelper examples
Using GetSolutionFileMetadata(..) to find VisualStudio metadata in a file or file-content
var file = new FileInfo(@"c:\code\myproject\mylib.sln"),
VisualStudioSolutionFileMetadata metadata = VisualStudioSolutionFileHelper.GetSolutionFileMetadata(file);
var file = new FileInfo(@"c:\code\myproject\mylib.sln"),
var fileContent = File.ReadAllText(file.FullName);
VisualStudioSolutionFileMetadata metadata = VisualStudioSolutionFileHelper.GetSolutionFileMetadata(file);
Contributing
Contributions are welcome! Please see the main repository README for contribution guidelines.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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 is compatible. 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. |
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Atc.DotNet:
| Package | Downloads |
|---|---|
|
Atc.Rest.ApiGenerator
Atc.Rest.ApiGenerator is a WebApi C# code generator using a OpenApi 3.0.x specification YAML file. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.174 | 43 | 6/24/2026 |
| 3.0.173 | 47 | 6/24/2026 |
| 3.0.172 | 47 | 6/24/2026 |
| 3.0.67 | 322 | 4/25/2026 |
| 3.0.46 | 175 | 4/15/2026 |
| 3.0.45 | 117 | 4/10/2026 |
| 3.0.44 | 112 | 4/9/2026 |
| 3.0.43 | 113 | 4/9/2026 |
| 3.0.41 | 113 | 4/9/2026 |
| 3.0.40 | 115 | 4/9/2026 |
| 3.0.18 | 501 | 2/9/2026 |
| 3.0.16 | 650 | 12/15/2025 |
| 3.0.12 | 296 | 11/28/2025 |
| 3.0.9 | 472 | 11/21/2025 |
| 3.0.8 | 378 | 11/14/2025 |
| 3.0.4 | 325 | 11/6/2025 |
| 2.0.562 | 481 | 9/4/2025 |
| 2.0.561 | 343 | 9/4/2025 |
| 2.0.560 | 324 | 9/3/2025 |
| 2.0.558 | 292 | 8/22/2025 |