Skip to content

Commit f96d37a

Browse files
committed
Fix ssa-query not being found when net-ssa-lib is used as a nuget package.
1 parent 738ffb8 commit f96d37a

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ jobs:
145145
dotnet test --verbosity normal
146146
- name: Generate nuget packages
147147
run: |
148-
dotnet pack net-ssa.sln -o:build/bin/net-ssa/package --include-symbols --include-source /p:Version=${{ steps.gitversion.outputs.AssemblySemVer }} /p:AssemblyVersion=${{ steps.gitversion.outputs.AssemblySemVer }} /p:InformationalVersion=${{ steps.gitversion.outputs.InformationalVersion }} /p:PackageVersion=${{ steps.gitversion.outputs.AssemblySemVer }}
148+
./ci/nuget-pack.sh "${{ steps.gitversion.outputs.AssemblySemVer }}" "${{ steps.gitversion.outputs.AssemblySemVer }}" "${{ steps.gitversion.outputs.InformationalVersion }}" "${{ steps.gitversion.outputs.AssemblySemVer }}"
149149
dotnet nuget push build/bin/net-ssa/package/net-ssa-lib.${{ steps.gitversion.outputs.NuGetVersionV2 }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
150150
151151
mirror:

ci/nuget-pack.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
CURRENT_DIR=$(dirname "$(readlink -f "$0")")
5+
6+
VERSION=$1
7+
ASSEMBLY_VERSION=$2
8+
INFORMATIONAL_VERSION=$3
9+
PACKAGE_VERSION=$4
10+
11+
pushd $CURRENT_DIR/..
12+
13+
dotnet pack net-ssa.sln -o:build/bin/net-ssa/package --include-symbols --include-source /p:Version=$VERSION /p:AssemblyVersion=$ASSEMBLY_VERSION /p:InformationalVersion=$INFORMATIONAL_VERSION /p:PackageVersion=$PACKAGE_VERSION
14+
15+
popd

net-ssa-lib/queries/SsaQuery.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,16 @@ public static String GetSsaQueryBinPath()
4949
{
5050
String suffix = GetTargetSuffix();
5151
string directory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
52-
string result = Path.Combine(directory, "ssa-query" + suffix);
52+
string binaryName = "ssa-query" + suffix;
53+
string result = Path.Combine(directory, binaryName);
5354
if (!File.Exists(result))
5455
{
55-
throw new FileNotFoundException(result);
56+
// This will attempt to handle the case where net-ssa-lib is consumed as a nuget package.
57+
// Unfortunately, for this case the binaries are not copied right next to the executing assembly.
58+
result = Path.Combine(Path.Combine(Path.Combine(Path.Combine(directory, ".."), ".."), "content"), binaryName);
59+
if (!File.Exists(result)) {
60+
throw new FileNotFoundException(result);
61+
}
5662
}
5763

5864
return result;

0 commit comments

Comments
 (0)