An attempt to provide .NET Framework 4.x Developer Packs (SDKs) support for modern Visual Studio / MSBuild / etc.
- Various modes;
- Rollback support (changes can be easily undone at any time);
- Pure batch-script;
- Portable and flexible solution;
- Free and Open source https://github.com/3F/netfx4sdk
Copyright (c) 2021-2025 Denis Kuzmin <x-3F@outlook.com> github/3F
gnt
~netfx4sdk
netfx4sdk allows you to easily use the legacy (deprecated) SDK for modern toolsets and IDEs such as VS2022+ / MSBuild 17+ / and other tools without installing any other outdated versions of Visual Studio.
Because Microsoft officially dropped support of the Developer Pack (SDK) for .NET Framework 4.0. Now it can only be a Runtime version: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks
Means you can't simply build anything along with pure VS2022 (e.g. VM image, clean VS2022 env)
MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can (*no, you can't) download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
But netfx4sdk will try to eliminate this artificial limitation by a single command,
- Here's result using netfx4sdk 1.0 for the same clean VS2022 VM image above.
-mode sys
Hack using assemblies for Windows. Highly recommended because:
- [++] All modules are under Windows support.
- [+] It does not require internet connection (portable).
- [+] No decompression required (faster) compared to package mode.
- [-] This is behavior-based hack;
-mode pkg
will try to apply remote package to the environment.
- [-] Officially dropped support since VS2022.
- [-] Requires internet connection to receive ~30 MB via GetNuTool.
- [-] Requires decompression of received data to 178 MB before use.
- [+] Well known official behavior.
-mode {value}
* system - (Recommended) Hack using assemblies for Windows.
* package - Apply remote package. Read [About modes] below.
* sys - Alias to 'system'.
* pkg - Alias to 'package'.
* system-or-package - Fallback to 'system'. Use 'package' if 'system' failed.
* package-or-system - Fallback to 'package'. Use 'system' if 'package' failed.
* sys-or-pkg - Alias to 'system-or-package'.
* pkg-or-sys - Alias to 'package-or-system'.
-tfm {version}
* 4.0 - Process for .NET Framework 4.0 (default)
* 2.0, 3.5, 4.5, 4.6, 4.7, 4.8
* 4.5.1, 4.5.2, 4.6.1, 4.6.2, 4.7.1, 4.7.2, 4.8.1
-force - Aggressive behavior when applying etc.
-rollback - Rollback applied modifications.
-global - To use the global toolset, like hMSBuild.
-no-mklink - Use direct copying instead of mklink (junction / symbolic).
-stub - Use a stub instead of actual processing.
-pkg-version {arg} - Specific package version in pkg mode. Where {arg}:
* 1.0.3 ...
* latest - (keyword) To use latest version;
-debug - To show debug information.
-version - Display version of netfx4sdk.cmd.
-help - Display this help. Aliases: -help -h -?
netfx4sdk -mode sys
netfx4sdk -rollback
netfx4sdk -debug -force -mode package
netfx4sdk -mode pkg -pkg-version 1.0.2
netfx4sdk -mode pkg -tfm 4.5
netfx4sdk -global -mode pkg -tfm 3.5 -no-mklink -force
call netfx4sdk -mode sys || call netfx4sdk -mode pkg
netfx4sdk -mode sys-or-pkg
- Using GetNuTool:
gnt
~netfx4sdk
- Using hMSBuild:
hMSBuild
-GetNuTool ~netfx4sdk
- GitHub Releases: https://github.com/3F/netfx4sdk/releases/latest
git clone https://github.com/3F/netfx4sdk.git src
cd src & build & cd bin\Release\raw\
netfx4sdk -help
netfx4sdk releases are now accompanied by a .sha1 file in the official distribution; At the same time, commits from which releases are published are signed with the committer's verified signature (GPG).
Make sure you are using official, unmodified, safe versions.
Note: .sha1 file is a text list of published files with checksums in the format:
40-hexadecimal-digits
<space>
file
e9e533b0da8e5546eff821a40fbf7ca20ab9cf7e path\file
...
Since netfx4sdk.cmd relies on the hMSBuild and GetNuTool, you can validate it like:
hMSBuild -GetNuTool ~& svc.gnt -sha1-cmp netfx4sdk.cmd sha1 -package-as-path
or
gnt ~& svc.gnt -sha1-cmp netfx4sdk.cmd sha1 -package-as-path
Where sha1 is the checksum from the official distribution.
Or, the official package (gnt +netfx4sdk
) provides validate.hMSBuild.bat; this is wrapper of the command above.
How safe is it?
netfx4sdk is waiting for your awesome contributions!