AllowUnsafeBlocks will now be a project level property in new format C# projects
Fixes #1549
This commit is contained in:
parent
67f5bd12ff
commit
2e4df1f347
@ -39,7 +39,6 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of the Unsafe flag.
|
-- Check handling of the Unsafe flag.
|
||||||
--
|
--
|
||||||
@ -55,6 +54,17 @@
|
|||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.allowUnsafeBlocks_onUnsafeFlagNonConfigOnNetcore()
|
||||||
|
dotnetframework "netcoreapp3.1"
|
||||||
|
clr "Unsafe"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Check handling of FatalWarnings flag.
|
-- Check handling of FatalWarnings flag.
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
local p = premake
|
local p = premake
|
||||||
local suite = test.declare("vstudio_cs2005_netcore_prj")
|
local suite = test.declare("vstudio_cs2005_netcore_prj")
|
||||||
local dn2005 = p.vstudio.dotnetbase
|
local dn2005 = p.vstudio.dotnetbase
|
||||||
|
local cs2005 = p.vstudio.cs2005
|
||||||
local project = p.project
|
local project = p.project
|
||||||
|
|
||||||
|
|
||||||
@ -36,6 +37,13 @@ local function prepareNetcore()
|
|||||||
dn2005.projectElement(prj)
|
dn2005.projectElement(prj)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function prepareProjectProperties()
|
||||||
|
local localProj = test.getproject(wks, 1)
|
||||||
|
|
||||||
|
dn2005.prepare(cs2005)
|
||||||
|
dn2005.projectProperties(localProj)
|
||||||
|
end
|
||||||
|
|
||||||
function suite.targetFrameworkProperty_framework()
|
function suite.targetFrameworkProperty_framework()
|
||||||
dotnetframework "4.7.2"
|
dotnetframework "4.7.2"
|
||||||
targetFrameworkPrepare()
|
targetFrameworkPrepare()
|
||||||
@ -101,3 +109,18 @@ function suite.project_element_framework()
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.allowUnsafeProperty_core()
|
||||||
|
dotnetframework "netcoreapp2.2"
|
||||||
|
clr "Unsafe"
|
||||||
|
prepareProjectProperties()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
dotnetbase.rootNamespace,
|
dotnetbase.rootNamespace,
|
||||||
dotnetbase.assemblyName,
|
dotnetbase.assemblyName,
|
||||||
dotnetbase.netcore.targetFramework,
|
dotnetbase.netcore.targetFramework,
|
||||||
|
dotnetbase.allowUnsafeBlocks,
|
||||||
dotnetbase.fileAlignment,
|
dotnetbase.fileAlignment,
|
||||||
dotnetbase.bindingRedirects,
|
dotnetbase.bindingRedirects,
|
||||||
dotnetbase.netcore.useWpf,
|
dotnetbase.netcore.useWpf,
|
||||||
|
@ -252,8 +252,8 @@
|
|||||||
_p(2,'<ErrorReport>prompt</ErrorReport>')
|
_p(2,'<ErrorReport>prompt</ErrorReport>')
|
||||||
_p(2,'<WarningLevel>4</WarningLevel>')
|
_p(2,'<WarningLevel>4</WarningLevel>')
|
||||||
|
|
||||||
if cfg.clr == "Unsafe" then
|
if not dotnetbase.isNewFormatProject(cfg) then
|
||||||
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
dotnetbase.allowUnsafeBlocks(cfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
if cfg.flags.FatalCompileWarnings then
|
if cfg.flags.FatalCompileWarnings then
|
||||||
@ -772,4 +772,10 @@
|
|||||||
if cfg.flags.WPF then
|
if cfg.flags.WPF then
|
||||||
_p(2,'<UseWpf>true</UseWpf>')
|
_p(2,'<UseWpf>true</UseWpf>')
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function dotnetbase.allowUnsafeBlocks(cfg)
|
||||||
|
if cfg.clr == "Unsafe" then
|
||||||
|
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user