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
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the Unsafe flag.
|
||||
--
|
||||
@ -55,6 +54,17 @@
|
||||
]]
|
||||
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.
|
||||
|
@ -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()
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
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.assemblyName,
|
||||
dotnetbase.netcore.targetFramework,
|
||||
dotnetbase.allowUnsafeBlocks,
|
||||
dotnetbase.fileAlignment,
|
||||
dotnetbase.bindingRedirects,
|
||||
dotnetbase.netcore.useWpf,
|
||||
|
@ -252,8 +252,8 @@
|
||||
_p(2,'<ErrorReport>prompt</ErrorReport>')
|
||||
_p(2,'<WarningLevel>4</WarningLevel>')
|
||||
|
||||
if cfg.clr == "Unsafe" then
|
||||
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
||||
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,'<UseWpf>true</UseWpf>')
|
||||
end
|
||||
end
|
||||
|
||||
function dotnetbase.allowUnsafeBlocks(cfg)
|
||||
if cfg.clr == "Unsafe" then
|
||||
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user