diff --git a/modules/vstudio/tests/cs2005/test_netcore.lua b/modules/vstudio/tests/cs2005/test_netcore.lua
index 41942c5d0f..0cd76544f9 100644
--- a/modules/vstudio/tests/cs2005/test_netcore.lua
+++ b/modules/vstudio/tests/cs2005/test_netcore.lua
@@ -20,6 +20,7 @@ local wks, prj
function suite.setup()
p.action.set("vs2005")
wks, prj = test.createWorkspace()
+ configurations { "Debug", "Release", "Distribution"}
language "C#"
end
@@ -33,6 +34,10 @@ local function targetFrameworkVersionPrepare()
dn2005.targetFrameworkVersion(cfg)
end
+local function projectConfigurationsPrepare()
+ dn2005.projectConfigurations(prj)
+end
+
local function prepareNetcore()
dn2005.projectElement(prj)
end
@@ -132,3 +137,14 @@ function suite.allowUnsafeProperty_core()
]]
end
+
+function suite.project_element_configurations()
+ p.action.set("vs2022")
+ dotnetframework "net8.0"
+
+ projectConfigurationsPrepare()
+
+test.capture [[
+ Debug;Release;Distribution
+ ]]
+end
diff --git a/modules/vstudio/vs2005_csproj.lua b/modules/vstudio/vs2005_csproj.lua
index 38820e0acc..4695d65631 100644
--- a/modules/vstudio/vs2005_csproj.lua
+++ b/modules/vstudio/vs2005_csproj.lua
@@ -52,6 +52,7 @@
dotnetbase.bindingRedirects,
dotnetbase.netcore.useWpf,
dotnetbase.csversion,
+ dotnetbase.projectConfigurations,
dotnetbase.netcore.enableDefaultCompileItems,
}
else
diff --git a/modules/vstudio/vs2005_dotnetbase.lua b/modules/vstudio/vs2005_dotnetbase.lua
index 32cdd4beb9..22eae46b50 100644
--- a/modules/vstudio/vs2005_dotnetbase.lua
+++ b/modules/vstudio/vs2005_dotnetbase.lua
@@ -85,7 +85,14 @@
_p(1,'')
end
-
+--
+-- Write the available configurations to have correct configuration mapping on vs2022 format and later.
+--
+ function dotnetbase.projectConfigurations(prj)
+ if _ACTION >= "vs2022" and #prj.configurations > 0 then
+ _p(2, '%s', table.implode(prj.configurations, "", "", ";"))
+ end
+ end
--
-- Write out the settings for the project configurations.
--