Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

error in assemblyBuilder when moving from Win7 to Win10

$
0
0

HI,

I am migrating a from Win7 to WIN10 in VS2015 using .net35SP1. The project runs fine on Win7 but on Win10 it give a runtime error of "Strong name key container not found."

I have searched around some and have tried solutions suggested before including installing Microsoft.Net.Compilers package 2.6.1 and adding <Features>$(Features);UseLegacyStrongNameProvider</Features> to the <PropertyGroup> in the project file. Is anyone able to tell me what needs to be done in order for this to work at runtime once again.

assemblyFileName = String.Format("Company.Configuration.{0}.v{1}.dll", fileName, fileVersion);

            // Define the assembly's name
            var an = new AssemblyName
            {
                Version = new Version(assemblyVersion),
                Name = ns
            };

            // Sign the assembly
            if (!String.IsNullOrEmpty(keyPairFile))
            {
                // Get the KeyPair file to sign the assembly
                StrongNameKeyPair kp;
                using (var fs = new FileStream(keyPairFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    kp = new StrongNameKeyPair(fs);
                }
                an.KeyPair = kp;
            }

            // Define a new assembly that we can save to disk
            var assemblyBuilder = Thread
                .GetDomain()
                .DefineDynamicAssembly(an, AssemblyBuilderAccess.RunAndSave
                );

...

            // Save the dll
            assemblyBuilder.Save(assemblyFileName);




Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>