In a previous post, I demonstrated how to create an application with an enhanced detection rule (EHD). Creating an application with a requirements rule is a bit more complicated. In this post I will provide a sample on how to do this using one of the “out of the box” global conditions that’s provided with the product. In this case, this rule is stating that the free disk space on the system drive must be higher than 5GB.
First use the sample program in this post. Then add this code between line 39 and 41:
This code builds a tree for the requirement rule based on the global setting “FreeDiskSpace”. If the code is a bit much to take in, here’s the XML it generates internally that may explain the logic a bit better:
Global conditions can be accessed through the SMS Provider by looking at the SMS_GlobalCondition class instances. You can also view the unique ID information for global conditions directly through the administrator console (this way you can get the authoring scope ID and logical name) by going into Software Library –> Application Management –> Global Conditions and enabling the “CI Unique ID” column.
This is not a comprehensive example in that it only provides one specific way to use requirement rules and doesn’t provide information on how to create global conditions. I hope to provide this information in a future blog post. I hope this is enough to at least get some of you started on this area of the SDK that frequently gets questions asked about it.
Download sample program Program.cs