forked from JKerens/build-powershell-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.PowerShell.csproj
More file actions
29 lines (23 loc) · 1.27 KB
/
Build.PowerShell.csproj
File metadata and controls
29 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Build.PowerShell</AssemblyName>
<OutDir>artifacts</OutDir>
</PropertyGroup>
<ItemGroup>
<!-- Copies the psd1 file and flattens the directory with TargetPath-->
<None Include="$(ProjectDir)\src\**\*.psd1" TargetPath="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest"/>
<!-- Finds all ps1 files for merging -->
<MyPowerShellFiles Include="src\**\*.ps1"/>
</ItemGroup>
<Target Name="CombineFiles" AfterTargets="CopyFilesToOutputDirectory">
<!-- loops through all the ps1 files and reads them in the ItemsFromFile variable -->
<ReadLinesFromFile File="%(MyPowerShellFiles.Identity)">
<Output TaskParameter="Lines" ItemName="ItemsFromFile"/>
</ReadLinesFromFile>
<!-- Resets the psm1 file and injects the needed using statement to consume our sdk project -->
<WriteLinesToFile File="$(OutDir)\$(AssemblyName).psm1" Lines="using module '.\$(AssemblyName).dll'" Overwrite="true" Encoding="Unicode"/>
<!-- writes all of the functions into a single psm1 file -->
<WriteLinesToFile File="$(OutDir)\$(AssemblyName).psm1" Lines="@(ItemsFromFile)" Overwrite="false" Encoding="Unicode"/>
</Target>
</Project>