ProjectInformation 1.0.2
dotnet add package ProjectInformation --version 1.0.2
NuGet\Install-Package ProjectInformation -Version 1.0.2
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="ProjectInformation" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProjectInformation" Version="1.0.2" />
<PackageReference Include="ProjectInformation" />
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 ProjectInformation --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ProjectInformation, 1.0.2"
#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 ProjectInformation@1.0.2
#: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=ProjectInformation&version=1.0.2
#tool nuget:?package=ProjectInformation&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DotNetProjectInformation
A utility library to extract project configuration and package dependencies from .NET projects.
๐ Description
DotNetProjectInformation is a reusable utility library designed for .NET 8 / .NET Standard 2.1+ projects. It helps developers:
- ๐ Read settings from
appsettings.json
- ๐งฑ Inspect assembly/project metadata
- ๐ฆ Extract all installed NuGet packages
- ๐ Detect
.csproj
files recursively in a solution - ๐ ๏ธ Print referenced assemblies
๐ Features
ConfigurationReader
: Read values fromappsettings.json
by key or print all settings.AssemblyInfoHelper
: Get the current assembly name and target framework.PackageInspector
: Inspect all referenced NuGet packages for each project.ProjectConfigFetcher
: Access configuration settings using a simplified wrapper.DependencyFetcher
: Print referenced assembly names from the current context.
๐ฆ Dependencies
Dependencies shown below are used in the sample:
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.Configuration.Json
- Microsoft.Extensions.Configuration.EnvironmentVariables
- Microsoft.Extensions.Configuration.FileExtensions
- Microsoft.Extensions.Configuration.Binder
- Newtonsoft.Json
๐งช Sample Usage
Sample File: SampleExampleConsoleProjectInformation.cs
using ProjectInformation;
using Service = ProjectInformation.Services;
using Utils = ProjectInformation.Utils;
using System;
namespace TestPackageWithConsole
{
public class Program
{
public static void Main()
{
Console.WriteLine("Hello, World!");
//generating information from all projects
var solutionRoot = @"F:\DefaultFolder\DotNet8Services"; // or wherever your projects are
//some points with knowledge of project.
//1. Getting specific information from Appsettings.json
//2. Getting all environment variables information.
//3. Getting all information from AssemblyInfo.cs
//4. Getting all framework information from AssemblyInfo.cs
//5. Getting all project information from csproj file.
//6. Getting all project information from all projects in the solution.
//7. Getting all project information from all projects in the solution with specific packages.
//8. Getting all project information from all projects in the solution with specific references
bool running = true;
while (running)
{
Console.Clear();
Console.WriteLine("=== Simple Console Menu ===");
Console.WriteLine("1. Getting specific information from Appsettings.json");
Console.WriteLine("2. Getting all environment variables information.");
Console.WriteLine("3. Getting all information from AssemblyInfo.cs");
Console.WriteLine("4. Getting all framework information from AssemblyInfo.cs");
Console.WriteLine("5. Getting all project information from csproj file.");
Console.WriteLine("6. Getting all project information from all projects in the solution.");
Console.WriteLine("7. Getting specific packages.");
Console.WriteLine("8. Getting specific references.");
Console.WriteLine("0. Exit.");
Console.Write("Enter your project path : ");
solutionRoot = Console.ReadLine() ?? solutionRoot;
Console.Write("Choose an option (1-8): ");
string? input = Console.ReadLine();
switch (input)
{
case "1":
MainProcessCalled.GetSpecificInformationFromAppsettings(solutionRoot, "", "MyApp");
Thread.Sleep(500);
Console.ReadKey();
break;
case "2":
MainProcessCalled.GetAllEnvironmentVariables();
Thread.Sleep(1000);
Console.ReadKey();
break;
case "3":
MainProcessCalled.GetAllInformationFromAssemblyInfo();
Thread.Sleep(1000);
Console.ReadKey();
break;
case "4":
MainProcessCalled.GetAllFrameworkInformationFromAssemblyInfo();
Thread.Sleep(1000);
Console.ReadKey();
break;
case "5":
MainProcessCalled.GetAllProjectInformationFromCsproj(solutionRoot);
Thread.Sleep(1000);
Console.ReadKey();
break;
case "6":
MainProcessCalled.GetAllProjectInformationFromAllProjectsInSolution(solutionRoot);
Thread.Sleep(1000);
Console.ReadKey();
break;
case "7":
MainProcessCalled.GetAllProjectInformationFromAllProjectsInSolutionWithSpecificPackage(solutionRoot);
Thread.Sleep(1000);
Console.ReadKey();
break;
case "8":
MainProcessCalled.GetAllProjectInformationFromAllProjectsInSolutionWithSpecificReferences(solutionRoot);
Thread.Sleep(1000);
Console.ReadKey();
break;
case "0":
running = false;
Console.WriteLine("Exiting...");
Thread.Sleep(1000);
break;
default:
Console.WriteLine("Invalid option. Press any key to try again.");
Console.ReadKey();
break;
}
}
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration (>= 9.0.3)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.3)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.3)
- Microsoft.Extensions.Configuration.Json (>= 9.0.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.Configuration.ConfigurationManager (>= 9.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.