|
15 | 15 | </PropertyGroup> |
16 | 16 |
|
17 | 17 | <PropertyGroup> |
18 | | - <CommonLibsStableVersion>4.6.1</CommonLibsStableVersion> |
19 | | - <CommonLibsReleaseVersion>4.6.1</CommonLibsReleaseVersion> |
20 | | - <CommonLibPath>..\SharpHoundCommon\src\CommonLib\bin\$(Configuration)\net472\SharpHoundCommonLib.dll</CommonLibPath> |
21 | | - <RPCPath>..\SharpHoundCommon\src\SharpHoundRPC\bin\$(Configuration)\net472\SharpHoundRPC.dll</RPCPath> |
22 | | - |
23 | | - <!-- Derive the dev version by incrementing the patch of the stable version, mirroring |
24 | | - the auto-increment logic in SharpHoundCommon's publish-dev-package pipeline. |
25 | | - e.g. stable=4.6.0 → dev wildcard=4.6.1-dev* --> |
26 | | - <_StablePatch>$([System.Text.RegularExpressions.Regex]::Match($(CommonLibsStableVersion), '[0-9]+$').Value)</_StablePatch> |
27 | | - <_MajorMinor>$([System.Text.RegularExpressions.Regex]::Match($(CommonLibsStableVersion), '^[0-9]+\.[0-9]+').Value)</_MajorMinor> |
28 | | - <CommonLibsDevVersion>$(_MajorMinor).$([MSBuild]::Add($(_StablePatch), 1))-dev*</CommonLibsDevVersion> |
29 | | - |
| 18 | + <CommonLibsVersion>4.6.1</CommonLibsVersion> |
30 | 19 | <CommonSource>Dev</CommonSource> |
| 20 | + <_CommonSource>$(CommonSource.ToLower())</_CommonSource> |
| 21 | + <_CommonLibPath>..\SharpHoundCommon\src\CommonLib\bin\$(Configuration)\net472\SharpHoundCommonLib.dll</_CommonLibPath> |
| 22 | + <_RPCPath>..\SharpHoundCommon\src\SharpHoundRPC\bin\$(Configuration)\net472\SharpHoundRPC.dll</_RPCPath> |
| 23 | + </PropertyGroup> |
31 | 24 |
|
32 | | - <!-- Determine if we should use local DLLs --> |
33 | | - <_UseLocalLibs Condition="'$(CommonSource.ToLower())' == 'local'">true</_UseLocalLibs> |
34 | | - <_UseLocalLibs Condition="'$(_UseLocalLibs)' == ''">false</_UseLocalLibs> |
| 25 | + <Target Name="ValidateCommonSource" BeforeTargets="Build"> |
| 26 | + <Error Condition="'$(_CommonSource)' != 'dev' AND '$(_CommonSource)' != 'stable' AND '$(_CommonSource)' != 'local'" |
| 27 | + Text="Invalid CommonSource value '$(CommonSource)'. Valid values are: Dev, Stable, Local." /> |
| 28 | + </Target> |
| 29 | + |
| 30 | + <PropertyGroup Condition="'$(_CommonSource)' == 'dev' AND !$(CommonLibsVersion.Contains('-'))"> |
| 31 | + <!-- Derive the dev version by incrementing the patch of the stable version e.g. 4.6.0 → 4.6.1-dev* --> |
| 32 | + <_Major>$([System.Version]::Parse('$(CommonLibsVersion)').Major)</_Major> |
| 33 | + <_Minor>$([System.Version]::Parse('$(CommonLibsVersion)').Minor)</_Minor> |
| 34 | + <_Patch>$([System.Version]::Parse('$(CommonLibsVersion)').Build)</_Patch> |
| 35 | + <_DevVersion>$(_Major).$(_Minor).$([MSBuild]::Add($(_Patch), 1))-dev*</_DevVersion> |
| 36 | + </PropertyGroup> |
35 | 37 |
|
36 | | - <!-- Determine the package version --> |
37 | | - <_CommonLibsVersion Condition="'$(CommonSource.ToLower())' == 'stable'">$(CommonLibsStableVersion)</_CommonLibsVersion> |
38 | | - <_CommonLibsVersion Condition="'$(CommonSource.ToLower())' == 'release'">$(CommonLibsReleaseVersion)</_CommonLibsVersion> |
39 | | - <_CommonLibsVersion Condition="'$(_CommonLibsVersion)' == ''">$(CommonLibsDevVersion)</_CommonLibsVersion> |
| 38 | + <PropertyGroup Condition="'$(_CommonSource)' != 'local'"> |
| 39 | + <_ResolvedCommonVersion Condition="$(CommonLibsVersion.Contains('-'))">$(CommonLibsVersion)</_ResolvedCommonVersion> |
| 40 | + <_ResolvedCommonVersion Condition="'$(_ResolvedCommonVersion)' == '' AND '$(_CommonSource)' == 'dev'">$(_DevVersion)</_ResolvedCommonVersion> |
| 41 | + <_ResolvedCommonVersion Condition="'$(_ResolvedCommonVersion)' == ''">$(CommonLibsVersion)</_ResolvedCommonVersion> |
40 | 42 | </PropertyGroup> |
| 43 | + |
| 44 | + <ItemGroup Condition="'$(_CommonSource)' == 'local'"> |
| 45 | + <Reference Include="SharpHoundCommonLib"> |
| 46 | + <HintPath>$(_CommonLibPath)</HintPath> |
| 47 | + </Reference> |
| 48 | + <Reference Include="SharpHoundRPC"> |
| 49 | + <HintPath>$(_RPCPath)</HintPath> |
| 50 | + </Reference> |
| 51 | + </ItemGroup> |
| 52 | + <ItemGroup Condition="'$(_CommonSource)' != 'local'"> |
| 53 | + <PackageReference Include="SharpHoundCommon" Version="$(_ResolvedCommonVersion)" /> |
| 54 | + <PackageReference Include="SharpHoundRPC" Version="$(_ResolvedCommonVersion)" /> |
| 55 | + </ItemGroup> |
| 56 | + |
| 57 | + <Target Name="LogCommonLibsSource" BeforeTargets="Build"> |
| 58 | + <Message Text='CommonLib Source "$(CommonSource)":' Importance="high" /> |
| 59 | + <Message Condition="'$(_CommonSource)' == 'local'" Text=" Resolved Using Local DLLs" Importance="high" /> |
| 60 | + <Message Condition="'$(_CommonSource)' != 'local'" Text=" Resolved to NuGet Version: $(_ResolvedCommonVersion)" Importance="high" /> |
| 61 | + </Target> |
41 | 62 |
|
42 | 63 | <ItemGroup> |
43 | 64 | <PackageReference Include="CommandLineParser" Version="2.8.0" /> |
|
55 | 76 | <PackageReference Include="System.Threading.Channels" Version="8.0.0" /> |
56 | 77 | <PackageReference Include="System.ValueTuple" Version="4.5.0" /> |
57 | 78 | </ItemGroup> |
58 | | - <ItemGroup Condition="'$(_UseLocalLibs)' == 'true'"> |
59 | | - <Reference Include="SharpHoundCommonLib"> |
60 | | - <HintPath>$(CommonLibPath)</HintPath> |
61 | | - </Reference> |
62 | | - <Reference Include="SharpHoundRPC"> |
63 | | - <HintPath>$(RPCPath)</HintPath> |
64 | | - </Reference> |
65 | | - </ItemGroup> |
66 | | - <ItemGroup Condition="'$(_UseLocalLibs)' != 'true'"> |
67 | | - <PackageReference Include="SharpHoundCommon" Version="$(_CommonLibsVersion)" /> |
68 | | - <PackageReference Include="SharpHoundRPC" Version="$(_CommonLibsVersion)" /> |
69 | | - </ItemGroup> |
70 | 79 | <ItemGroup> |
71 | 80 | <Reference Include="System.DirectoryServices" /> |
72 | 81 | <Reference Include="System.DirectoryServices.Protocols" /> |
|
76 | 85 | <Message Text="Test" /> |
77 | 86 | <Exec Command="powershell -ep bypass -c ". '$(ProjectDir)src\Powershell\Out-CompressedDLL.ps1';Out-CompressedDll -FilePath '$(TargetPath)' -TemplatePath '$(ProjectDir)src\\Powershell\Template.ps1' | Out-File -Encoding ASCII '$(TargetDir)$(TargetName).ps1'"" /> |
78 | 87 | </Target> |
79 | | - <Target Name="LogCommonLibsVersion" BeforeTargets="Build"> |
80 | | - <Message Text="Loading CommonLib Dependency:" Importance="high" /> |
81 | | - <Message Condition="'$(_UseLocalLibs)' == 'true'" Text=" Using Local DLLs" Importance="high" /> |
82 | | - <Message Condition="'$(_UseLocalLibs)' == 'false'" Text=" Package Version: $(_CommonLibsVersion)" Importance="high" /> |
83 | | - </Target> |
84 | 88 | </Project> |
0 commit comments