Conditional compilation symbols and releases

Source: Internet
Author: User

Conditional compilation symbols and releases

I. Conditional compilation symbols

Conditional compilation is used to set some application scenarios in the code. The most common one is how DEBUG works; otherwise, how DEBUG works.

If you want to add some scenarios except DEBUG and TRACE, you can define the conditions yourself. The method is as follows: Right-click the project and select Properties. On the generate tab, enter the custom Conditional compilation symbol.

For example, the project we are working on now puts the login module on early, gets frequent login, get bored, and waste a lot of time. Then, I can set a Conditional compilation symbol, for example, NoLogin, and then in the Code:

# If NoLogin // forge a login information and do not log on... # Else // Well-Behaved login... # Endif

In this way, as long as the NoLogin condition compilation symbol is valid and exists, you do not need to log on.

The condition compilation symbol is saved in the project file.

Ii. Release
If you expand WEB. config in a web project, web. debug. config and web. release. config exist. This is the compilation option for release. For example, if you select "Release", the system will use the web. release. the configuration in config overwrites the web. the published web. config will be the overwritten version.

Note that the configuration for release replacement has some format requirements, but it is described in detail and can be written as needed.

If you have other release requirements besides debug and release, you can add them as needed. The method is:
Click Generate in the vs menu bar, select the Configuration Manager, and create a new one. For example, if I create a configuration scheme named NoLogin, the system will automatically add a web. NoLogin. config

Iii. Relationship between conditional compilers and releases

It does not seem to matter. Condition compilers are not supported in web. config. The condition compiler only starts with the code. However, it seems that the Code released by the debug and release schemes does not work for the customized conditional compilers. It is possible that debug and release are system-retained solutions and will automatically Clear Custom conditional compilers. Forget it. Don't try it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.