Some tips for visual studio finishing

This blog will successively sort out some of the author's little skills in actual development, some very interesting things, and will continue to be updated.

 

If you have any questions, you can add group discussions, QQ group: 592132877

 

 


Use of #warning

#warning means to output a compilation warning when the program is compiled, such as compiling in the following method, and then we compile the result to see

        public void DoSomething()
        {
            #warning This method has not been implemented yet, to be completed
        }

 as follows:

 

There is a very interesting use here. For example, when you are writing a program, some methods have not been written well. Maybe the specific implementation will be implemented later, and a simple method will be defined. What if you forget it later? So you can use this compilation instruction, and you can clearly know where there is a problem when compiling in the future, and you can quickly locate it.

 


Visual studio compile and carry file output

This function is actually quite practical. For example, in your project, some ancient project files need to be output in the result, such as the C++ components carried, which cannot be referenced and output in the project, then we can do this

After the addition is complete, the effect is as follows:

 

For example, if our program calls this library, we need to include this library in the final program running directory, then right-click to attribute this library. The generation rule is the content and copied to the output directory, so that the final generated exe will carry this information.

But there is a problem. We hope that when the program is generated, it will carry some initial files. These files are stored in the subdirectories of the program running directory, such as the Images folder. There are several pictures in it, which need to be used in the system. Then do this. :

 

Then add all the image files

Then for each picture, right-click the properties, copy it to the output directory, and then regenerate the project

Open Images to view:


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324395960&siteId=291194637