Net4x.ProjectFormat.Library
1.0.0.26250
dotnet add package Net4x.ProjectFormat.Library --version 1.0.0.26250
NuGet\Install-Package Net4x.ProjectFormat.Library -Version 1.0.0.26250
<PackageReference Include="Net4x.ProjectFormat.Library" Version="1.0.0.26250" />
<PackageVersion Include="Net4x.ProjectFormat.Library" Version="1.0.0.26250" />
<PackageReference Include="Net4x.ProjectFormat.Library" />
paket add Net4x.ProjectFormat.Library --version 1.0.0.26250
#r "nuget: Net4x.ProjectFormat.Library, 1.0.0.26250"
#:package Net4x.ProjectFormat.Library@1.0.0.26250
#addin nuget:?package=Net4x.ProjectFormat.Library&version=1.0.0.26250
#tool nuget:?package=Net4x.ProjectFormat.Library&version=1.0.0.26250
Net4x.ProjectFormat.Library
Converts old format (pre VS2017) MSBuild projects to the SDK style format, and reads either format as an object model you can query.
Give it a solution, a project, or a text file listing projects; it reads every project, works out what
the SDK gives you for free, and rewrites the project keeping only what is genuinely yours — the
package references taken from packages.config, the assembly metadata taken from AssemblyInfo.cs,
the package metadata taken from a .nuspec, the conditional property groups, and the items that a
wildcard cannot express.
Targets net35, net40, net45, net461 and netstandard2.0.
Install
dotnet add package Net4x.ProjectFormat.Library
Convert
using ProjectsFormatLibrary;
using ProjectsFormatLibrary.Processing;
// Convert every project of a solution, rewriting each project file in place.
var projects = ConversionProcessor.GetInstance()
.ProcessSolutionOrProjects(@"C:\src\MySolution.sln", writeProjectInNewFormat: true);
foreach (var project in projects.Values)
{
Console.WriteLine($"{project.AssemblyName} -> {string.Join(";", project.GetTargetFrameworks())}");
}
ProcessSolutionOrProjects accepts a .sln, a single project file, or a text file holding one project
path per line. Pass writeProjectInNewFormat: false to read the projects without touching them.
Every project file that is rewritten is backed up first, next to the original.
Read without converting
var project = ProjectProcessor.Instance.ProcessProject(@"C:\src\MyLibrary\MyLibrary.csproj");
project.AssemblyName; // from the project, or from the file name
project.GetTargetFrameworks(); // "v4.6.1" becomes "net461"
project.GetVersion(); // from AssemblyInfo.cs, or from <Version>
project.IsProjectInNewFormat(); // true for an SDK style project
project.IsTestProject();
project.GetReferencedPackages(); // packages.config or PackageReference, whichever applies
project.GetProjectOutputFileName(project.GetProjectOutputDirectory("Release"));
The same object model answers for both formats, so you do not have to branch on the project format yourself.
Other entry points:
| Type | Use |
|---|---|
ConversionProcessor.GetInstance() |
convert a solution, a project, or a list of projects |
ProjectProcessor.Instance |
read or convert a single project |
SolutionHelper.Instance |
list the projects and the configurations of a solution |
XmlHelper.Instance |
concatenate property groups, read package elements |
ConfigurationUtility |
read and write every setting listed below |
Settings
Settings are read from the command line, from the application configuration, and from the defaults
shipped with the package — in that order. Set them in code through ConfigurationUtility:
ConfigurationUtility.Configuration = "Release";
ConfigurationUtility.FoldersToExclude = new[] { "packages", "obj", "bin", ".vs" };
| Setting | Meaning | Default |
|---|---|---|
Configuration |
configuration whose output path is read | Release |
Platform |
platform whose output path is read | AnyCpu |
PackagesDirectory |
packages folder of an old format project | ..\packages |
ProjectsExtensions |
extensions treated as a project file | .vbproj\|.csproj\|.wixproj |
FileTypesToInclude |
wildcards the SDK compiles for you | *.cs\|*.vb |
FoldersToExclude |
folders never scanned for project files | packages\|obj\|bin\|.vs |
FilesToRemove |
files the converted project must stop referencing | packages.config\|AssemblyInfo.cs |
IncompatibleAssemblies |
a project referencing one of these is left alone | system.xaml\|system.baseframework\|system.windows.forms |
WildcardsToInclude |
extra extensions to keep as project items | none |
SettingsToEdit |
configuration renames, as from=to |
none |
FilesToProcess |
files handed to a patcher, as file\|assembly\|class |
none |
ProjectsToPatch |
projects handed to a patcher, as file\|assembly\|class |
none |
DontAllowTargetFrameworkToOutputPath |
keep the output path free of the target framework | false |
RemovePackagesAsAssemblyReference |
keep a package as an assembly reference too | false |
Separators. A setting whose entries cannot contain | is separated by |. A setting whose entries
contain | themselves — FilesToProcess, ProjectsToPatch, SettingsToEdit, WildcardsToInclude —
is separated by ;:
ConfigurationUtility.SettingsToEdit = new[] { "Debug32|AnyCPU=Debug|AnyCPU", "Release64=Release|AnyCPU" };
Patching a file while it is converted
Implement IPatcher to edit a file, or to veto the conversion of a project, while it is being
converted. The library loads your type by assembly and class name, so it needs a public parameterless
constructor:
public class AppConfigPatcher : IPatcher
{
public bool PatchFile(string sourceFile, Project project, XElement projectNode)
{
// projectNode is the SDK style project about to be written.
projectNode.Add(new XElement("PropertyGroup", new XElement("LangVersion", "latest")));
return true; // false leaves the project untouched
}
}
ConfigurationUtility.ProjectsToPatch = new[] { "*.csproj|MyPatchers|MyPatchers.AppConfigPatcher" };
ConfigurationUtility.FilesToProcess = new[] { "App.config|MyPatchers|MyPatchers.AppConfigPatcher" };
ProjectsToPatch matches the project file — by name, or by a * suffix wildcard. FilesToProcess
matches any other file of the project folder. A patcher that cannot be loaded is logged and skipped;
it never fails the conversion.
What stops a conversion
A project is read but left on disk unchanged when it declares a XamlAppDef item, or when it
references one of the IncompatibleAssemblies. A .wixproj (output type Package) is recognised as
an installer and read no further.
License
Copyright (c) Piero Viano. All rights reserved.
| 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- Net4x.IoCLibrary (>= 1.8.0.3)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
-
.NETFramework 4.0
- Net4x.IoCLibrary (>= 1.8.0.3)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
-
.NETFramework 4.5
- Net4x.IoCLibrary (>= 1.8.0.3)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
-
.NETFramework 4.6.1
- Net4x.IoCLibrary (>= 1.8.0.3)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
-
.NETStandard 2.0
- Net4x.IoCLibrary (>= 1.8.0.3)
- Net4x.UtilityLibrary (>= 1.5.1.26236)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Net4x.ProjectFormat.Library:
| Package | Downloads |
|---|---|
|
Net4x.InstallerLibrary
Installer Library |
|
|
Net4x.UnitTestsLibraryTool
UnitTest Library Tool |
|
|
Net4x.UnitTestLibrary
UnitTest Library |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0.26250 | 101 | 9/7/2026 |
| 1.0.0 | 469 | 4/2/2025 |