jaytwo.SolutionResolution
0.2.0-beta-20250915081018
dotnet add package jaytwo.SolutionResolution --version 0.2.0-beta-20250915081018
NuGet\Install-Package jaytwo.SolutionResolution -Version 0.2.0-beta-20250915081018
<PackageReference Include="jaytwo.SolutionResolution" Version="0.2.0-beta-20250915081018" />
<PackageVersion Include="jaytwo.SolutionResolution" Version="0.2.0-beta-20250915081018" />
<PackageReference Include="jaytwo.SolutionResolution" />
paket add jaytwo.SolutionResolution --version 0.2.0-beta-20250915081018
#r "nuget: jaytwo.SolutionResolution, 0.2.0-beta-20250915081018"
#:package jaytwo.SolutionResolution@0.2.0-beta-20250915081018
#addin nuget:?package=jaytwo.SolutionResolution&version=0.2.0-beta-20250915081018&prerelease
#tool nuget:?package=jaytwo.SolutionResolution&version=0.2.0-beta-20250915081018&prerelease
jaytwo.SolutionResolution
<p align="center"> <a href="https://jenkins.jaytwo.com/job/jaytwo.SolutionResolution/job/master/" alt="Build Status (master)"> <img src="https://jenkins.jaytwo.com/buildStatus/icon?job=jaytwo.SolutionResolution%2Fmaster&subject=build%20(master)" /></a> <a href="https://jenkins.jaytwo.com/job/jaytwo.SolutionResolution/job/develop/" alt="Build Status (develop)"> <img src="https://jenkins.jaytwo.com/buildStatus/icon?job=jaytwo.SolutionResolution%2Fdevelop&subject=build%20(develop)" /></a> </p>
<p align="center"> <a href="https://www.nuget.org/packages/jaytwo.SolutionResolution/" alt="NuGet Package jaytwo.SolutionResolution"> <img src="https://img.shields.io/nuget/v/jaytwo.SolutionResolution.svg?logo=nuget&label=jaytwo.SolutionResolution" /></a> <a href="https://www.nuget.org/packages/jaytwo.SolutionResolution/" alt="NuGet Package jaytwo.SolutionResolution (beta)"> <img src="https://img.shields.io/nuget/vpre/jaytwo.SolutionResolution.svg?logo=nuget&label=jaytwo.SolutionResolution" /></a> </p>
When I'm setting up integration tests in AspNetCore, the content root is all messed up because Directory.GetCurrentDirectory()
resolves to something like ./test/MySolution.Web.Tests/bin/Debug/netcoreapp2.1/, and the most reliable way to get it back to the
expected ./src/MySolution.Web/ is to traverse directories up until you find a .sln file, and then find some known path relative
to the folder in which the .sln file lives.
The code is simple, but I got tired of the copy pasta whenever I set up an integration test project. Bingo bango, the SolutionResolution was born.
Installation
Add the NuGet package
PM> Install-Package jaytwo.SolutionResolution
Normal Usage
AspNetCore 2.1 Integration Tests
public class WebApplicationFactory
: WebApplicationFactory<Startup>
{
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.UseEnvironment("Development");
var contentRoot = SlnFileResolver.Default.ResolvePathRelativeToSln("examples/AspNetCore2_1");
builder.UseContentRoot(contentRoot);
}
}
AspNetCore 1.1 Integration Tests
public class TestServerFixture
{
private readonly TestServer _server;
public HttpClient CreateClient() => _server.CreateClient();
public TestServerFixture()
{
var contentRoot = SlnFileResolver.Default.ResolvePathRelativeToSln("examples/AspNetCore1_1");
_server = new TestServer(new WebHostBuilder()
.UseEnvironment("Development")
.UseContentRoot(contentRoot)
.UseStartup<Startup>());
}
public void Dispose()
{
_server?.Dispose();
}
}
Made with ♥ by Jake
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-beta-20250915081018 | 304 | 9/15/2025 |
| 0.1.1 | 1,176 | 6/29/2020 |
| 0.1.1-beta-20200629032322 | 475 | 6/29/2020 |
| 0.1.1-beta-20200608023635 | 531 | 6/8/2020 |
| 0.1.1-beta-20200608022308 | 517 | 6/8/2020 |
| 0.1.1-beta-20190523190121 | 642 | 5/23/2019 |
| 0.1.0 | 824 | 5/23/2019 |
| 0.1.0-beta-20190523190250 | 630 | 5/23/2019 |
| 0.1.0-beta-20190407052034 | 786 | 4/7/2019 |