Fody - System.Security.SecurityException: Invalid assembly public key

719 Views Asked by At

I just tried adding a Fody NuGet package to my C# project and now anytime I try to build I get the following error.

error MSB4018: The "ResolveAssemblyReference" task failed unexpectedly.
error MSB4018: System.Security.SecurityException: Invalid assembly public key. (Exception from HRESULT: 0x8013141E)
error MSB4018:    at System.Reflection.AssemblyName.nToString()
error MSB4018:    at System.Reflection.AssemblyName.get_FullName()
error MSB4018:    at Microsoft.Build.Tasks.ReferenceTable.MarkReferencesForExclusion(Dictionary`2 exclusionList)
error MSB4018:    at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime, GetAssemblyRuntimeVersion getRuntimeVersion, OpenBaseKey openBaseKey, GetAssemblyPathInGac getAssemblyPathInGac, IsWinMDFile isWinMDFile, ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader)
error MSB4018:    at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
error MSB4018: The Zone of the assembly that failed was:
error MSB4018: MyComputer

I've tried uninstalling and re-installing, different add-ins/weavers. It always ends up with the same result. My solution has two projects, a .NET Standard 2.0 library and a .NET Framework 4.6.1 class library containing unit tests. The Standard library builds but the unit test project is the one failing.

0

There are 0 best solutions below