Resolve conflicts between msbuild development projects and development compilation in TFs (TIPS)

Source: Internet
Author: User
Today, it took a day to restructure the structure of the xframework project in TFs. Code Management, automatic compilation and deployment, and development.
First, let's talk about msbuild. Originally, this automatic compilation tool provided detailed configuration options to implement many flexible configurations. Although it is very simple to use the tool wizard, it is only a compilation solution based on a solution. I don't have much time to study its configuration (it is estimated that it will not be much different from Nant), but there is a problem that cannot be solved well:
Some DLL class library configuration files are used in my project. If vs2005 is better than vs2003, the app of the class library project will be used. config is automatically copied to the compilation directory and renamed as: Project name. DLL. config. However, if the project is referenced, the configuration file will not be copied together. Before using msbuild, I added a copy script to the compilation completion event of the class library project and copied the configuration file to the desired directory.
However, a problem occurs during msbuild Compilation: The msbuild compilation output directory is not the default bin \ DEBUG directory for each project, but the entire solution Program The set is output to a unified directory. It is estimated that the reason for this is to facilitate packaging and publishing. This is terrible. The directory path of the script to be copied is definitely not available, so msbuild will always fail.
At the beginning, I removed the copy script from the project. In this way, msbuild has no problem. The compiled file output is in a directory, which naturally contains the configuration file, there will be no problems in running, but it will be difficult to develop and compile at this time, because the project does not copy the necessary configuration files, causing errors in compilation and debugging during development. It is a headache to manually copy the distribution file after each configuration file modification.
After thinking for half a day, I found that the script for compiling the event is actually a command line script. It should be the same as the batch processing script in the DOS era, so it can be determined using if, then, you can determine whether the current compilation status is development or msbuild during compilation, and copy the configuration file only during development and compilation. So we solved the problem very well. The script is as follows:

If "$ (configurationname)" = "debug" Copy $ (builtouputpath) .. \ commassembly \ commonsupport. dll. CONFIG $ (builtouputpath)/y

Hey, Ginger is still old and hot. What we learned more than a decade ago in the DOS era still has its value.

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.