is there any tool to validate configuration file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, basically your app is the validator – if the config file is not valid, you’ll get an exception when starting up. Other than that, I’m not aware of any out-of-the-box validation support for app.config files.
In your directory
C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas, you’ll find some files calledDotNetConfig.xsd / DotNetConfig20.xsd– those are Microsoft-supplied XML schema files, which you could easily use to validate any other config files you might have for validity.The basic structure for programmatically validating your configs would be something like this:
What you need to do now is supply event handlers for those event that get raised when something in the validation goes wrong – that’s about it! 🙂