diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a8c9e2b..883a82a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -36,7 +36,7 @@ jobs: - name: Build run: | VERSION=${{ github.ref_name }} - dotnet build -c ${{ matrix.release.type }} -p:Version=${VERSION:1} -p:CommonLibSource=Release + dotnet build -c ${{ matrix.release.type }} -p:Version=${VERSION:1} -p:CommonSource=Stable - name: Zip run: 7z a -tzip -mx9 SharpHound_${{ github.ref_name }}${{ matrix.release.suffix }}_windows_x86.zip $PWD/bin/${{ matrix.release.type }}/net472/* diff --git a/README.md b/README.md index fe61e32..8ece40e 100644 --- a/README.md +++ b/README.md @@ -12,20 +12,37 @@ To determine the SharpHound version compatible with a deployed BloodHound CE ins Please refer to the [SharpHound section](https://bloodhound.specterops.io/collect-data/ce-collection/sharphound), part of the [BloodHound Community Edition documentation](https://bloodhound.specterops.io/home). -## Compile Instructions +## Compilation Instructions -To build this project, use .net 5.0 and run the following: +To build this project, using a .NET SDK run the following: -``` -dotnet restore . +```bash +dotnet restore dotnet build ``` -By default, the project will build with the latest version of the [SharpHoundCommon Library](https://github.com/SpecterOps/SharpHoundCommon). +By default, the project builds against the next prerelease `-dev` version of the +[SharpHoundCommon Library](https://github.com/SpecterOps/SharpHoundCommon) +(tracking the v4 branch). + +If you wish to build against a local copy of the library, ensure the `_CommonLibPath` and `_RPCPath` properties point to the correct DLLs, and run `dotnet build -p:CommonSource=Local`. + +If `CommonLibsVersion` already contains a prerelease tag (e.g. `4.6.0-rc1`), +that exact version is used as-is for both `Stable` and `Dev` sources. -To build against the latest stable release of the library, you can run `dotnet build -p:CommonLibSource=Stable`. +| `CommonSource` (default: `Dev`) | Package resolved | +|---------------------------------|-----------------------------------------------------------------------------| +| `Dev` | Prerelease (e.g. `4.6.0-rc1`) or next patch `-dev*` (e.g. `4.6.1-dev*`) | +| `Stable` | Current CommonLibsVersion (e.g. `4.6.0`) | +| `Local` | Local `SharpHoundCommon` DLLs | + +```bash +dotnet build # Dev (default) +dotnet build -p:CommonSource=Stable +dotnet build -p:CommonSource=Local +dotnet build --tl:off # To view CommonLib resolution logs +``` -If you wish to build against a local copy of the library, ensure the `CommonLibPath` and `RPCPath` properties point to the correct DLLs, and run `dotnet build -p:CommonLibSource=Local`. ## Requirements diff --git a/Sharphound.csproj b/Sharphound.csproj index d76d5e2..2eb5f0d 100644 --- a/Sharphound.csproj +++ b/Sharphound.csproj @@ -15,29 +15,50 @@ - 4.6.1 - 4.6.1 - ..\SharpHoundCommon\src\CommonLib\bin\$(Configuration)\net472\SharpHoundCommonLib.dll - ..\SharpHoundCommon\src\SharpHoundRPC\bin\$(Configuration)\net472\SharpHoundRPC.dll - - - <_StablePatch>$([System.Text.RegularExpressions.Regex]::Match($(CommonLibsStableVersion), '[0-9]+$').Value) - <_MajorMinor>$([System.Text.RegularExpressions.Regex]::Match($(CommonLibsStableVersion), '^[0-9]+\.[0-9]+').Value) - $(_MajorMinor).$([MSBuild]::Add($(_StablePatch), 1))-dev* - + 4.6.1 Dev + <_CommonSource>$(CommonSource.ToLower()) + <_CommonLibPath>..\SharpHoundCommon\src\CommonLib\bin\$(Configuration)\net472\SharpHoundCommonLib.dll + <_RPCPath>..\SharpHoundCommon\src\SharpHoundRPC\bin\$(Configuration)\net472\SharpHoundRPC.dll + - - <_UseLocalLibs Condition="'$(CommonSource.ToLower())' == 'local'">true - <_UseLocalLibs Condition="'$(_UseLocalLibs)' == ''">false + + + + + + + <_Major>$([System.Version]::Parse('$(CommonLibsVersion)').Major) + <_Minor>$([System.Version]::Parse('$(CommonLibsVersion)').Minor) + <_Patch>$([System.Version]::Parse('$(CommonLibsVersion)').Build) + <_DevVersion>$(_Major).$(_Minor).$([MSBuild]::Add($(_Patch), 1))-dev* + - - <_CommonLibsVersion Condition="'$(CommonSource.ToLower())' == 'stable'">$(CommonLibsStableVersion) - <_CommonLibsVersion Condition="'$(CommonSource.ToLower())' == 'release'">$(CommonLibsReleaseVersion) - <_CommonLibsVersion Condition="'$(_CommonLibsVersion)' == ''">$(CommonLibsDevVersion) + + <_ResolvedCommonVersion Condition="$(CommonLibsVersion.Contains('-'))">$(CommonLibsVersion) + <_ResolvedCommonVersion Condition="'$(_ResolvedCommonVersion)' == '' AND '$(_CommonSource)' == 'dev'">$(_DevVersion) + <_ResolvedCommonVersion Condition="'$(_ResolvedCommonVersion)' == ''">$(CommonLibsVersion) + + + + $(_CommonLibPath) + + + $(_RPCPath) + + + + + + + + + + + + @@ -55,18 +76,6 @@ - - - $(CommonLibPath) - - - $(RPCPath) - - - - - - @@ -76,9 +85,4 @@ - - - - -