# New-ExplicitFileSource

Creates new File source that can be added to a Sitecore package.

## Syntax

New-ExplicitFileSource \[-Name] \<String> \[-File \<FileSystemInfo>] \[-InstallMode \<String>]

## Detailed Description

Creates new File source that can be added to a Sitecore package. Folder provided as Root will be added as well as all of its content provided it matches the filters.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

## Parameters

### -Name \<String>

Name of the file source.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | 1     |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -File \<FileSystemInfo>

Path to the file to be included. this can be automatically discovered if a stream of files is piped to the command.

| Aliases                     |                |
| --------------------------- | -------------- |
| Required?                   | false          |
| Position?                   | named          |
| Default Value               |                |
| Accept Pipeline Input?      | true (ByValue) |
| Accept Wildcard Characters? | false          |

### -InstallMode \<String>

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

## Outputs

The output type is the type of the objects that the cmdlet emits.

* Sitecore.Install.Files.ExplicitFileSource

## Notes

Help Author: Adam Najmanowicz, Michael West

## Examples

### EXAMPLE

Following example creates a new package, adds content of the Console folder (except the source files) under the site folder saves it in the Sitecore Package folder + gives you an option to download the saved package.

```powershell
# Create package
$package = New-Package "Packing in Powerful Ways";

# Set package metadata
$package.Sources.Clear();

$package.Metadata.Author = "Adam Najmanowicz, Michael West";
$package.Metadata.Publisher = "Powerful Ways";
$package.Metadata.Version = "1.0";
$package.Metadata.Readme = 'This text will be visible to people installing your package'

# Add content of the Console folder (except the source files) located in the site folder to the package
$source = Get-ChildItem -exclude *.cs -Path "$AppPath\Console" -Recurse -File | New-ExplicitFileSource -Name "Console Assets"
$package.Sources.Add($source);

# Save package
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip

# Offer the user to download the package
Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip"
```

## Related Topics

* [Export-Package](/appendix/packaging/export-package.md)
* [Get-Package](/appendix/packaging/get-package.md)
* Import-Package
* [Install-UpdatePackage](/appendix/packaging/install-updatepackage.md)
* [New-ExplicitItemSource](/appendix/packaging/new-explicititemsource.md)
* [New-FileSource](/appendix/packaging/new-filesource.md)
* [New-ItemSource](/appendix/packaging/new-itemsource.md)
* [New-Package](/appendix/packaging/new-package.md)
* <https://github.com/SitecorePowerShell/Console/>
* <https://blog.najmanowicz.com/2011/12/19/continuous-deployment-in-sitecore-with-powershell/>
* <https://gist.github.com/AdamNaj/f4251cb2645a1bfcddae>
* <https://www.youtube.com/watch?v=60BGRDNONo0&list=PLph7ZchYd_nCypVZSNkudGwPFRqf1na0b&index=7>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.sitecorepowershell.com/appendix/packaging/new-explicitfilesource.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
