diff --git a/modules/vstudio/tests/cs2005/test_compiler_props.lua b/modules/vstudio/tests/cs2005/test_compiler_props.lua
index d32b721d..67cf906f 100644
--- a/modules/vstudio/tests/cs2005/test_compiler_props.lua
+++ b/modules/vstudio/tests/cs2005/test_compiler_props.lua
@@ -39,7 +39,6 @@
]]
end
-
--
-- Check handling of the Unsafe flag.
--
@@ -55,6 +54,17 @@
]]
end
+ function suite.allowUnsafeBlocks_onUnsafeFlagNonConfigOnNetcore()
+ dotnetframework "netcoreapp3.1"
+ clr "Unsafe"
+ prepare()
+ test.capture [[
+
+ prompt
+ 4
+ ]]
+ end
+
--
-- Check handling of FatalWarnings flag.
diff --git a/modules/vstudio/tests/cs2005/test_netcore.lua b/modules/vstudio/tests/cs2005/test_netcore.lua
index cfa138a1..13c0c53c 100644
--- a/modules/vstudio/tests/cs2005/test_netcore.lua
+++ b/modules/vstudio/tests/cs2005/test_netcore.lua
@@ -7,6 +7,7 @@
local p = premake
local suite = test.declare("vstudio_cs2005_netcore_prj")
local dn2005 = p.vstudio.dotnetbase
+local cs2005 = p.vstudio.cs2005
local project = p.project
@@ -36,6 +37,13 @@ local function prepareNetcore()
dn2005.projectElement(prj)
end
+local function prepareProjectProperties()
+ local localProj = test.getproject(wks, 1)
+
+ dn2005.prepare(cs2005)
+ dn2005.projectProperties(localProj)
+end
+
function suite.targetFrameworkProperty_framework()
dotnetframework "4.7.2"
targetFrameworkPrepare()
@@ -101,3 +109,18 @@ function suite.project_element_framework()
]]
end
+
+function suite.allowUnsafeProperty_core()
+ dotnetframework "netcoreapp2.2"
+ clr "Unsafe"
+ prepareProjectProperties()
+ test.capture [[
+
+ Exe
+ Properties
+ netcoreapp2.2
+ true
+ false
+
+ ]]
+end
diff --git a/modules/vstudio/vs2005_csproj.lua b/modules/vstudio/vs2005_csproj.lua
index 186cde45..83a68163 100644
--- a/modules/vstudio/vs2005_csproj.lua
+++ b/modules/vstudio/vs2005_csproj.lua
@@ -47,6 +47,7 @@
dotnetbase.rootNamespace,
dotnetbase.assemblyName,
dotnetbase.netcore.targetFramework,
+ dotnetbase.allowUnsafeBlocks,
dotnetbase.fileAlignment,
dotnetbase.bindingRedirects,
dotnetbase.netcore.useWpf,
diff --git a/modules/vstudio/vs2005_dotnetbase.lua b/modules/vstudio/vs2005_dotnetbase.lua
index f14d3065..efadb2fe 100644
--- a/modules/vstudio/vs2005_dotnetbase.lua
+++ b/modules/vstudio/vs2005_dotnetbase.lua
@@ -252,8 +252,8 @@
_p(2,'prompt')
_p(2,'4')
- if cfg.clr == "Unsafe" then
- _p(2,'true')
+ if not dotnetbase.isNewFormatProject(cfg) then
+ dotnetbase.allowUnsafeBlocks(cfg)
end
if cfg.flags.FatalCompileWarnings then
@@ -772,4 +772,10 @@
if cfg.flags.WPF then
_p(2,'true')
end
+ end
+
+ function dotnetbase.allowUnsafeBlocks(cfg)
+ if cfg.clr == "Unsafe" then
+ _p(2,'true')
+ end
end
\ No newline at end of file