diff --git a/build/Helpers.lua b/build/Helpers.lua
index 977f9f3c..68c4c91d 100644
--- a/build/Helpers.lua
+++ b/build/Helpers.lua
@@ -43,6 +43,11 @@ newoption {
   description = "Only generate configuration file",
 }
 
+newoption {
+  trigger = "target-framework",
+  description = ".NET target framework version",
+}
+
 rootdir = path.getabsolute("../")
 srcdir = path.join(rootdir, "src");
 incdir = path.join(rootdir, "include");
@@ -61,7 +66,17 @@ msvc_cpp_defines = { }
 default_gcc_version = "9.0.0"
 generate_build_config = true
 premake.path = premake.path .. ";" .. path.join(builddir, "modules")
-targetframework = "net6.0"
+
+function string.isempty(s)
+  return s == nil or s == ''
+end
+
+local function target_framework()
+  local value =  _OPTIONS["target-framework"]
+  return string.isempty(value) and "net6.0" or value
+end
+
+targetframework = target_framework()
 
 function string.starts(str, start)
    if str == nil then return end
diff --git a/build/build.sh b/build/build.sh
index de1368dc..6f7a086f 100755
--- a/build/build.sh
+++ b/build/build.sh
@@ -6,6 +6,7 @@ vs=vs2019
 configuration=Release
 build_only=false
 ci=false
+target_framework=
 verbosity=minimal
 rootdir="$builddir/.."
 bindir="$rootdir/bin"
@@ -46,7 +47,7 @@ build()
 
 generate_config()
 {
-  "$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --config_only
+  "$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework --config_only
 }
 
 generate()
@@ -54,10 +55,10 @@ generate()
   download_llvm
 
   if [ "$os" = "linux" ] || [ "$os" = "macosx" ]; then
-    "$builddir/premake.sh" --file="$builddir/premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration "$@"
+    "$builddir/premake.sh" --file="$builddir/premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework "$@"
   fi
 
-  "$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration
+  "$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework
 }
 
 restore()
@@ -194,6 +195,11 @@ while [[ $# > 0 ]]; do
       os=$2
       shift
       ;;
+    -target-framework)
+      target_framework=$2
+      echo $target_framework
+      shift
+      ;;
     -ci)
       ci=true
       export CI=true
diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md
index c1f4e66d..a6711727 100644
--- a/docs/GettingStarted.md
+++ b/docs/GettingStarted.md
@@ -44,6 +44,8 @@ The following steps should be called from the VS developer command prompt.
     <sh> build.sh generate -configuration Release -platform x64
     ```
 
+> :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
+
 2. Compile the VS projects
 
     You can open `CppSharp.sln` and hit F5 or compile via the command line:
@@ -82,6 +84,8 @@ When opening the solution for the first time on a more recent version than Visua
     ./build.sh generate -configuration Release -platform x64
     ```
 
+> :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
+
 2. Compile the csproj files and makefiles
 
     ```
diff --git a/src/CLI/CppSharp.CLI.csproj b/src/CLI/CppSharp.CLI.csproj
index 9e44e240..4a529cbc 100644
--- a/src/CLI/CppSharp.CLI.csproj
+++ b/src/CLI/CppSharp.CLI.csproj
@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
   
   <ItemGroup>