Severity Code Description Project File Line Suppression State Error MSB4100 Expected "$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" to evaluate to a boolean instead of "$([System.String]::Copy('C:\Users\tarek\OneDrive\Desktop\StoreAp

م.طارق علي 0 Reputation points
2024-05-08T03:16:48.12+00:00

Severity Code Description Project File Line Suppression State

Error MSB4100 Expected "$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" to evaluate to a boolean instead of "$([System.String]::Copy('C:\Users\tarek\OneDrive\Desktop\StoreApi's\AllStoreApp\StoreClassLibrary\bin\Release\net8.0\StoreClassLibrary.dll').EndsWith('.resources.dll'))", in condition "!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))". StoreWeb C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.3\Sdk\WasmApp.targets 339

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,816 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,672 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,143 questions
{count} votes

1 answer

Sort by: Most helpful
  1. دعاء علي حمدان الجروانية 0 Reputation points
    2025-06-14T15:59:41.8733333+00:00

    Cause:

    This condition:

    !$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))

    returns a string, not a Boolean, which MSBuild expects.

    Why:

    %(Identity) only works inside <ItemGroup> iterations — not with static paths.

    Fix It

    Option 1 – Use in ItemGroup:

    <ItemGroup>

      <MyAssemblies Include="@(ReferencePath)">

        <IsNotResource>$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))</IsNotResource>

      </MyAssemblies>

    </ItemGroup>

    Option 2 – Use Property for Static Path:

    <PropertyGroup>

      <MyFilePath>Path\To\Your.dll</MyFilePath>

    </PropertyGroup>

    <SomeElement Condition="!$([System.String]::Copy('$(MyFilePath)').EndsWith('.resources.dll'))">

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.