fsunit assembly is not signed with a strong name
See original GitHub issueIn using fsunit from a strongly-named assembly I get the folllowing error
1) Test Error : TryFsunit.lib1.hello System.IO.FileLoadException : Could not load file or assembly 'FsUnit.NUnit, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HR ESULT: 0x80131044) at TryFsunit.lib1.hello()
Nunit works fine. It’s just FSunit that isn’t signed. There are many ways to sign an assembly in the FSUnit build process – see msdn article
To reproduce
- create a small library project. See (1)
- add fsunit from nuget to the project
- add any test
- sign that library with a strong name. (There are many ways to do that. I used the
<OtherFlags>--keyfile:SomeSignature.snk</OtherFlags>
method in the .fsproj). See (2) - build with msbuild
- run from command line “nunit-console.exe”
- you will see the above error “Could not load file or assembly ‘FsUnit.NUnit’…A strongly-named assembly is required.”
(1) Sample library1.fs fragment
let add a b = a + b
// this fails at test runtime
[<Test>]
let hello2() = add 2 3 |> should equal 5
// This works, which means: nunit is strong signed. But fsunit is not.
[<Test>]
let hello() =
let n = add 2 3
Assert.That(n,Is.EqualTo(5))
(2) Sample .fsproj file fragment with <OtherFlags>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
....
<OtherFlags>--keyfile:SignKeyLifeQuest.snk</OtherFlags>
</PropertyGroup>
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to fix "Referenced assembly does not have a strong ...
If you don't find the .snk-file: Open the project properties (of the project using the project with the "strong name" error), tab Signing....
Read more >How to: Disable the strong-name bypass feature | ...
Strong-name bypass skips signature validation in fully trusted domains in .NET. You can override this feature for a single application or ...
Read more >Create and use strong-named assemblies
This article shows you the process of signing an assembly in .NET with a strong name and later referencing it by that name....
Read more >How to Assign a Strong Name to Unsigned 3rd-party ...
This will allow you to reference and use NuGet packages with assemblies which are not strong named from your projects that do use...
Read more >What is FsUnit?
FsUnit is a set of libraries that makes unit-testing with F# more enjoyable. It adds a special syntax to your favorite .NET testing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As workaround you can include
FsUnit.fs
orFsUnitTyped.fs
file to your test project and do not reference FsUnit package.In order to expose internal types for testing to assemblies via the InternalsVisibleTo attribute from a signed assembly, those assemblies must also be signed. Right now I can’t do that =(.