Skip to content

Commit

Permalink
Add TreatWarningsAsErrors option
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Rehan Saeed committed Jul 16, 2018
1 parent f3abef2 commit 8bbcd9a
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions Docs/API.md
Expand Up @@ -27,6 +27,7 @@ The ASP.NET Core API project template uses `dotnet new` to enable you to turn fe
- **Title** - The name of the project which determines the assembly product name. If the Swagger feature is enabled, shows the title on the Swagger UI.
- **Description** - A description of the project which determines the assembly description. If the Swagger feature is enabled, shows the description on the Swagger UI.
- **Author** - The name of the author of the project which determines the assembly author and copyright information.
- **TreatWarningsAsErrors** - Treat warnings as errors.
- **HttpPort** - Port number to use for the HTTP endpoint in launchSettings.json.
- **HttpsPort** - Port number to use for the HTTPS endpoint in launchSettings.json.

Expand Down
1 change: 1 addition & 0 deletions Docs/GraphQL.md
Expand Up @@ -22,6 +22,7 @@ The ASP.NET Core GraphQL project template uses `dotnet new` to enable you to tur
- **Title** - The name of the project which determines the assembly product name.
- **Description** - A description of the project which determines the assembly description.
- **Author** - The name of the author of the project which determines the assembly author and copyright information.
- **TreatWarningsAsErrors** - Treat warnings as errors.
- **HttpPort** - Port number to use for the HTTP endpoint in launchSettings.json.
- **HttpsPort** - Port number to use for the HTTPS endpoint in launchSettings.json.

Expand Down
Expand Up @@ -19,6 +19,9 @@
"AuthorXmlEncoded": {
"isHidden": true
},
"TreatWarningsAsErrors": {
"longName": "treat-warnings-as-errors"
},
"Swagger": {
"longName": "swagger"
},
Expand Down
7 changes: 7 additions & 0 deletions Source/Content/ApiTemplate/.template.config/template.json
Expand Up @@ -141,6 +141,13 @@
"valueSource": "Author",
"valueTransform": "xmlEncode"
},
// TreatWarningsAsErrors
"TreatWarningsAsErrors": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Treat warnings as errors."
},

// Swagger
"Swagger": {
Expand Down
5 changes: 3 additions & 2 deletions Source/Content/ApiTemplate/ApiTemplate.csproj
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<!--#if (AuthoringMode)-->
<PropertyGroup>
<!-- Modify these constants to enable/disable a feature to debug the template. Note that this only affects the C#. -->
<DefineConstants>$(DefineConstants);Kestrel;IIS;NGINX;Azure;ApplicationInsights;HealthCheck;HttpsEverywhere;HstsPreload;ForwardedHeaders;HostFiltering;ResponseCaching;ResponseCompression;CORS;HumansTxt;RobotsTxt;Swagger;Versioning;DataContractSerializer;CorrelationId</DefineConstants>
<DefineConstants>$(DefineConstants);TreatWarningsAsErrors;Kestrel;IIS;NGINX;Azure;ApplicationInsights;HealthCheck;HttpsEverywhere;HstsPreload;ForwardedHeaders;HostFiltering;ResponseCaching;ResponseCompression;CORS;HumansTxt;RobotsTxt;Swagger;Versioning;DataContractSerializer;CorrelationId</DefineConstants>
<!-- Workaround to build this project: https://github.com/dotnet/templating/issues/1438 -->
<ApplicationInsights>true</ApplicationInsights>
<Azure>true</Azure>
Expand Down Expand Up @@ -32,6 +32,7 @@
<!-- Enable tiered JIT compilation for better performance.
See http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-method-and-Tiered-Compilation/ -->
<TieredCompilation>true</TieredCompilation>
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)' == 'true'">true</TreatWarningsAsErrors>
<!--#if (!IIS)-->
<!-- Disable publishing of a web.config file for IIS when calling dotnet publish. -->
<!--#endif-->
Expand Down
Expand Up @@ -19,6 +19,9 @@
"AuthorXmlEncoded": {
"isHidden": true
},
"TreatWarningsAsErrors": {
"longName": "treat-warnings-as-errors"
},
"Mutations": {
"longName": "mutations"
},
Expand Down
7 changes: 7 additions & 0 deletions Source/Content/GraphQLTemplate/.template.config/template.json
Expand Up @@ -132,6 +132,13 @@
"valueSource": "Author",
"valueTransform": "xmlEncode"
},
// TreatWarningsAsErrors
"TreatWarningsAsErrors": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Treat warnings as errors."
},

// Mutations
"Mutations": {
Expand Down
5 changes: 3 additions & 2 deletions Source/Content/GraphQLTemplate/GraphQLTemplate.csproj
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<!--#if (AuthoringMode)-->
<PropertyGroup>
<!-- Modify these constants to enable/disable a feature to debug the template. Note that this only affects the C#. -->
<DefineConstants>$(DefineConstants);Mutations;Subscriptions;Kestrel;IIS;NGINX;Azure;ApplicationInsights;HealthCheck;HttpsEverywhere;HstsPreload;ForwardedHeaders;HostFiltering;ResponseCaching;CORS;HumansTxt;RobotsTxt;CorrelationId;ResponseCompression</DefineConstants>
<DefineConstants>$(DefineConstants);TreatWarningsAsErrors;Mutations;Subscriptions;Kestrel;IIS;NGINX;Azure;ApplicationInsights;HealthCheck;HttpsEverywhere;HstsPreload;ForwardedHeaders;HostFiltering;ResponseCaching;CORS;HumansTxt;RobotsTxt;CorrelationId;ResponseCompression</DefineConstants>
<!-- Workaround to build this project: https://github.com/dotnet/templating/issues/1438 -->
<ApplicationInsights>true</ApplicationInsights>
<Azure>true</Azure>
Expand All @@ -25,6 +25,7 @@
<!-- Enable tiered JIT compilation for better performance.
See http://mattwarren.org/2017/12/15/How-does-.NET-JIT-a-method-and-Tiered-Compilation/ -->
<TieredCompilation>true</TieredCompilation>
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)' == 'true'">true</TreatWarningsAsErrors>
<!--#if (!IIS)-->
<!-- Disable publishing of a web.config file for IIS when calling dotnet publish. -->
<!--#endif-->
Expand Down

0 comments on commit 8bbcd9a

Please sign in to comment.