Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#848 10 comentarios 0 reacciones 1 asignado Ver en GitHub

@DevTKSS ya está trabajando en esto.

Desde el 18/1/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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?

Lenguaje dominante
C#
Estrellas
5.2k
Forks
409
Merge medio
3 d 4 h
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MapsterMapper/Mapster

Todos los issues de MapsterMapper/Mapster

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.