Enable warningsAsErrors compiler option in project gen
This commit is contained in:
parent
d762b614bd
commit
d35d168973
|
|
@ -261,9 +261,13 @@ functions
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var sharedDefines = Get<IEnumerable<object>>(compilationOptions, "define") ?? new object[0];
|
var sharedDefines = Get<IEnumerable<object>>(compilationOptions, "define") ?? new object[0];
|
||||||
|
|
||||||
object unsafeValue = Get<object>(compilationOptions, "allowUnsafe");
|
object unsafeValue = Get<object>(compilationOptions, "allowUnsafe");
|
||||||
bool sharedAllowUnsafeCode = unsafeValue == null ? false : (bool)unsafeValue;
|
bool sharedAllowUnsafeCode = unsafeValue == null ? false : (bool)unsafeValue;
|
||||||
|
|
||||||
|
object warningsValue = Get<object>(compilationOptions, "warningsAsErrors");
|
||||||
|
bool sharedWarningsAsErrors = warningsValue == null ? false : (bool)warningsValue;
|
||||||
|
|
||||||
// HACK: Assume the packages folder is 2 up from the projectDir
|
// HACK: Assume the packages folder is 2 up from the projectDir
|
||||||
string packagesDir = Path.GetFullPath(Path.Combine(projectDir, "..", "..", "packages"));
|
string packagesDir = Path.GetFullPath(Path.Combine(projectDir, "..", "..", "packages"));
|
||||||
|
|
||||||
|
|
@ -295,11 +299,15 @@ functions
|
||||||
var specificCompilationOptions = GetObject(props, "compilationOptions") ?? compilationOptions ?? new Dictionary<string, object>();
|
var specificCompilationOptions = GetObject(props, "compilationOptions") ?? compilationOptions ?? new Dictionary<string, object>();
|
||||||
|
|
||||||
var specificDefines = Get<IEnumerable<object>>(specificCompilationOptions, "define") ?? new object[0];
|
var specificDefines = Get<IEnumerable<object>>(specificCompilationOptions, "define") ?? new object[0];
|
||||||
|
|
||||||
object specificUnsafeValue = Get<object>(specificCompilationOptions, "allowUnsafe");
|
object specificUnsafeValue = Get<object>(specificCompilationOptions, "allowUnsafe");
|
||||||
bool allowUnsafeCode = unsafeValue == null ? sharedAllowUnsafeCode : (bool)specificUnsafeValue;
|
bool allowUnsafeCode = unsafeValue == null ? sharedAllowUnsafeCode : (bool)specificUnsafeValue;
|
||||||
|
string extraProperties = (allowUnsafeCode ? Environment.NewLine + "<AllowUnsafeBlocks>true</AllowUnsafeBlocks>" : "");
|
||||||
|
|
||||||
string extraProperties = (allowUnsafeCode ? "\n<AllowUnsafeBlocks>true</AllowUnsafeBlocks>" : "");
|
object specificWarningsValue = Get<object>(specificCompilationOptions, "warningsAsErrors");
|
||||||
|
bool warningsAsErrors = specificWarningsValue == null ? sharedWarningsAsErrors : (bool)specificWarningsValue;
|
||||||
|
extraProperties += (warningsAsErrors ? Environment.NewLine + "<TreatWarningsAsErrors>true</TreatWarningsAsErrors>" : "");
|
||||||
|
|
||||||
if (isWebSample)
|
if (isWebSample)
|
||||||
{
|
{
|
||||||
var config = Path.Combine(projectDir, "web.config");
|
var config = Path.Combine(projectDir, "web.config");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue