Skip to content

Commit e5e7728

Browse files
authored
Merge pull request #4190 from bclothier/FixDeploymentPath
Deployment bug fixes & Analyzer for new projects
2 parents f05357f + fc2c817 commit e5e7728

File tree

5 files changed

+60
-7
lines changed

5 files changed

+60
-7
lines changed

Rubberduck.Deployment/BuildRegistryScript.ps1

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,32 @@ function Restore-Environment {
6969
foreach-object { set-item Env:$($_.Name) $_.Value }
7070
}
7171

72+
# Remove older imported registry scripts for debug builds.
73+
function Clean-OldImports
74+
{
75+
param(
76+
[String] $dir
77+
)
78+
$i = 0;
79+
Get-ChildItem $dir -Filter DebugRegistryEntries.reg.imported_*.txt |
80+
Sort-Object Name -Descending |
81+
Foreach-Object {
82+
if($i -ge 10) {
83+
$_.Delete();
84+
}
85+
$i++;
86+
}
87+
}
88+
7289
Set-StrictMode -Version latest;
7390
$ErrorActionPreference = "Stop";
7491
$DebugUnregisterRun = $false;
7592

7693
try
7794
{
95+
# Clean imports older than 10 builds
96+
Clean-OldImports ((Get-ScriptDirectory) + "\LocalRegistryEntries");;
97+
7898
# Allow multiple DLL files to be registered if necessary
7999
$separator = "|";
80100
$option = [System.StringSplitOptions]::RemoveEmptyEntries;
@@ -137,6 +157,22 @@ try
137157
$dllXml = $targetDll + ".xml";
138158
$tlbXml = $targetTlb32 + ".xml";
139159

160+
# Write-Host "Variable printout:"
161+
# Write-Host "dllFile = $dllFile";
162+
# Write-Host "idlFile = $idlFile";
163+
# Write-Host "tlb32File = $tlb32File";
164+
# Write-Host "tlb64File = $tlb64File";
165+
# Write-Host "sourceDll = $sourceDll";
166+
# Write-Host "targetDll = $targetDll";
167+
# Write-Host "sourceTlb32 = $sourceTlb32";
168+
# Write-Host "targetTlb32 = $targetTlb32";
169+
# Write-Host "sourceTlb64 = $sourceTlb64";
170+
# Write-Host "targetTlb64 = $targetTlb64";
171+
# Write-Host "dllXml = $dllXml";
172+
# Write-Host "tlbXml = $tlbXml";
173+
# Write-Host "targetDir = $targetDir";
174+
# Write-Host "";
175+
140176
# Use for debugging issues with passing parameters to the external programs
141177
# Note that it is not legal to have syntax like `& $cmdIncludingArguments` or `& $cmd $args`
142178
# For simplicity, the arguments are pass in literally.
@@ -151,12 +187,21 @@ try
151187
$encoding = New-Object System.Text.UTF8Encoding $true;
152188
[System.IO.File]::WriteAllLines($idlFile, $idl, $encoding);
153189

154-
$origEnv = Get-Environment
190+
$origEnv = Get-Environment;
155191
try {
156192
Invoke-CmdScript "$devPath";
157-
158-
& "midl.exe" ""$idlFile"" /win32 /out ""$targetDir"" /tlb ""$tlb32File"";
159-
& "midl.exe" ""$idlFile"" /amd64 /out ""$targetDir"" /tlb ""$tlb64File"";
193+
194+
if($targetDir.EndsWith("\"))
195+
{
196+
$targetDirWithoutSlash = $targetDir.Substring(0,$targetDir.Length-1);
197+
}
198+
else
199+
{
200+
$targetDirWithoutSlash = $targetDir;
201+
}
202+
203+
& midl.exe /win32 /tlb ""$tlb32File"" ""$idlFile"" /out ""$targetDirWithoutSlash"";
204+
& midl.exe /amd64 /tlb ""$tlb64File"" ""$idlFile"" /out ""$targetDirWithoutSlash"";
160205
} catch {
161206
throw;
162207
} finally {

Rubberduck.Deployment/Rubberduck.Deployment.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@
116116
</ItemGroup>
117117
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
118118
<PropertyGroup>
119-
<PostBuildEvent>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -command "$(ProjectDir)BuildRegistryScript.ps1 -config '$(ConfigurationName)' -builderAssemblyPath '$(TargetPath)' -netToolsDir '$(FrameworkSDKDir)bin\NETFX 4.6.1 Tools\' -wixToolsDir '$(ProjectDir)WixToolset\' -sourceDir '$(TargetDir)' -targetDir '$(TargetDir)' -projectDir '$(ProjectDir)' -includeDir '$(ProjectDir)InnoSetup\Includes\' -filesToExtract 'Rubberduck.dll|Rubberduck.API.dll'"</PostBuildEvent>
119+
<PostBuildEvent>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -command "&amp; '$(ProjectDir)BuildRegistryScript.ps1' -config '$(ConfigurationName)' -builderAssemblyPath '$(TargetPath)' -netToolsDir '$(FrameworkSDKDir)bin\NETFX 4.6.1 Tools\' -wixToolsDir '$(ProjectDir)WixToolset\' -sourceDir '$(TargetDir)' -targetDir '$(TargetDir)' -projectDir '$(ProjectDir)' -includeDir '$(ProjectDir)InnoSetup\Includes\' -filesToExtract 'Rubberduck.dll|Rubberduck.API.dll'"</PostBuildEvent>
120120
</PropertyGroup>
121121
<PropertyGroup>
122-
<PreBuildEvent>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -command "$(ProjectDir)PreInnoSetupConfiguration.ps1 -WorkingDir $(ProjectDir)</PreBuildEvent>
122+
<PreBuildEvent>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -command "&amp; '$(ProjectDir)PreInnoSetupConfiguration.ps1' -WorkingDir '$(ProjectDir)'"</PreBuildEvent>
123123
</PropertyGroup>
124124
</Project>

Rubberduck.Interaction/Rubberduck.Interaction.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@
4646
<Compile Include="IMessageBox.cs" />
4747
<Compile Include="Properties\AssemblyInfo.cs" />
4848
</ItemGroup>
49+
<ItemGroup>
50+
<Analyzer Include="..\RubberduckCodeAnalysis\bin\Release\RubberduckCodeAnalysis.dll" />
51+
</ItemGroup>
4952
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5053
</Project>

Rubberduck.Refactorings/Rubberduck.Refactorings.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,8 @@
104104
<ItemGroup>
105105
<None Include="packages.config" />
106106
</ItemGroup>
107+
<ItemGroup>
108+
<Analyzer Include="..\RubberduckCodeAnalysis\bin\Release\RubberduckCodeAnalysis.dll" />
109+
</ItemGroup>
107110
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
108111
</Project>

Rubberduck.Resources/Rubberduck.Resources.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@
622622
<SubType>Designer</SubType>
623623
</EmbeddedResource>
624624
</ItemGroup>
625-
<ItemGroup />
626625
<ItemGroup>
627626
<Resource Include="Icons\Fugue\application-resize.png" />
628627
</ItemGroup>
@@ -873,5 +872,8 @@
873872
<Resource Include="Icons\Fugue\arrow1.png" />
874873
<Content Include="Icons\Fugue\arrow_circle_double_mask.bmp" />
875874
</ItemGroup>
875+
<ItemGroup>
876+
<Analyzer Include="..\RubberduckCodeAnalysis\bin\Release\RubberduckCodeAnalysis.dll" />
877+
</ItemGroup>
876878
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
877879
</Project>

0 commit comments

Comments
 (0)