Skip to content

Commit 407f2cb

Browse files
Merge pull request #15 from sql-bi/alberto/update-fx-costura
Remove Fody/Costura, fix assembly signing, bump 1.1.4 This pull request primarily focuses on removing the Fody/Costura assembly embedding dependency and fixing the code-signing process. The two main changes are: - Remove Fody/Costura: assembly embedding via Fody/Costura has been removed, simplifying dependency management and the build process. - Fix assembly signing: AnalyzeInExcel.exe and ExternalToolsInstaller.dll are now explicitly signed during the build. Previously, only the final MSI installer was signed, while the executable and DLL remained unsigned. **Build and Dependency Management** - Migrated NuGet dependency management from packages.config to PackageReference. - Removed the Fody/Costura dependency and its configuration files. - Upgraded the target framework from .NET Framework 4.5 to .NET Framework 4.7.2. **Build Automation and Signing** - Added a GitHub Actions workflow (.github/workflows/release.yml) to automate the build and release process. - Added explicit code signing for AnalyzeInExcel.exe and ExternalToolsInstaller.dll. - The final MSI installer continues to be signed after packaging. - Added verification steps to ensure that the binaries remain signed after the installer build. **Code and Version Updates** - Updated the application version to 1.1.4.0 in the assembly metadata and auto-updater XML. - Minor code fix: explicitly cast workbook.ActiveSheet to Excel.Worksheet in ExcelHelper.cs.
2 parents 846180e + 37ecb88 commit 407f2cb

20 files changed

Lines changed: 355 additions & 3655 deletions

