Initializing and removing modules

The content of the root module executes every time a module is imported. A root module file may be used to perform initialization steps, perhaps filling cache files, importing static data, or setting a default configuration. These steps are extra code that must be added to the root module, perhaps at the beginning or end of the file.

If a module is being built, and the root module is automatically generated, the additional content would need to be drawn in by the merge script. The ModuleBuilder module, introduced when exploring merging content in this chapter, achieves this by using the Prefix and Suffix parameters. Values for this parameter may be supplied when running Build-Module or added to the build.psd1 file. These parameters allow the developer to inject the content of a named script at the beginning (prefix), or end (suffix), of the root module file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.57.49