Merge pull request #1565 from ClxS/AllowUnsafeBlocks-net5-fix

AllowUnsafeBlocks will now be a project level property in new format
This commit is contained in:
Samuel Surtees 2020-12-08 11:06:52 +10:00 committed by GitHub
commit 0f54214cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 3 deletions

View File

@ -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.

View File

@ -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()
@ -109,3 +117,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

View File

@ -47,6 +47,7 @@
dotnetbase.rootNamespace,
dotnetbase.assemblyName,
dotnetbase.netcore.targetFramework,
dotnetbase.allowUnsafeBlocks,
dotnetbase.fileAlignment,
dotnetbase.bindingRedirects,
dotnetbase.netcore.useWpf,

View File

@ -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
@ -769,3 +769,9 @@
_p(2,'<UseWpf>true</UseWpf>')
end
end
function dotnetbase.allowUnsafeBlocks(cfg)
if cfg.clr == "Unsafe" then
_p(2,'<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
end
end