Skip to content

Commit 8a14d62

Browse files
committed
Use MSBuild to copy assemblies to module output path
This change makes running PowerShellEditorServices.Host unit tests from within Visual Studio easier because MSBuild now takes care of copying the build assemblies to the final output path without relying on the build script.
1 parent 4987425 commit 8a14d62

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,6 @@ task CITest (job Test -Safe), {
172172
}
173173
}
174174

175-
task LayoutModule -After Build {
176-
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices\bin\ -Type Directory | Out-Null
177-
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop -Type Directory | Out-Null
178-
New-Item -Force $PSScriptRoot\module\PowerShellEditorServices\bin\Core -Type Directory | Out-Null
179-
180-
if (!$script:IsUnix) {
181-
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
182-
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\net451\Newtonsoft.Json.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Desktop\
183-
}
184-
Copy-Item -Force -Path $PSScriptRoot\src\PowerShellEditorServices.Host\bin\$Configuration\netstandard1.6\* -Filter Microsoft.PowerShell.EditorServices*.dll -Destination $PSScriptRoot\module\PowerShellEditorServices\bin\Core\
185-
}
186-
187175
task PackageNuGet {
188176
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices\PowerShellEditorServices.csproj $script:TargetFrameworksParam }
189177
exec { & $script:dotnetExe pack -c $Configuration --version-suffix $script:VersionSuffix .\src\PowerShellEditorServices.Protocol\PowerShellEditorServices.Protocol.csproj $script:TargetFrameworksParam }

src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,26 @@
3131
<Reference Include="System" />
3232
<Reference Include="Microsoft.CSharp" />
3333
</ItemGroup>
34+
35+
<ItemGroup>
36+
<OutputDlls Include="bin\$(Configuration)\$(TargetFramework)\Microsoft.PowerShell.EditorServices.*.dll" />
37+
</ItemGroup>
38+
39+
<Target Name="CopyToModulePath" AfterTargets="Build">
40+
<Copy
41+
Condition=" '$(TargetFramework)' == 'net451' "
42+
SkipUnchangedFiles="true"
43+
SourceFiles="@(OutputDlls)"
44+
DestinationFolder="..\..\module\PowerShellEditorServices\bin\Desktop\" />
45+
<Copy
46+
Condition=" '$(TargetFramework)' == 'net451' "
47+
SkipUnchangedFiles="true"
48+
SourceFiles="bin\$(Configuration)\$(TargetFramework)\Newtonsoft.Json.dll"
49+
DestinationFolder="..\..\module\PowerShellEditorServices\bin\Desktop\" />
50+
<Copy
51+
Condition=" '$(TargetFramework)' == 'netstandard1.6' "
52+
SkipUnchangedFiles="true"
53+
SourceFiles="@(OutputDlls)"
54+
DestinationFolder="..\..\module\PowerShellEditorServices\bin\Core\" />
55+
</Target>
3456
</Project>

0 commit comments

Comments
 (0)