<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFramework>net9.0</TargetFramework>
		<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
		<ImplicitUsings>enable</ImplicitUsings>
		<EnableDynamicLoading>true</EnableDynamicLoading>
		<Nullable>enable</Nullable>
		<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
		<!--
		  If the caller passes -p:CopyPluginBinariesToPath=… we respect that.
		  Otherwise we fall back to the local relative folder used in Visual Studio.
		-->
		<CopyPluginBinariesToPath Condition="'$(CopyPluginBinariesToPath)' == ''">$([System.IO.Path]::Combine($(MSBuildProjectDirectory),'..','..','Ablera.Serdica.Authority','PluginBinaries','$(MSBuildProjectName)'))</CopyPluginBinariesToPath>
	</PropertyGroup>

	<!-- Fires after **every** successful build, CLI or IDE -->
	<Target Name="CopyPluginBinaries" AfterTargets="Build">
		<!-- Every file that just landed in the target directory -->
		<ItemGroup>
			<BuiltFiles Include="$(TargetDir)**\*.*" />
		</ItemGroup>

		<Message Importance="high" Text="Copying files: @(BuiltFiles->'%(RecursiveDir)%(Filename)%(Extension)') &#xD;&#xA;			 to: $(CopyPluginBinariesToPath)" />

		<Copy SourceFiles="@(BuiltFiles)" DestinationFolder="$(CopyPluginBinariesToPath)" SkipUnchangedFiles="true" />
	</Target>

	<ItemGroup>
		<Content Include="ldap-settings.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
			<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
		</Content>
	</ItemGroup>

	<ItemGroup>
		<ProjectReference Include="../../../../__Libraries/Ablera.Serdica.Authentication/Ablera.Serdica.Authentication.csproj" />
		<ProjectReference Include="../../../../__Libraries/Ablera.Serdica.Common.Tools/Ablera.Serdica.Common.Tools.csproj" />
		<ProjectReference Include="../../../../__Libraries/Ablera.Serdica.DBModels.Serdica/Ablera.Serdica.DBModels.Serdica.csproj" />
		<ProjectReference Include="..\Ablera.Serdica.Authority.Plugins.Base\Ablera.Serdica.Authority.Plugins.Base.csproj" />
		<ProjectReference Include="..\Ablera.Serdica.Authority.Plugins.LdapUtilities\Ablera.Serdica.Authority.Plugins.LdapUtilities.csproj" />
	</ItemGroup>
</Project>
