Here are some easy ways to fix the asp.net conditional compilation debugging problem.
Approved: Fortect
- 12 minutes to help you read.
Although most compilers do not have a separate preprocessor, the instructions in this section will be processed by someone else if you come across one. Use these types to simplify conditional compilation. Unlike the C and C ++ directives, you cannot usecall directives for creating macros. The preprocessor information should be the only instruction at the a level.
Nullable Context
The #nullable
preprocessor directive defines a nullable annotation context and warning structure. This directive determines whether nullable checks include consequences and whether nullable warnings are handled. Every context is either disabled or probably enabled.
Both contexts can be specified at the enterprise level (outside of the C # source code). The #nullable
directive controls annotation and video clip contexts and takes precedence over these project-level settings. A directive defines the context (s) it controls until another directive overwrites it, possibly to the end of the pipe file. Disable :
-
#nullable Turns off nullable annotation context and warnings.
-
#nullable Sets enable
: Typically nullable annotation and warning contexts for enabled.Restore : -
#nullable Resurrect Fills nullable annotations and warning contexts in project settings.
-
#nullable disable annotations
: Disables the current contextual nullable annotation. -
#nullable let annotations
: defines a nullable annotation context to help you with activation. -
#nullable restore annotations
: restore the structure of nullable annotations in the project settings. -
#nullable warnings
: disable Disables the entire nullable warning context. -
#nullable allow for warnings
: defines a nullable warning in an activated formulation. -
#nullable restore Restore warnings
: warning about missing nullable value for project settings.
Conditional Compilation
-
#if
: Opens dependent compilation in which the code will only compile the actual event identified by the specified symbol. -
#elif
: closes previous conditional compilation and opens advanced conditional compilation based one required character. -
#else
: closes the previous dependent compilation and opens a new conditional collection if the previously specified symbol is rarely specified. -
#endif
: Close the previous conditional compilation.
When the C # compiler encounters the #if
directive, possibly followed by the #endif
directive, it compiles that code only once between the specified directives, the symbol is defined ... Unlike C combined with C ++, you do not assign a numeric reward to a symbol. The C # statement #if
is boolean and only checks if the has symbol has been defined or not. Example:
#if for DEBUGGING Console.WriteLine ("Debug version");#end if
You can use the (equality) operators ==
as well as ! = <. use / code> (inequality)
to test for specific bool
true
or false
values. true
is the character of the parameter that is defined. The expression #if DEBUG
has the same meaning as #if (DEBUG == true)
. Can you use them &&
(and) , | |
(or) and !
(not) to evaluate if multiple characters have been defined. You can also group tokens and parenthetical operators.
#if
as well as your #else
, #elif
, #endif
, # define
, #undef
and directives let you include or exclude code based primarily on the existence of one or more characters. Conditional compilation can be useful when compiling code to debug an assembly, or perhaps when compiling for a specific configuration.
A dependent directive that begins with a #if
directive can explicitly end with a #endif
statement. With #define
you can define a symbol. Using the character that the as expression passed to the #if
directive, the expression looks like true
. You can also use constants compiler option DefineConstants . You can define the character with #undef
. The scale of the character created with #define
is equal to the file, Symbol that you define However, when defining DefineConstants or using #define
, does not conflict with a variable of the same name a. In other words, a variable should not be passed to a preprocessor directive, and a signature can only be evaluated by an important preprocessor directive.
With
#elif
you can create a compound dependent statement. The #elif
expression is evaluated if neither before #if
nor any of the additional expressions of the #elif
statement was successfully #elif
successfully evaluates to true
, the compiler evaluates all contacts between #elif
and the conditional after directive. For example:
#define VC7//...Debug #if Console.Build ");#elif Writeline ("debug VC7 Console.WriteLine ("Visual Studio 7");#end if
With
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
#else
you can create a conditional statement for the drug so that if none of the expressions in the last #if
or (optional) #elif < Directives / code> evaluate to fall back to
true
, the compiler evaluates all code somewhere between #else
and the next #endif
. # endif
(#endif) should be the next direc Your own preprocessor for #else
. Indicates
#endif
end of the conditional statement starting with the #if
directive. Build
Multilevel also knows some preprocessor symbols that represent different target platforms in projects like the SDK. They are useful for building production applications targeting multiple versions of .NET.
Target frames | characters |
---|---|
.NET NET48 , Framework |
network , NET472 , NET471 , NET47 , NET462 , NET461 , NET46 , NET452 , NET451 , NET45 , NET40 , NET35 , NET20 |
.NET standard | NETSTANDARD , NETSTANDARD2_1 , NETSTANDARD2_0 , NETSTANDARD1_6 , NETSTANDARD1_5 , NETSTANDARD1_3 , netstandard1_4 , NETSTANDARD1_2 , NETSTANDARD1_1 , NETSTANDARD1_0 |
.NET 5+ (and .NET Core) | NET , NET6_0_ANDROID , net6_0 , NET6_0_IOS , NET6_0_MACOS , NET6_0_MACATALYST , NET6_0_TVOS , NET6_0_WINDOWS , NET5_0 , NETCOREAPP , NETCOREAPP3_1 , NETCOREAPP3_0 , NETCOREAPP2_2 , NETCOREAPP2_1 , NETCOREAPP2_0 , NETCOREAPP1_1 , NETCOREAPP1_0 |