gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
167 stars 42 forks source link

Where do I place additional files? #490

Open DennisL68 opened 4 weeks ago

DennisL68 commented 4 weeks ago

Where do I place additional static data files so that they will be part of the module such as .json, .xml, .png etc.?

I.e. files that I would normally specify in the .psd1 file of the module.

# List of all files packaged with this module
# FileList = @()

I tried adding a file by hand in the output folder, hoping that .\build.ps1 pack would include it and then including it in the manifest file, but that failed as pack cleans the output folder first.

# List of all files packaged with this module
FileList = @('files\data.json')

ERROR: Module manifest file validation failed with error: The specified FileList entry 'files\data.json' in the module manifest '...\CompleteSample\output\module\CompleteSample\0.0.1\CompleteSample.psd1' is invalid. Try again after updating this entry with valid values..

The Test-ModuleManifest .\CompleteSample.psd1 tests successfully if run before pack removes my added file from the output folder.

johlju commented 4 weeks ago

That is not automatically supported. You can place them where you like and use CopyPaths: then update module manifest manually.

DennisL68 commented 3 weeks ago

But won't this be reset when I user .\build.ps pack?

johlju commented 3 weeks ago

The module manifest is in source - you have to test if it is retained from source to output during build.

johlju commented 3 weeks ago

During build phase you need to make the built module they way you want to have it before deploying.