From f548ff08d40638161ceeae3a32697359d30e3e80 Mon Sep 17 00:00:00 2001 From: softworkz Date: Sun, 7 Dec 2025 16:11:10 +0100 Subject: [PATCH] Add migration checks --- .../build/ElectronNET.Core.targets | 3 + .../build/ElectronNET.MigrationChecks.targets | 280 ++++++++++++++++++ 2 files changed, 283 insertions(+) create mode 100644 src/ElectronNET/build/ElectronNET.MigrationChecks.targets diff --git a/src/ElectronNET/build/ElectronNET.Core.targets b/src/ElectronNET/build/ElectronNET.Core.targets index 04022f7..39da417 100644 --- a/src/ElectronNET/build/ElectronNET.Core.targets +++ b/src/ElectronNET/build/ElectronNET.Core.targets @@ -23,4 +23,7 @@ + + + \ No newline at end of file diff --git a/src/ElectronNET/build/ElectronNET.MigrationChecks.targets b/src/ElectronNET/build/ElectronNET.MigrationChecks.targets new file mode 100644 index 0000000..df2336f --- /dev/null +++ b/src/ElectronNET/build/ElectronNET.MigrationChecks.targets @@ -0,0 +1,280 @@ + + + + + + ElectronCheckNoPackageJson; + ElectronCheckNoManifestJson; + ElectronCheckElectronBuilderJson; + ElectronCheckNoParentPaths; + ElectronCheckPubxmlFiles + + + + + + + + + + + + + <_InvalidPackageJson Include="$(MSBuildProjectDirectory)\**\package.json" + Exclude="$(MSBuildProjectDirectory)\ElectronHostHook\**\package.json; + $(MSBuildProjectDirectory)\bin\**\package.json; + $(MSBuildProjectDirectory)\obj\**\package.json; + $(MSBuildProjectDirectory)\publish\**\package.json; + $(MSBuildProjectDirectory)\node_modules\**\package.json" /> + <_InvalidPackageLockJson Include="$(MSBuildProjectDirectory)\**\package-lock.json" + Exclude="$(MSBuildProjectDirectory)\ElectronHostHook\**\package-lock.json; + $(MSBuildProjectDirectory)\bin\**\package-lock.json; + $(MSBuildProjectDirectory)\obj\**\package-lock.json; + $(MSBuildProjectDirectory)\publish\**\package-lock.json; + $(MSBuildProjectDirectory)\node_modules\**\package-lock.json" /> + + + + <_HasInvalidPackageJson>false + <_HasInvalidPackageJson Condition="@(_InvalidPackageJson->Count()) > 0 OR @(_InvalidPackageLockJson->Count()) > 0">true + + + + + + + + + + + <_InvalidManifestJson Include="$(MSBuildProjectDirectory)\**\electron.manifest.json;$(MSBuildProjectDirectory)\**\electron-manifest.json" + Exclude="$(MSBuildProjectDirectory)\bin\**\*; + $(MSBuildProjectDirectory)\obj\**\*; + $(MSBuildProjectDirectory)\publish\**\*; + $(MSBuildProjectDirectory)\node_modules\**\*" /> + + + + <_HasInvalidManifestJson>false + <_HasInvalidManifestJson Condition="@(_InvalidManifestJson->Count()) > 0">true + + + + + + + + + + + + <_ElectronBuilderJsonInProperties Include="$(MSBuildProjectDirectory)\Properties\electron-builder.json" /> + + + + <_HasElectronBuilderJsonInProperties>false + <_HasElectronBuilderJsonInProperties Condition="Exists('$(MSBuildProjectDirectory)\Properties\electron-builder.json')">true + + + + + <_ElectronBuilderJsonWrongLocation Include="$(MSBuildProjectDirectory)\**\electron-builder.json" + Exclude="$(MSBuildProjectDirectory)\Properties\electron-builder.json; + $(MSBuildProjectDirectory)\bin\**\*; + $(MSBuildProjectDirectory)\obj\**\*; + $(MSBuildProjectDirectory)\publish\**\*; + $(MSBuildProjectDirectory)\node_modules\**\*" /> + + + + <_HasElectronBuilderJsonWrongLocation>false + <_HasElectronBuilderJsonWrongLocation Condition="@(_ElectronBuilderJsonWrongLocation->Count()) > 0">true + + + + + + + + + + + + + <_ElectronBuilderJsonPath>$(MSBuildProjectDirectory)\Properties\electron-builder.json + + + + + + + + + + <_ElectronBuilderJsonContent>@(_ElectronBuilderJsonLines, ' ') + <_HasParentPathReference>false + <_HasParentPathReference Condition="$(_ElectronBuilderJsonContent.Contains('../')) OR $(_ElectronBuilderJsonContent.Contains('..\\'))" >true + + + + + + + + + + + + <_PubxmlFiles Include="$(MSBuildProjectDirectory)\Properties\PublishProfiles\*.pubxml" /> + + + + + <_IsAspNetProject>false + <_IsAspNetProject Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true'">true + <_HasPubxmlFiles>false + <_HasPubxmlFiles Condition="@(_PubxmlFiles->Count()) > 0">true + + + + + <_PubxmlFileInfo Include="@(_PubxmlFiles)" Condition="'%(Identity)' != ''"> + $([System.IO.File]::ReadAllText('%(Identity)')) + + + + + + <_PubxmlFileInfoWithFlags Include="@(_PubxmlFileInfo)" Condition="'%(Identity)' != ''"> + $([System.Text.RegularExpressions.Regex]::IsMatch('%(FileContent)', '<WebPublishMethod>')) + + + + + + <_AspNetMissingWebPublishMethod Include="@(_PubxmlFileInfoWithFlags)" + Condition="'$(_IsAspNetProject)' == 'true' AND '%(HasWebPublishMethod)' == 'False'" /> + + + + + <_ConsolePubxmlWithAspNetProperties Include="@(_PubxmlFileInfoWithFlags)" + Condition="'$(_IsAspNetProject)' != 'true' AND '%(HasWebPublishMethod)' == 'True'" /> + + + + + + + + + + +