Skip to content

Commit fc8adc6

Browse files
BugFix:
rc.exe is part of C++ dev tools and not part of C#. Manually search for rc.exe. Also: Replacing hard coded entries of rc-script with defines.
1 parent 8432adf commit fc8adc6

4 files changed

Lines changed: 114 additions & 66 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <winres.h>
2+
3+
1 VERSIONINFO
4+
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_REVISION
5+
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,VERSION_REVISION
6+
FILEOS (VOS_NT | VOS__WINDOWS32)
7+
FILETYPE VFT_DLL
8+
FILESUBTYPE 0
9+
BEGIN
10+
BLOCK "StringFileInfo"
11+
BEGIN
12+
BLOCK "040904e4"
13+
BEGIN
14+
VALUE "Comments", COMMENTS
15+
VALUE "CompanyName", COMPANY_NAME
16+
VALUE "FileDescription", FILE_DESCRIPTION
17+
VALUE "FileVersion", FILE_VERSION
18+
VALUE "InternalName", INTERNAL_NAME
19+
VALUE "LegalCopyright", LEGAL_COPYRIGHT
20+
VALUE "OriginalFilename", ORIGINAL_FILENAME
21+
VALUE "ProductName", PRODUCT_NAME
22+
VALUE "ProductVersion", PRODUCT_VERSION
23+
END
24+
END
25+
26+
BLOCK "VarFileInfo"
27+
BEGIN
28+
VALUE "Translation", 0x409, 1200
29+
END
30+
END
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$kitsRoot = (Get-ItemProperty `
2+
-Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" `
3+
-Name "KitsRoot10").KitsRoot10
4+
5+
$binRoot = Join-Path $kitsRoot "bin"
6+
7+
$version = Get-ChildItem $binRoot -Directory |
8+
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
9+
Sort-Object Name -Descending |
10+
Select-Object -First 1
11+
12+
if ($version) {
13+
Write-Output $version.Name
14+
exit 0
15+
}
16+
17+
exit 1

CompressedFileViewer/CompressedFileViewer.plugin.csproj

Lines changed: 67 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@
2828
<ApplicationIcon>icons\gzip.ico</ApplicationIcon>
2929
</PropertyGroup>
3030
<ItemGroup>
31-
<Compile Remove="publish\**" />
32-
<EmbeddedResource Remove="publish\**" />
33-
<None Remove="publish\**" />
34-
<Page Remove="publish\**" />
31+
<Compile Remove="publish\**" />
32+
<EmbeddedResource Remove="publish\**" />
33+
<None Remove="publish\**" />
34+
<Page Remove="publish\**" />
3535
</ItemGroup>
3636

3737
<ItemGroup>
38-
<None Remove="icons\gzip-filled16.png" />
39-
<None Remove="icons\gzip.png" />
40-
38+
<None Remove="icons\gzip-filled16.png" />
39+
<None Remove="icons\gzip.png" />
40+
4141
</ItemGroup>
4242

4343
<ItemGroup>
44-
<EmbeddedResource Include="icons\gzip-filled16.png" />
44+
<EmbeddedResource Include="icons\gzip-filled16.png" />
4545
</ItemGroup>
4646

4747
<ItemGroup>
@@ -53,34 +53,34 @@
5353
</ItemGroup>
5454

5555
<ItemGroup>
56-
<Resource Include="icons\gzip.png" />
56+
<Resource Include="icons\gzip.png" />
5757
</ItemGroup>
5858

5959
<ItemGroup>
60-
<Compile Update="Windows\BrotliSettings.xaml.cs">
61-
<SubType>Code</SubType>
62-
</Compile>
63-
<Compile Update="Windows\BZip2SettingsDialog.xaml.cs">
64-
<SubType>Code</SubType>
65-
</Compile>
66-
<Compile Update="Windows\DecompressDialog.xaml.cs">
67-
<SubType>Code</SubType>
68-
</Compile>
69-
<Compile Update="Windows\XZSettingsDialog.xaml.cs">
70-
<SubType>Code</SubType>
71-
</Compile>
72-
<Compile Update="Windows\ZstdSettingsDialog.xaml.cs">
73-
<SubType>Code</SubType>
74-
</Compile>
60+
<Compile Update="Windows\BrotliSettings.xaml.cs">
61+
<SubType>Code</SubType>
62+
</Compile>
63+
<Compile Update="Windows\BZip2SettingsDialog.xaml.cs">
64+
<SubType>Code</SubType>
65+
</Compile>
66+
<Compile Update="Windows\DecompressDialog.xaml.cs">
67+
<SubType>Code</SubType>
68+
</Compile>
69+
<Compile Update="Windows\XZSettingsDialog.xaml.cs">
70+
<SubType>Code</SubType>
71+
</Compile>
72+
<Compile Update="Windows\ZstdSettingsDialog.xaml.cs">
73+
<SubType>Code</SubType>
74+
</Compile>
7575
</ItemGroup>
7676

7777
<ItemGroup>
78-
<None Update="icons\gzip-filled.png">
79-
<Pack>True</Pack>
80-
<PackagePath>\</PackagePath>
81-
</None>
78+
<None Update="icons\gzip-filled.png">
79+
<Pack>True</Pack>
80+
<PackagePath>\</PackagePath>
81+
</None>
8282
</ItemGroup>
83-
83+
8484
<PropertyGroup Condition="'$(Platform)'=='x86'">
8585
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
8686
<PlatformTarget>x86</PlatformTarget>
@@ -93,21 +93,55 @@
9393
<NppDir>$(NppDir64)</NppDir>
9494
</PropertyGroup>
9595

