Skip to content

Commit 354e87c

Browse files
Improved the Setup script; Improved versioning; Several minor fixes.
1 parent 8425436 commit 354e87c

3 files changed

Lines changed: 60 additions & 24 deletions

File tree

CalibreImport/CalibreImport.csproj

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- Import common properties -->
35
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
6+
7+
<!-- General Property Group -->
48
<PropertyGroup>
59
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
610
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -16,6 +20,8 @@
1620
<AssemblyOriginatorKeyFile>CalibreImportKey.snk</AssemblyOriginatorKeyFile>
1721
<SignAssembly>true</SignAssembly>
1822
</PropertyGroup>
23+
24+
<!-- Debug Configuration Property Group -->
1925
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2026
<DebugSymbols>true</DebugSymbols>
2127
<DebugType>full</DebugType>
@@ -25,6 +31,8 @@
2531
<ErrorReport>prompt</ErrorReport>
2632
<WarningLevel>4</WarningLevel>
2733
</PropertyGroup>
34+
35+
<!-- Release Configuration Property Group -->
2836
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2937
<DebugType>pdbonly</DebugType>
3038
<Optimize>true</Optimize>
@@ -33,6 +41,8 @@
3341
<ErrorReport>prompt</ErrorReport>
3442
<WarningLevel>4</WarningLevel>
3543
</PropertyGroup>
44+
45+
<!-- Debug x64 Configuration Property Group -->
3646
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
3747
<DebugSymbols>true</DebugSymbols>
3848
<OutputPath>bin\x64\Debug\</OutputPath>
@@ -43,6 +53,8 @@
4353
<Optimize>false</Optimize>
4454
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
4555
</PropertyGroup>
56+
57+
<!-- Release x64 Configuration Property Group -->
4658
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
4759
<OutputPath>bin\x64\Release\</OutputPath>
4860
<DefineConstants>TRACE</DefineConstants>
@@ -51,6 +63,8 @@
5163
<PlatformTarget>x64</PlatformTarget>
5264
<ErrorReport>prompt</ErrorReport>
5365
</PropertyGroup>
66+
67+
<!-- References -->
5468
<ItemGroup>
5569
<Reference Include="System" />
5670
<Reference Include="System.Configuration" />
@@ -63,6 +77,8 @@
6377
<Reference Include="System.Configuration.Install" />
6478
<Reference Include="System.Xml" />
6579
</ItemGroup>
80+
81+
<!-- NuGet Package References -->
6682
<ItemGroup>
6783
<PackageReference Include="ILRepack">
6884
<Version>2.0.40</Version>
@@ -79,6 +95,8 @@
7995
<Version>9.0.3</Version>
8096
</PackageReference>
8197
</ItemGroup>
98+
99+
<!-- C# files being compiled -->
82100
<ItemGroup>
83101
<Compile Include="AutomergeOption.cs" />
84102
<Compile Include="BorderlessGroupBox.cs">
@@ -111,33 +129,49 @@
111129
<DependentUpon>SettingsForm.cs</DependentUpon>
112130
</Compile>
113131
</ItemGroup>
132+
133+
<!-- Resources for the Forms -->
114134
<ItemGroup>
115135
<EmbeddedResource Include="ImportForm.resx">
116136
<DependentUpon>ImportForm.cs</DependentUpon>
137+
<SubType>Designer</SubType>
117138
</EmbeddedResource>
118139
<EmbeddedResource Include="SettingsForm.resx">
119140
<DependentUpon>SettingsForm.cs</DependentUpon>
120141
<SubType>Designer</SubType>
121142
</EmbeddedResource>
122143
</ItemGroup>
123-
<ItemGroup>
124-
<None Include="app.config" />
125-
<None Include="CalibreImportKey.snk" />
126-
<None Include="PostBuild.ps1" />
127-
<None Include="Properties\Settings.settings">
128-
<Generator>SettingsSingleFileGenerator</Generator>
129-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
130-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
131-
</None>
132-
<None Include="Setup.ps1" />
133-
</ItemGroup>
144+
145+
<!-- Extra Files included in the Project (some in the Output too)-->
146+
<ItemGroup>
147+
<None Include="app.config" />
148+
<None Include="CalibreImportKey.snk" />
149+
<None Include="PostBuild.ps1" />
150+
<None Include="Properties\Settings.settings">
151+
<Generator>SettingsSingleFileGenerator</Generator>
152+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
153+
</None>
154+
<None Include="Setup.ps1">
155+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156+
</None>
157+
<None Include="CustomSettings.config">
158+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159+
</None>
160+
</ItemGroup>
161+
162+
<!-- Folder Item Group -->
134163
<ItemGroup>
135164
<Folder Include="ReleaseFiles\" />
136165
</ItemGroup>
166+
167+
<!-- Import CSharp targets -->
137168
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
169+
170+
<!-- PostBuild Target (runs a powershell postbuiold script which contains repack instructions-->
138171
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
139172
<Message Text="Running PostBuild script..." Importance="high" />
140173
<Exec Command="powershell -ExecutionPolicy Bypass -File &quot;$(ProjectDir)PostBuild.ps1&quot; -TargetDir &quot;$(TargetDir.TrimEnd('\&quot;'))&quot; -ProjectDir &quot;$(ProjectDir.TrimEnd('\&quot;'))&quot;" />
141174
<Message Text="PostBuild script completed." Importance="high" />
142175
</Target>
143-
</Project>
176+
177+
</Project>

CalibreImport/PostBuild.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Notice how carefully quotes are handled in the $TargedDir and $ProjectDir values
1717
$TargetDir = $TargetDir.TrimEnd('"')
1818

1919
# Temporary log file path for initial logging
20-
$tempLogFile = "C:\Temp\PostBuild_temp.log"
20+
# $tempLogFile = "C:\Temp\PostBuild_temp.log"
2121

2222
# Define the log file path
2323
$logFile = "$TargetDir\PostBuild.log"
@@ -37,7 +37,7 @@ function Log-Message {
3737
}
3838

3939
# Start logging to temporary log file
40-
Log-Message "PostBuild script started." $logFile #$tempLogFile
40+
Log-Message "===== PostBuild script started ===== " $logFile #$tempLogFile
4141
Log-Message "TargetDir: $TargetDir" $logFile #$tempLogFile
4242

4343
# Log the constructed log file path
@@ -56,10 +56,10 @@ if (Test-Path $sharpShellPath) {
5656
}
5757

5858
# Continue logging to the actual log file
59-
Log-Message "PostBuild script started." $logFile
59+
# Log-Message "PostBuild script started." $logFile
6060

6161
# Path to ilRepack executable
62-
$ilRepackPath = "C:\Users\jago\.nuget\packages\ilrepack\2.0.40\tools\ILRepack.exe"
62+
$ilRepackPath = "$env:USERPROFILE\.nuget\packages\ilrepack\2.0.40\tools\ILRepack.exe"
6363

6464
# List of DLLs to be repacked
6565
$dllsToRepack = @(
@@ -88,7 +88,7 @@ try {
8888
}
8989

9090
# Rename the repacked DLL to remove 'Repacked.' from the name
91-
$finalDll = "$TargetDir\CalibreImport.dll"
91+
$finalDll = "$TargetDir\$dllName.dll"
9292
Rename-Item -Path $outputDll -NewName (Split-Path $finalDll -Leaf)
9393
Log-Message "Renamed repacked DLL to: $finalDll" $logFile
9494
} else {
@@ -108,7 +108,8 @@ if (-not (Test-Path $releaseFilesDir)) {
108108
# Files to copy from bin\Release
109109
$filesToCopyFromBin = @(
110110
"CustomSettings.config",
111-
"CalibreImport.dll"
111+
"$dllName.dll",
112+
"Setup.ps1"
112113
)
113114

114115
foreach ($file in $filesToCopyFromBin) {
@@ -122,15 +123,16 @@ foreach ($file in $filesToCopyFromBin) {
122123
}
123124
}
124125

125-
# Copy Setup.ps1 from project root to ReleaseFiles directory
126+
<# Copy Setup.ps1 from project root to ReleaseFiles directory
127+
Not needed, since this is done by csproj file.
126128
$setupScriptPath = "$ProjectDir\Setup.ps1"
127129
$setupScriptDestination = "$releaseFilesDir\Setup.ps1"
128130
if (Test-Path $setupScriptPath) {
129131
Copy-Item -Path $setupScriptPath -Destination $setupScriptDestination -Force
130132
Log-Message "Copied Setup.ps1 to ReleaseFiles directory." $logFile
131133
} else {
132134
Log-Message "Setup.ps1 not found: $setupScriptPath" $logFile
133-
}
135+
} #>
134136

135137
# End logging
136138
Log-Message "PostBuild script ended." $logFile

CalibreImport/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// General Information about an assembly is controlled through the following
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
8-
[assembly: AssemblyTitle("ImportToCalibreExtension")]
8+
[assembly: AssemblyTitle("Calibre Import Shell Extension")]
99
[assembly: AssemblyDescription("")]
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Tuscoss")]
12-
[assembly: AssemblyProduct("ImportToCalibreExtension")]
12+
[assembly: AssemblyProduct("CalibreImport")]
1313
[assembly: AssemblyCopyright("Copyright © 2025")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
@@ -29,5 +29,5 @@
2929
// Build Number
3030
// Revision
3131
//
32-
[assembly: AssemblyVersion("1.0.27.0")]
33-
[assembly: AssemblyFileVersion("1.0.27.0")]
32+
[assembly: AssemblyVersion("1.0.2.8")]
33+
[assembly: AssemblyFileVersion("1.0.2.8")]

0 commit comments

Comments
 (0)