I am using VS2012. I have a C++ Native Library and a C++/CLI project that I built to wrap the C++ Native library. I am bulding the projects for x64 bits.
I don't have much experience with C++ or C++/CLI, this is the first project I am trying to sign.
How I signed my C++/CLI project:
- I placed my strong name in the same folder where the C++/CLI is located and then I went to: Right Click on the project -> Configuration Properties -> Linker -> Advanced -> Key File.
- I wrote the name of my file in the Key File attribute: StrongNameKey.snk.
It builds without errors and I can run the tests. I also have another Solution that uses the resulting dll, and it builds fine and the test pass. But that solution it is not using signed assemblies.
The Errors I am getting:
I have a C# Solution with all its assemblies signed.
At first I was using my C++/CLI dll in this solution without signing it, and it was mostly working. But I was getting an error similar to this when trying to use one of the Wrapper classes in a ComboBox in WPF.
That post made me realize I had forgotten to sign the C++/CLI assembly.
So then I signed them as I described above, but when I tried to use the dll in my C# Solution I was getting a lot of errors. None of them seemed related to my dll, except 2 warnings.
First Warning
Warning 18 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "MyNamespace.MyCppCLI", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyTestApp
I don't have anything set as AMD, I just have it configured to x64. My C# Project is configured for AnyCPU.
Second Warning: The error said like there was 2 different locations of the signature.
I was using the same "name" both for the C# and the C++/CLI signature (the files were copies). I changed the name of the C++/CLI signature, and built the project again. And now the C# project builds, but I am still not able to use the class in the ComboBox and the designer throws the error of the other post, except that the public token is not null.
I don't know what I am doing wrong.
What are the correct steps to sign a C++/CLI Project? Where should I place the signature file?