96+
97+
98+
<!-- =========================
99+
SDK Discovery
100+
========================= -->
101+
<Target Name="FindSdkVersion" BeforeTargets="Build">
102+
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -File &quot;$(MSBuildProjectDirectory)\Build\Find-SdkVersion.ps1&quot;" ConsoleToMSBuild="true">
103+
<Output TaskParameter="ConsoleOutput" PropertyName="WindowsSdkVersion" />
104+
</Exec>
105+
106+
<PropertyGroup>
107+
<WindowsSdkVersion>$([System.String]::Copy('$(WindowsSdkVersion)').Trim())</WindowsSdkVersion>
108+
<WindowsKitsRoot>$([System.String]::Copy('$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots@KitsRoot10)').Trim())</WindowsKitsRoot>
109+
</PropertyGroup>
110+
</Target>
111+
112+
<!-- =========================
113+
Resource Properties
114+
========================= -->
96115
<PropertyGroup>
97-
<!-- https://github.com/AaronRobinsonMSFT/DNNE/issues/197#issuecomment-2621208585 -->
98116
<Win32Resources>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)$(DnneNativeBinaryName).res</Win32Resources>
99117
<DnneLinkerUserFlags>$(Win32Resources)</DnneLinkerUserFlags>
118+
119+
<VersionMajor>$([System.Version]::Parse('$(AssemblyVersion)').Major)</VersionMajor>
120+
<VersionMinor>$([System.Version]::Parse('$(AssemblyVersion)').Minor)</VersionMinor>
121+
<VersionBuild>$([System.Version]::Parse('$(AssemblyVersion)').Build)</VersionBuild>
122+
<VersionRevision>$([System.Version]::Parse('$(AssemblyVersion)').Revision)</VersionRevision>
100123
</PropertyGroup>
101124

102-
<Target Name="CompileWin32Resources" BeforeTargets="CoreCompile" Condition="!Exists('$(Win32Resources)')">
103-
<Exec Command="rc.exe /fo $(Win32Resources) $(MSBuildProjectDirectory)\$(DnneNativeBinaryName).rc"/>
125+
<!-- =========================
126+
RC Compilation
127+
========================= -->
128+
<Target Name="CompileResources" BeforeTargets="CoreCompile" DependsOnTargets="FindSdkVersion">
129+
130+
<PropertyGroup>
131+
<RcExePath>$(WindowsKitsRoot)bin\$(WindowsSdkVersion)\x64\rc.exe</RcExePath>
132+
<WindowsSdkInclude>$(WindowsKitsRoot)Include\$(WindowsSdkVersion)\um;$(WindowsKitsRoot)Include\$(WindowsSdkVersion)\shared</WindowsSdkInclude>
133+
</PropertyGroup>
134+
135+
<Exec Command="&quot;$(RcExePath)&quot; /I &quot;$(WindowsSdkInclude)&quot; /d VERSION_MAJOR=$(VersionMajor) /d VERSION_MINOR=$(VersionMinor) /d VERSION_BUILD=$(VersionBuild) /d VERSION_REVISION=$(VersionRevision) /d COMMENTS=&quot;\&quot;$(Description)\&quot;&quot; /d COMPANY_NAME=&quot;\&quot;$(Company)\&quot;&quot; /d FILE_DESCRIPTION=&quot;\&quot;$(Description)\&quot;&quot; /d FILE_VERSION=&quot;\&quot;$(AssemblyVersion)\&quot;&quot; /d INTERNAL_NAME=&quot;\&quot;$(DnneNativeBinaryName).dll\&quot;&quot; /d LEGAL_COPYRIGHT=&quot;\&quot;$(Copyright)\&quot;&quot; /d ORIGINAL_FILENAME=&quot;\&quot;$(DnneNativeBinaryName).dll\&quot;&quot; /d PRODUCT_NAME=&quot;\&quot;$(Product)\&quot;&quot; /d PRODUCT_VERSION=&quot;\&quot;$(Version)\&quot;&quot; /fo &quot;$(Win32Resources)&quot; &quot;$(MSBuildProjectDirectory)\Build\$(DnneNativeBinaryName).rc&quot;" />
136+
104137
</Target>
105138

106139
<Target Name="CopyFiles" AfterTargets="PostBuildEvent" Condition=" Exists('$(NppDir)\plugins') AND '$(NppDir)' != '' ">
107140
<ItemGroup>
108141
<Binaries Include="$(ProjectDir)$(OutDir)**\*.*" />
109142
</ItemGroup>
110-
<RemoveDir Directories="$(NppDir)\plugins\CompressedFileViewer" /> <!-- Remove old files -->
143+
<RemoveDir Directories="$(NppDir)\plugins\CompressedFileViewer" />
144+
<!-- Remove old files -->
111145
<MakeDir Directories="$(NppDir)\plugins\CompressedFileViewer" />
112146
<Copy SourceFiles="@(Binaries)" DestinationFolder="$(NppDir)\plugins\CompressedFileViewer" />
113147
</Target>

CompressedFileViewer/CompressedFileViewer.rc

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

0 commit comments

Comments
 (0)