Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#848 コメント 10 件 リアクション 0 件 担当者 1 名 GitHub で見る

@DevTKSS がすでに取り組んでいます。

2026年1月18日 から。

評価

この issue はまだ評価されていません。

説明

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?

主要言語
C#
スター
5.2k
フォーク
411
平均マージ
1日 8時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MapsterMapper/Mapster のほかの issue

MapsterMapper/Mapster の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。