Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing ad-hoc test methods in .NET Standard projects #117

Open
jcansdale opened this issue Jun 11, 2018 · 0 comments
Open

Executing ad-hoc test methods in .NET Standard projects #117

jcansdale opened this issue Jun 11, 2018 · 0 comments
Labels
tracking This is a tracking issue - don't delete!

Comments

@jcansdale
Copy link
Owner

jcansdale commented Jun 11, 2018

.NET Standard projects

.NET Standard projects are designed to run on multiple different .NET platforms (.NET Core, .NET Framework, Mono etc). When asked to run an ad-hoc test method, TestDriven.Net will attempt to execute it using the same .NET Framework version as Visual Studio.

The .NET Core and .NET Framework have different assembly resolution strategies. .NET Framework expects assemblies to be on the application base, the GAC or resolved using a custom assembly resolve event. .NET Core specifies its dependencies in a .deps.json file.

In order to resolve any referenced assemblies when using the .NET Framework, you will need to copy and dependencies to the application base. This can be done by setting the CopyLocalLockFileAssemblies property to true in your .NET Standard project file. For example:

<Project Sdk='Microsoft.NET.Sdk'>
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
</Project>

Hints and tips

I'm planning to support this by default in the next release.

What isn't supported

  • Native dependencies

Because the project doesn't know which runtime is being targeted, CopyLocalLockFileAssemblies doesn't know which native dependencies to copy.

It will work with NuGet packages that copy native dependencies so they are portable across multiple (for example LibGit2Sharp.Portable).

  • Creating App.config files and bindingRedirects

If there are conflicting assembly versions references between NuGet packages it doesn't know how to create an App.config that consolidates the versions.

Related

Any questions?

Please ask questions and share any tips you have below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracking This is a tracking issue - don't delete!
Projects
None yet
Development

No branches or pull requests

1 participant