.github/workflows/release.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Builds AnalyzeInExcel and its MSI installer, then uploads the MSI as a workflow
2+
# artifact and creates a GitHub release. Manual trigger only.
3+
#
4+
# IMPORTANT: If this workflow is modified, verify that signing is applied to both
5+
# the final MSI and the binaries it contains (EXE/DLL). Unsigned binaries may be
6+
# blocked by antivirus/security software and result in an unusable installation.
7+
8+
name: Release
9+
10+
on:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: write
15+
16+
env:
17+
BuildConfiguration: Release
18+
BuildPlatform: Any CPU
19+
20+
jobs:
21+
build-sign-release:
22+
runs-on: windows-2022
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v7
27+
28+
- name: Setup MSBuild
29+
uses: microsoft/setup-msbuild@v3
30+
31+
- name: Install AzureSignTool
32+
shell: pwsh
33+
run: dotnet tool install --global AzureSignTool
34+
35+
- name: Install Visual Studio Installer Projects extension
36+
shell: pwsh
37+
run: |
38+
# Required to build the .vdproj setup project via devenv.
39+
# If this step starts failing, check the current VSIX id/version on the
40+
# Visual Studio Marketplace for "Microsoft Visual Studio Installer Projects 2022".
41+
$vsixUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/visualstudioclient/vsextensions/microsoftvisualstudio2022installerprojects/2.0.1/vspackage"
42+
$vsixPath = "$env:TEMP\InstallerProjects.vsix"
43+
Invoke-WebRequest -Uri $vsixUrl -OutFile $vsixPath
44+
45+
$vsixInstaller = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VSIXInstaller.exe"
46+
$process = Start-Process -FilePath $vsixInstaller -ArgumentList "/quiet", "/admin", $vsixPath -Wait -PassThru
47+
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne 1001) {
48+
# 1001 = already installed
49+
throw "VSIXInstaller failed with exit code $($process.ExitCode)"
50+
}
51+
52+
- name: Restore and build solution
53+
shell: pwsh
54+
run: |
55+
msbuild AnalyzeInExcel.sln -t:Restore,Build `
56+
-p:Configuration=$env:BuildConfiguration `
57+
-p:Platform="$env:BuildPlatform" `
58+
-v:minimal
59+
60+
- name: Read version from build output
61+
id: version
62+
shell: pwsh
63+
run: |
64+
$rawVersion = (Get-Item "AnalyzeInExcel\bin\Release\AnalyzeInExcel.exe").VersionInfo.FileVersion
65+
# FileVersion is Major.Minor.Build.Revision (e.g. 1.1.4.0);
66+
# drop the revision to get a semver-style Major.Minor.Build.
67+
$version = ($rawVersion -split '\.')[0..2] -join '.'
68+
Write-Host "File version: $rawVersion -> $version"
69+
"fileVersion=$version" >> $env:GITHUB_OUTPUT
70+
71+
- name: Sign EXE/DLL
72+
shell: pwsh
73+
run: |
74+
# Sign both the intermediate (obj) and output (bin) copies.
75+
# The installer (.vdproj) build may build project dependencies and copy files
76+
# from obj to bin. If only the bin copies were signed, this could overwrite
77+
# the signed files with unsigned copies during the installer build. Signing
78+
# both locations ensures that either copy used by the installer remains signed.
79+
azuresigntool sign `
80+
-kvu "${{ secrets.CODESIGNING_VAULT_URL }}" `
81+
-kvt "${{ secrets.CODESIGNING_TENANT_ID }}" `
82+
-kvi "${{ secrets.CODESIGNING_CLIENT_ID }}" `
83+
-kvs "${{ secrets.CODESIGNING_CLIENT_SECRET }}" `
84+
-kvc "${{ secrets.CODESIGNING_CERTIFICATE_NAME }}" `
85+
-tr http://timestamp.digicert.com `
86+
-td sha256 -fd sha256 -v `
87+
"AnalyzeInExcel\obj\Release\AnalyzeInExcel.exe" `
88+
"AnalyzeInExcel\bin\Release\AnalyzeInExcel.exe" `
89+
"ExternalToolsInstaller\obj\Release\ExternalToolsInstaller.dll" `
90+
"ExternalToolsInstaller\bin\Release\ExternalToolsInstaller.dll"
91+
92+
- name: Disable out-of-proc build (VDPROJ CLI workaround)
93+
shell: pwsh
94+
working-directory: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild
95+
run: |
96+
# devenv's command-line build of a .vdproj runs its pre-build validation
97+
# out-of-process; on a CI agent this reliably fails with
98+
# "An error occurred while validating. HRESULT = '8000000A'".
99+
# DisableOutOfProcBuild.exe fails to find the VS instance unless the
100+
# current directory is the tool's own folder when it's invoked - see
101+
# https://github.com/it3xl/MSBuild-DevEnv-Build-Server-Workarounds/issues/1
102+
.\DisableOutOfProcBuild.exe
103+
if ($LASTEXITCODE -ne 0) {
104+
throw "DisableOutOfProcBuild.exe failed with exit code $LASTEXITCODE"
105+
}
106+
107+
- name: Build installer (.vdproj)
108+
shell: pwsh
109+
run: |
110+
# Build only the setup project, not the whole solution, so that once
111+
# signing is re-enabled above, the already-signed EXE/DLL are packaged
112+
# as-is and not recompiled (which would silently overwrite them with
113+
# unsigned output).
114+
$devenv = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.com"
115+
& $devenv "AnalyzeInExcel.sln" /Build $env:BuildConfiguration /Project "SetupAnalyzeInExcel\SetupAnalyzeInExcel.vdproj"
116+
if ($LASTEXITCODE -ne 0) {
117+
throw "devenv installer build failed with exit code $LASTEXITCODE"
118+
}
119+
120+
- name: Re-enable out-of-proc build
121+
shell: pwsh
122+
working-directory: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild
123+
run: .\DisableOutOfProcBuild.exe undo
124+
125+
- name: Sign MSI
126+
shell: pwsh
127+
run: |
128+
azuresigntool sign `
129+
-kvu "${{ secrets.CODESIGNING_VAULT_URL }}" `
130+
-kvt "${{ secrets.CODESIGNING_TENANT_ID }}" `
131+
-kvi "${{ secrets.CODESIGNING_CLIENT_ID }}" `
132+
-kvs "${{ secrets.CODESIGNING_CLIENT_SECRET }}" `
133+
-kvc "${{ secrets.CODESIGNING_CERTIFICATE_NAME }}" `
134+
-tr http://timestamp.digicert.com `
135+
-td sha256 -fd sha256 -v `
136+
"SetupAnalyzeInExcel\Release\AnalyzeInExcel.msi"
137+
138+
- name: Rename MSI with version
139+
shell: pwsh
140+
run: |
141+
$fileVersion = "${{ steps.version.outputs.fileVersion }}"
142+
Move-Item "SetupAnalyzeInExcel\Release\AnalyzeInExcel.msi" "SetupAnalyzeInExcel\Release\AnalyzeInExcel-$fileVersion.msi"
143+
144+
- name: Upload artifact (drop)
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: drop
148+
path: SetupAnalyzeInExcel/Release/AnalyzeInExcel-${{ steps.version.outputs.fileVersion }}.msi
149+
150+
# - name: Publish GitHub Release (TODO)
151+
# uses: ...
152+

AnalyzeInExcel/AnalyzeInExcel.csproj

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" />
43
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
54
<PropertyGroup>
65
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,7 +8,7 @@
98
<OutputType>WinExe</OutputType>
109
<RootNamespace>AnalyzeInExcel</RootNamespace>
1110
<AssemblyName>AnalyzeInExcel</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1312
<FileAlignment>512</FileAlignment>
1413
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1514
<WarningLevel>4</WarningLevel>
@@ -64,45 +63,10 @@
6463
<ApplicationIcon>icon-2400px.ico</ApplicationIcon>
6564
</PropertyGroup>
6665
<ItemGroup>
67-
<Reference Include="AutoUpdater.NET, Version=1.6.3.0, Culture=neutral, PublicKeyToken=501435c91b35f4bc, processorArchitecture=MSIL">
68-
<HintPath>..\packages\Autoupdater.NET.Official.1.6.3\lib\net45\AutoUpdater.NET.dll</HintPath>
69-
</Reference>
70-
<Reference Include="CommandLine, Version=2.8.0.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
71-
<HintPath>..\packages\CommandLineParser.2.8.0\lib\net45\CommandLine.dll</HintPath>
72-
<Private>True</Private>
73-
</Reference>
74-
<Reference Include="Costura, Version=3.3.3.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
75-
<HintPath>..\packages\Costura.Fody.3.3.3\lib\net40\Costura.dll</HintPath>
76-
</Reference>
77-
<Reference Include="Microsoft.ApplicationInsights, Version=2.14.0.17971, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
78-
<HintPath>..\packages\Microsoft.ApplicationInsights.2.14.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
79-
<Private>True</Private>
80-
</Reference>
81-
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
82-
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
83-
<EmbedInteropTypes>True</EmbedInteropTypes>
84-
</Reference>
8566
<Reference Include="System" />
86-
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
87-
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
88-
<Private>True</Private>
89-
</Reference>
9067
<Reference Include="System.Data" />
91-
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
92-
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net45\System.Diagnostics.DiagnosticSource.dll</HintPath>
93-
</Reference>
94-
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
95-
<HintPath>..\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll</HintPath>
96-
<Private>True</Private>
97-
</Reference>
9868
<Reference Include="System.Net.Http" />
99-
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
100-
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
101-
</Reference>
10269
<Reference Include="System.Runtime.Serialization" />
103-
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
104-
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
105-
</Reference>
10670
<Reference Include="System.Xml" />
10771
<Reference Include="Microsoft.CSharp" />
10872
<Reference Include="System.Core" />
@@ -165,7 +129,6 @@
165129
</EmbeddedResource>
166130
<None Include="analyzeinexcel.pbitool.json" />
167131
<None Include="app.config" />
168-
<None Include="packages.config" />
169132
<None Include="Properties\Settings.settings">
170133
<Generator>SettingsSingleFileGenerator</Generator>
171134
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -178,23 +141,26 @@
178141
<Resource Include="banner-500x70.jpg" />
179142
<Content Include="ExcelIconFromSvg.png" />
180143
</ItemGroup>
181-
<ItemGroup>
182-
<Resource Include="FodyWeavers.xml" />
183-
</ItemGroup>
184144
<ItemGroup>
185145
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
186146
<Visible>False</Visible>
187147
<ProductName>.NET Framework 3.5 SP1</ProductName>
188148
<Install>false</Install>
189149
</BootstrapperPackage>
190150
</ItemGroup>
151+
<ItemGroup>
152+
<PackageReference Include="Autoupdater.NET.Official">
153+
<Version>1.6.3</Version>
154+
</PackageReference>
155+
<PackageReference Include="CommandLineParser">
156+
<Version>2.8.0</Version>
157+
</PackageReference>
158+
<PackageReference Include="Microsoft.ApplicationInsights">
159+
<Version>2.23.0</Version>
160+
</PackageReference>
161+
<PackageReference Include="Microsoft.Office.Interop.Excel">
162+
<Version>15.0.4795.1000</Version>
163+
</PackageReference>
164+
</ItemGroup>
191165
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
192-
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
193-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
194-
<PropertyGroup>
195-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
196-
</PropertyGroup>
197-
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
198-
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props'))" />
199-
</Target>
200166
</Project>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<item>
3-
<version>1.1.3.0</version>
4-
<url>https://cdn.sqlbi.com/updates/AnalyzeInExcel-1.1.3.msi</url>
3+
<version>1.1.4.0</version>
4+
<url>https://cdn.sqlbi.com/updates/AnalyzeInExcel-1.1.4.msi</url>
55
<changelog>https://github.com/sql-bi/AnalyzeInExcel/releases/</changelog>
66
<mandatory>false</mandatory>
77
</item>

AnalyzeInExcel/ExcelHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static bool CreateInstanceWithPivotTableViaInterop(string serverName, str
7474
pivotCache.RefreshOnFileOpen = false;
7575

7676
// Get the active worksheet
77-
var worksheet = workbook.ActiveSheet;
77+
var worksheet = (Excel.Worksheet)workbook.ActiveSheet;
7878

7979
// Create the PivotTable
8080
var pivotTable = pivotCache.CreatePivotTable(

AnalyzeInExcel/FodyWeavers.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)