Skip to content

Commit ddfdde3

Browse files
committed
apply the fix selectively
1 parent 8fc1a1c commit ddfdde3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Connectors/Reqnroll.VisualStudio.ReqnrollConnector.Generic/AssemblyLoading/TestAssemblyLoadContext.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ private IEnumerable<string> SelectAssets(IReadOnlyList<RuntimeAssetGroup> runtim
186186

187187
private CompilationLibrary GetRequestedLibrary(AssemblyName assemblyName)
188188
{
189+
// Using a x.y.z path allows finding the library in NuGet cache folders.
190+
// This causes problems with System.* assemblies (e.g. System.Text.Encodings.Web in .NET 8.0), so we use the full version string for those.
191+
string path = !assemblyName.Name!.StartsWith("System.", StringComparison.InvariantCultureIgnoreCase) ?
192+
Path.Combine(assemblyName.Name!, $"{assemblyName.Version!.Major}.{assemblyName.Version!.Minor}.{assemblyName.Version!.MajorRevision}".ToString()) :
193+
Path.Combine(assemblyName.Name!, $"{assemblyName.Version}".ToString());
194+
189195
// This reference might help finding dependencies that are otherwise not listed in the
190196
// deps.json file of the test assembly. E.g. Microsoft.AspNetCore.Hosting.Abstractions in the ReqOverflow.Specs.API project of the https://github.com/reqnroll/Sample-ReqOverflow sample
191197
return new CompilationLibrary(
@@ -196,7 +202,7 @@ private CompilationLibrary GetRequestedLibrary(AssemblyName assemblyName)
196202
new[] {assemblyName.Name + ".dll"},
197203
Array.Empty<Dependency>(),
198204
true,
199-
Path.Combine(assemblyName.Name!, $"{assemblyName.Version!.Major}.{assemblyName.Version!.Minor}.{assemblyName.Version!.MajorRevision}".ToString()),
205+
path,
200206
string.Empty);
201207
}
202208

0 commit comments

Comments
 (0)