Skip to content

Portable Tool for an Ideal Windows Setup

upd. dependabot & add scipt fix HintPath

Greedeks27891e828431
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 1c3e55fc..b12578f6 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -7,3 +7,5 @@ updates:
open-pull-requests-limit: 10
commit-message:
prefix: "update"
+ allow:
+ - dependency-type: "direct"
diff --git a/.github/workflows/dependabot-build.yml b/.github/workflows/dependabot-build.yml
new file mode 100644
index 00000000..72b39467
--- /dev/null
+++ b/.github/workflows/dependabot-build.yml
@@ -0,0 +1,62 @@
+name: Build with HintPath Fix
+
+on:
+ pull_request:
+ paths:
+ - 'packages.config'
+ - '**/*.csproj'
+
+jobs:
+ build:
+ runs-on: windows-latest
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+
+ - name: Setup NuGet
+ uses: NuGet/setup-nuget@v1
+
+ - name: Restore packages
+ run: nuget restore YourSolution.sln
+
+ - name: Build solution
+ run: msbuild YourSolution.sln /p:Configuration=Release
+
+ - name: Fix HintPath inline
+ shell: pwsh
+ run: |
+ Write-Host "Fixing HintPath in csproj files..."
+ $solutionDir = "${{ github.workspace }}"
+
+ $packagesFiles = Get-ChildItem -Path $solutionDir -Recurse -Filter "packages.config"
+
+ foreach ($packagesFile in $packagesFiles) {
+ Write-Host "Processing $($packagesFile.FullName)"
+ [xml]$xml = Get-Content $packagesFile.FullName
+
+ foreach ($package in $xml.packages.package) {
+ $id = $package.id
+ $version = $package.version
+
+ $csprojFiles = Get-ChildItem -Path $packagesFile.DirectoryName -Recurse -Filter "*.csproj"
+
+ foreach ($csproj in $csprojFiles) {
+ [xml]$projXml = Get-Content $csproj.FullName
+ $ns = @{msb='http://schemas.microsoft.com/developer/msbuild/2003'}
+
+ $refs = $projXml.SelectNodes("//msb:Reference[contains(@Include,'$id')]", $ns)
+ foreach ($ref in $refs) {
+ $hintNode = $ref.HintPath
+ if ($hintNode) {
+ $newHint = "..\..\packages\$id.$version\lib\net45\$id.dll"
+ Write-Host "Updating HintPath in $($csproj.FullName) for $id -> $newHint"
+ $hintNode.'#text' = $newHint
+ }
+ }
+
+ $projXml.Save($csproj.FullName)
+ }
+ }
+ }
+ Write-Host "HintPath fix completed."