Document how to escape a Condition
See original GitHub issueBack in the .NET Core 1.1 release I was able to do this in my csproj to conditionally add things:
<Project Sdk="Microsoft.NET.Sdk.Web">
<!--#if (AuthoringMode)-->
<PropertyGroup>
<DefineConstants>$(DefineConstants);Swagger</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Content Include=".template.config\**\*" />
</ItemGroup>
<!--#endif-->
<ItemGroup Label="Package References">
<PackageReference Include="Boilerplate.AspNetCore.Swagger" Version="3.0.0" Condition="'$(Swagger)' == 'true'" />
</ItemGroup>
</Project>
The Condition="'$(Swagger)' == 'true'"
syntax gives compile time errors in .NET Core 2.0. I discovered somewhere that I can use the following syntaxinstead:
<PackageReference Include="Boilerplate.AspNetCore.Swagger" Version="3.0.0" Condition="$(DefineConstants.Contains('Swagger'))" />
This syntax compiles but no longer works with dotnet new
. Is there a solution to this problem? Should I also be using #if
comment syntax like this:
<!--#if (Swagger)-->
<PackageReference Include="Boilerplate.AspNetCore.Swagger" Version="3.0.0" Condition="$(DefineConstants.Contains('Swagger'))" />
<!--#endif-->
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
How to properly escape the content of a <code> example ...
In this example below, Intellisense highlights the > character because I need to escape it, it says the code will not be included...
Read more >escape() - JavaScript - MDN Web Docs - Mozilla
The escape() function computes a new string in which certain characters have been replaced by hexadecimal escape sequences.
Read more >ESCAPE clause in LIKE operator - Progress Documentation
The ESCAPE clause is supported in the LIKE operator to indicate the escape character. Escape characters are used in the pattern string to...
Read more >ESCAPE
The ESCAPE statement is used to interrupt the linear flow of execution of a processing loop or a routine. With the keywords TOP...
Read more >Escape Sequences
Escape sequences are typically used to specify actions such as carriage returns and tab movements on terminals and printers. They are also used ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing item - the wiki article was updated.
@RehanSaeed I see PR #2527 but it is not yet merged, why was this issue closed early?