DotNetOpenAuth compiles after modifications but throws runtime exception when running sample project
c#, dotnetopenauth, visual-studio-2012
Solution
Modifying the props file shouldn't be necessary. The issue is likely that you're on a 64-bit machine, and the `sn` command you ran only impacted the 32-bit registry. Then at runtime you fail because you're running the web site on the 64-bit registry, which doesn't have the skip verification entry in it.
The "right" way to do it is to install the 64-bit Windows SDK so that you get 64-bit sn.exe and run that command as well. However, here's the fast and easy way:
Check out the value of your reg key: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,2780ccd10d57b246`
and copy that key over to
`HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,2780ccd10d57b246`
Then restart all the relevant processes (MSBuild.exe, devenv.exe, iis, WebDAV, or whatever it is that's hosting your web site and reporting the error). It should start working for you.
Problem
I downloaded the latest DotNetOpenAuth code from GitHub and initially it failed to build. I fixed the problem by running the following: ``` sn -Vr *,2780ccd10d57b246 ``` found here: http://www.dotnetopenauth.net/developers/contributing/quickstart-environment/ I went ahead and did some modifications to the project DotNetOpenAuth.AspNet. It compiled just fine. Then I created an MVC 4 web project under samples to test my changes. The solution again compiled. However as soon as I click on debug I get the ASP.NET yellow screen of death with the following error: Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) The MVC 4 project was created from the Empty Template, so there is no reference to Microsoft.Web.WebPages.OAuth What am I missing? I completed the rest of the steps found in the link above: ``` sn -k mykeyfile.pfx sn -i mykeyfile.pfx mykeycontainer sn -p mykeyfile.pfx mykeyfile.pub sn -q -t mykeyfile.pub sn -Vr *,<YourPublicKeyTokenHere> ``` and also modified the file \tools\DotNetOpenAuth.props, specifically the lines: 27,29,30 with the new values ``` 26. <SignAssembly>true</SignAssembly> 27. <PublicKeyFile Condition="'$(PublicKeyFile)' == ''">$(ProjectRoot)src\official-build-key.pub</PublicKeyFile> 28. <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == ''">$(PublicKeyFile)</AssemblyOriginatorKeyFile> 29. <KeyPairContainer Condition="'$(KeyPairContainer)' == ''">DotNetOpenAuth</KeyPairContainer> 30. <PublicKeyToken>2780ccd10d57b246</PublicKeyToken> 31. <DelaySign>true</DelaySign> 32. <SignedSubPath>signed\</SignedSubPath> ```