ASP.NET 2.0 compiler under the conditions
Web development in a single page of the functional test is too much trouble, from the Home user name, password, go after a number of operations before they can come to you want to test the page. (Actually, no matter what the development, testing a single function are very troublesome). With the attitude of caution, I like to write a few paragraphs of general test the first time, if every timestart to test the entire project is very economical alternative.
Solution I usually add a configuration used for testing by adding a "Test" compiler directives like, and then in the code, the number of test conditions, test methods put under the command. Team in the development of unit testing has not yet introduced the concept of like, I do not want to add a test item used in such a way to do this kind of thing. But as the Web under the individual circumstances Page so I do not know how the law should be. Therefore, before using or compile their own methods of instruction suchpoint.
(I used to write under a number of non-WEB when things also like to test methods and categories of their own writing in a document, then distinguished from the compiler command, to test directly in the development environment select "Test" of that configuration, and then start to test the TestDriven, do not start the whole project a lot of labor-saving machinery, TestDriven this thing is very effective.
If you are using c # for development, in the development environment, if the current conditions are not satisfied with the compiler when the code will be gray out those, and can be indented, is not impaired eyes)
But those tricks I in a little bit No matter under VS2005, and now WEB development with little distinction between the past. In the above areas can not findto add compiler directives, the development of non-WEB can still find places to add. , found that some things are set up to put in the Web.config, the conditions of the compiler of course no exception.
For example, would now like to add a "Test" command to compile the conditions. In the Web.config file, in <compilation> under this section by adding the following statement on it.
<compiler language = "vb"
type = "Microsoft.VisualBasic.VBCodeProvider, System, Version = 188.8.131.52, Culture = neutral, PublicKeyToken = B77A5C561934E089"
extension = ". VB"
compilerOptions = "/ define: Debug = True / define: Trace = True / define: Test = True" />
<compiler language = "c #"
type = "Microsoft.CSharp.CSharpCodeProvider, System, Version = 184.108.40.206, Culture = neutral, PublicKeyToken = B77A5C561934E089"
extension = ". cs"
compilerOptions = "/ d: DEBUG; TRACE; Test" />
Is fatal, for each language should be added a <compiler>, of course, useless if the project to the appropriate language, also can be the rationale for it, can be removed. General C++ #, vb and more used to compare, I can only engage in two kinds of this.
Years after the Web.config settings do not have to be tested in each of the pages up the definition of compiler directives, but did not cool before, in the past directly in the IDE toolbar configuration options click on the line, and now insisted that thethings, but the main or inconvenient to switch. For example, I do not want in the "Test" under the conditions to start, I have to go to a section of Web.config in the above comment out things.
Is in accordance with the MSDN, the. Net 2.0 under, <compiler> of this element is deprecated, and I like this approach is not right.
.NET foundation Articles
- ConnectString set enlist in the meaning of
- ASP_NET using MD5 encryption
- Asp.Net using the POST method the easiest to achieve
- Some commonly used data manipulation classes
- Excel data island out to the most simple method of
- Request for the URL and parse the returned html
- A rather classic study of multi-threaded code
- Using the Data Access Application Block to be the return value of stored procedure
- asp.net2.0 the asynchronous call WebService (asynchronous pages)
- In the VS2003 to open the ASPX file directly DREAMWEAVER8
- ASP.NET2.0 database entry of the common errors
- Multi-column sort ASP.Net2.0 GridView to show the icon to sort, paging
- . net so the IP access restrictions
- . Net2.0 read and write configuration files using ConfigurationManager
- ASP.NET 2.0 in the use of XSLT
- ASP.NET page template to achieve
- . net2.0 for the use of large quantities SqlBulkCopy data migration
- ASP.NET 2.0 compiler under the conditions
- Click the Close button to capture events
- How perfect Web development control IE title bar
Can't Find What You're Looking For?
Rating: Not yet rated