Skip to content

fix: fall back to src-relative snk when SolutionDir is unset (#848)#978

Open
leno23 wants to merge 1 commit into
MapsterMapper:developmentfrom
leno23:fix/solutiondir-signing-fallback-848-dev
Open

fix: fall back to src-relative snk when SolutionDir is unset (#848)#978
leno23 wants to merge 1 commit into
MapsterMapper:developmentfrom
leno23:fix/solutiondir-signing-fallback-848-dev

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

Fixes #848.

Directory.Build.props always referenced $(SolutionDir)/Mapster/Mapster.snk, but SolutionDir is not set when building/testing a single project directly (for example dotnet test src/Mapster.DependencyInjection.Tests/Mapster.DependencyInjection.Tests.csproj).

This adds a fallback to $(MSBuildThisFileDirectory)Mapster/Mapster.snk, which resolves correctly from src/Directory.Build.props.

Changes

  • src/Directory.Build.props: conditionally pick the signing key from SolutionDir when available, otherwise from the props file directory.

Test plan

  • CI passes on development
  • dotnet test src/Mapster.DependencyInjection.Tests/Mapster.DependencyInjection.Tests.csproj succeeds without passing -property:SolutionDir=...
  • Solution-wide builds still resolve the same signing key when SolutionDir is set

Made with Cursor

…Mapper#848)

Allow `dotnet test path/to/csproj` to resolve the shared assembly key
from Directory.Build.props via MSBuildThisFileDirectory when SolutionDir
is not provided by the build.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant