Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Tests] Local Testing of single Mapster Projects fails for SolutionDir is not always set when building a project directly via dotnet test

Aperta
#848 10 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@DevTKSS ci sta già lavorando.

Dal 18/1/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

improvement

I was locally trying around with the DI Package to look into my suggested Idea to enable something like MapsterOptions from appsettings.json.

But testing via dotnet test path/to/csproj fails on the Directory.Build.props file uses SolutionDir which is not or not always set, which causes that Copilot constantly edits the Directory.Build.props with this:

<!--
	SolutionDir is not always set when building a project directly (e.g. `dotnet test path/to/csproj`).
	Fall back to the key path relative to this props file (src/Mapster/Mapster.snk).
-->
<AssemblyOriginatorKeyFile Condition="Exists('$(SolutionDir)Mapster\\Mapster.snk')">$(SolutionDir)Mapster\Mapster.snk</AssemblyOriginatorKeyFile>
		<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' and Exists('$(MSBuildThisFileDirectory)Mapster\\Mapster.snk')">$(MSBuildThisFileDirectory)Mapster\Mapster.snk</AssemblyOriginatorKeyFile>

Which includes in the .csproj the marked lines:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net10.0;net9.0;net8.0;</TargetFrameworks>
    <Description>Dependency Injection supports for Mapster</Description>
    <IsPackable>true</IsPackable>
    <PackageTags>Mapster;DependencyInjection</PackageTags>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>Mapster.DependencyInjection.snk</AssemblyOriginatorKeyFile>
    <Version>10.0.0-pre01</Version>
  </PropertyGroup>

Since I so far never worked with Signing Assemblys or similar, I don't know for what build/release step we are exactly needing this, assuming just for the Package Creation - Release step, isnt it?

I am quite sure @andrerav or you others @DocSvartz @stagep might have some information and solution? 😁

How do you do this when you others are testing locally?
Is there some kind of trick, except from always building the solution? 😓
Could we have this fixed possibly?

Lingua principale
C#
Stelle
5.2k
Fork
411
Merge medio
3g 4h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MapsterMapper/Mapster

Tutte le issue di MapsterMapper/Mapster

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.