Deployment without the administration

Hi,

I am trying to follow up admin exclusion documentation for a deployment. However, even though it skips our custom admin libraries, it still keeps including base admin libs. Is there anyone facing a similar issue?

Thanks in advance, Mehmet


Environment

Answers

Could you provide an example of your .csproj file?

Hi Sean,

You can see a detailed info regarding our csproj below.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
	<AdminAttached Condition="'$(AdminAttached)' == ''">true</AdminAttached>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <TreatWarningsAsErrors>True</TreatWarningsAsErrors>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <TreatWarningsAsErrors>True</TreatWarningsAsErrors>
  </PropertyGroup>
  <PropertyGroup Condition="'$(AdminAttached)' == 'true'">
    <DefineConstants>$(DefineConstants);ADMIN_ATTACHED</DefineConstants>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="%24CDRepository\**" />
    <Compile Remove="App_Data\**" />
    <Content Remove="%24CDRepository\**" />
    <Content Remove="App_Data\**" />
    <EmbeddedResource Remove="%24CDRepository\**" />
    <EmbeddedResource Remove="App_Data\**" />
    <None Remove="%24CDRepository\**" />
    <None Remove="App_Data\**" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="App_Data\AzureCache\Azure.txt">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="App_Data\AzureTemp\Azure.txt">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="app_offline.htm_" Condition="Exists('app_offline.htm_')" CopyToPublishDirectory="PreserveNewest" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
	<PackageReference Include="kentico.xperience.admin" Version="29.4.1" Condition="'$(AdminAttached)' == 'true'" />
    <PackageReference Include="kentico.xperience.azurestorage" Version="29.4.1" />
    <PackageReference Include="kentico.xperience.cloud" Version="29.4.1" />
    <PackageReference Include="kentico.xperience.imageprocessing" Version="29.4.1" />
    <PackageReference Include="kentico.xperience.webapp" Version="29.4.1" />
    <PackageReference Include="Microsoft.jQuery.Unobtrusive.Validation" Version="4.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\Business\Custom.Extensions\Custom.Extensions.csproj" />
    <ProjectReference Include="..\..\Business\Custom.Services\Custom.Services.csproj" />
    <ProjectReference Include="..\AdminApplications\CustomAdminLib.Lib1.csproj" Condition="'$(AdminAttached)' == 'true'" />
    <ProjectReference Include="..\AdminApplications\CustomAdminLib.Lib2" Condition="'$(AdminAttached)' == 'true'" />
    <ProjectReference Include="..\AdminApplications\CustomAdminLib.Lib3" Condition="'$(AdminAttached)' == 'true'" />
    <ProjectReference Include="..\Custom.DataAnnotations\Custom.DataAnnotations.csproj" />
    <ProjectReference Include="..\Custom.WebApi\Custom.WebApi.csproj" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App_Data\CMSModules\WebFarm\webfarm.sync">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\PublishProfiles\" />
  </ItemGroup>
</Project>

I notice you have a lot of project references. Are any of those referencing the kentico.xperience.admin NuGet package? If so, they would also need the Condition="'$(AdminAttached)' == 'true'" MSBuild attribute on the package entries in their .csproj files.

Hi Sean,

All of the projects referencing kentico.xperience.admin also have the attribute and all the categories and applications we have added are successfully excluded.

Hence I don't think that is the issue.

  1. Are any of your projects using one of our open-source integrations? Not all of them support deploying the admin separately.
  2. Your application builds correctly when you run dotnet build -p:AdminAttached=false?
  3. You can use dotnet nuget why to find all the packages referencing kentico.xperience.admin
Accepted answer

Heya Sean,

Thanks for the tip. I have followed up your points however none worked for me. Then I have made a regular search and found in 1 class we have a using statement for admin package and it wasn't excluded. After adding exclusion all was fine.

Tbh when I have seen the reference, I was puzzled why I didn't see an error with the build.

To response this discussion, you have to login first.