Visual Studio implements XML files using intelligent prompts such as app.config and web.config

Time:2019-5-14

In the process of. Net development, sometimes we need to use Xml files as configuration files (based on some considerations), instead of app. config, web. config, etc. But when we configure in xml, we hope to add intelligent hints like editing app. confg, web. config files.

When no special configuration is made, write the XML file as follows:

As you can see from the figure above, there is no intelligent prompt. But when we edit app. config and web. config, we have intelligent prompts, such as the configuration above. We may just type in the first few letters and then pop up the intelligent prompt, which we can choose directly from below. The following picture:

In Visual Studio, Xml architectures can be specified for Xml files, which are usually files with an extension of. xsd.

Next, we want to implement smart prompts like app. config and web. config when writing XML files.

1. Open the app.config or web.config file in Visual Studio (no additions can be made by right-clicking on the item, selecting “Add” “New Item”, selecting from the pop-up panel), right-clicking on the blank, and selecting the properties from the pop-up menu.

Then pop up the window as follows:

Let’s remember the three file names that were ticked.

2. Open the XML file, right-click in the blank, select attributes in the pop-up menu, pop up the attributes panel, frame a column in the attributes panel, right-click the button on the right, pop up the Xml framework selection interface.

As you can see, the default XML architecture is as follows:

Here we cancel the default XML architecture, select the XML architecture used by app. config and web. config, and click “Save”.

Then we edit the XML file and find that there is already a smart prompt.

The above is the whole content of this article. I hope it will be helpful to everyone’s study, and I hope you will support developpaer more.