EDN Admin
Well-known member
After upgrading from VC2005 to VC2010 SP1 I am unable to apply an SNK file to a C++/CLI dll assembly even if doing it explicitly via sn command.
It is simple C++/CLI VS2010 SP1 dll project (on a W2K3 x86 machine) which refers 6 Core and 2 additional strong-named assemblies as you can see from ildasm outprint below. I have an SNK file to apply for the dll. From the VS Build Detailed Log I can
verify that link exe is issued twice first with KEYFILE specified and secondly with KEYFILE omitted.
I have tried to workaround this problem by delay signing and executing a post build step as outlined here ( http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/61b58555-3579-40c9-9625-b17a9955e3f5 http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/61b58555-3579-40c9-9625-b17a9955e3f5 ).
But this does not work because sn complains that the assembly is NOT signed, therefore it cannot resign it (even when issuing explicitly on a command line). For further reference here is the relevant excerpt from the detailed build log:
Relevant Detailed Log Excerpt:
<pre>1>Done building target "PreLinkEvent" in project "BSMAPINET.vcxproj".
1>Target "Link" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.Targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Using "Link" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
<span style="color:#0000ff
1>Task "Link"
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1376
1> Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /KEYFILE:"......CommonVersionrelease.net.snk" /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /a /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r "DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUG.NETFRAMEWORK,VERSION=V4.0.ASSEMBLYATTRIBUTES.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGAPP.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGASSEMBLYINFO.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.EMBED.MANIFEST.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNATIVE.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNET.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGTESTBSMSERVERNET.OBJ" /b MSBuildConsole_CancelEventd5ff85296f6541b9bd8643b3f523594f /c "Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe" /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /KEYFILE:"......CommonVersionrelease.net.snk" /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1>Done executing task "Link".
1>Task "Message" skipped, due to false condition; ($(EmbedManifestBy) != LINK) was evaluated as (LINK != LINK).
1>Done building target "Link" in project "BSMAPINET.vcxproj".
1>Target "_DetermineManagedStateForLink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "_DetermineManagedStateForLink" in project "BSMAPINET.vcxproj".
1>Target "ComputeMetaGenInputs" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "MetaGenInputsOutputs" depends on it):
1>Task "Delete" skipped, due to false condition; ($(OutputAssemblyMetagenFile) != and $(ConsumeAnyMetaAssembly) == false and Exists($(OutputAssemblyMetagenFile))) was evaluated as (DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll.metagen != and true == false and Exists(DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll.metagen)).
1>Done building target "ComputeMetaGenInputs" in project "BSMAPINET.vcxproj".
1>Target "MetaGenInputsOutputs" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.MetaGen.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "MetaGenInputsOutputs" in project "BSMAPINET.vcxproj".
1>Target "MetaGen" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.MetaGen.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Building target "MetaGen" completely.
1>Input file "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" is newer than output file "Debug\metagen.write.1.tlog".
1>Using "METAGEN" task from assembly "Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "METAGEN"
1>Done executing task "METAGEN".
1>Done building target "MetaGen" in project "BSMAPINET.vcxproj".
1>Target "ComputeLinkImportLibraryOutputsForClean" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Task "WriteLinesToFile" skipped, due to false condition; (@(_LinkImportLibrary) != ) was evaluated as ( != ).
1>Done building target "ComputeLinkImportLibraryOutputsForClean" in project "BSMAPINET.vcxproj".
1>Target "AfterLink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "AfterLink" in project "BSMAPINET.vcxproj".
1>Target "_Link" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "BuildLink" depends on it):
1>Done building target "_Link" in project "BSMAPINET.vcxproj".
1>Target "_ALink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "BuildLink" depends on it):
1>Done building target "_ALink" in project "BSMAPINET.vcxproj".
1>Target "ComputeManifestInputsTargets" skipped. Previously built successfully.
1>Target "MakeDirsForManifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "Manifest" depends on it):
1>Task "MakeDir"
1>Done executing task "MakeDir".
1>Done building target "MakeDirsForManifest" in project "BSMAPINET.vcxproj".
1>Target "Manifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Manifest" depends on it):
1>Task "Delete"
1> Deleting file "DebugBCSAPINET.dll.embed.manifest".
1>Done executing task "Delete".
1>Using "Mt" task from assembly "Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Mt"
1> Crogram FilesMicrosoft SDKsWindowsv7.0Abinmt.exe /nologo /verbose /out:"DebugBCSAPINET.dll.embed.manifest" /manifest DebugBCSAPINET.dll.intermediate.manifest
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.INTERMEDIATE.MANIFEST /b MSBuildConsole_CancelEventb5e3a621aa6743a59b83c4d8083e46ea /c "Crogram FilesMicrosoft SDKsWindowsv7.0Abinmt.exe" /nologo /verbose /out:"DebugBCSAPINET.dll.embed.manifest" /manifest DebugBCSAPINET.dll.intermediate.manifest
1>Done executing task "Mt".
1>Task "RC"
1> Crogram FilesMicrosoft SDKsWindowsv7.0Abinrc.exe /nologo /fo"DebugBCSAPINET.dll.embed.manifest.res" DebugBCSAPINET_manifest.rc
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET_MANIFEST.RC /b MSBuildConsole_CancelEvent16c391249d694e6a878e9f0ea63e53ca /c "Crogram FilesMicrosoft SDKsWindowsv7.0Abinrc.exe" /nologo /fo"DebugBCSAPINET.dll.embed.manifest.res" DebugBCSAPINET_manifest.rc
1>Done executing task "RC".
1>Done building target "Manifest" in project "BSMAPINET.vcxproj".
1>Target "ComputeManifestGeneratedLinkerInputs" skipped. Previously built successfully.
1>Target "LinkEmbedManifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.Targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Manifest" depends on it):
<span style="color:#0000ff 1>Task "Link"
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1412
1> Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /a /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r "DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUG.NETFRAMEWORK,VERSION=V4.0.ASSEMBLYATTRIBUTES.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGAPP.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGASSEMBLYINFO.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.EMBED.MANIFEST.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNATIVE.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNET.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGTESTBSMSERVERNET.OBJ" /b MSBuildConsole_CancelEventfb4d7520ca0744ec9377fd072dce89d5 /c "Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe" /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1>Done executing task "Link".
1>Task "Message"
1> BSMAPINET.vcxproj -> DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll
[/code]
ILDASM info:
<pre>// Metadata version: v4.0.30319
.module extern KERNEL32.dll
.module extern MSVCR100D.dll
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (CD 95 65 AD 55 34 B6 AD 72 9D 3F BB 80 DA 0A 6C // ..e.U4..r.?....l
49 E5 F2 5B ) // I..[
.ver 4:0:0:0
}
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (49 5B AD 3A D8 09 75 36 30 77 14 15 51 02 69 F6 // I[.:..u60w..Q.i.
DE 26 7B B3 ) // .&{.
.ver 4:0:0:0
}
.assembly extern System.Data
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (FB 4E 0C 6E 9A 11 98 9A 54 BD 57 59 98 F2 D0 75 // .N.n....T.WY...u
A3 0A 93 18 )
.ver 4:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (D1 AD 65 23 DB A9 C1 F1 9D D2 1D 57 B4 FA 6E 9A // ..e#.......W..n.
0D A9 6F 99 ) // ..o.
.ver 4:0:0:0
}
.assembly extern System.Xml
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (CF C3 B1 72 08 69 BD BB E6 44 00 42 96 52 1F 3A // ...r.i...D.B.R.:
DA 09 74 8C ) // ..t.
.ver 4:0:0:0
}
.assembly extern Microsoft.VisualC
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.hash = (42 DD BE 18 E0 BC 5D 94 9E E6 15 5C DA 78 D3 8E // B.....].....x..
53 A7 A1 AB ) // S...
.ver 10:0:0:0
}
.assembly extern nmdbid.net
{
.publickeytoken = (FA 96 9F 7C 42 5C 59 1F ) // ...|BY.
.hash = (D5 61 1A B8 49 88 5A 9C 17 B0 A3 E2 CA 5F 1D 15 // .a..I.Z......_..
09 8A F8 E8 )
.ver 6:4:0:4
}
.assembly extern nmdb.net
{
.publickeytoken = (48 AA 51 A8 E7 EF CD 8D ) // H.Q.....
.hash = (B9 4B F4 F5 95 55 BD 26 EB 5F A9 8F 80 9C 2E E2 // .K...U.&._......
42 85 5B 2D ) // B.[-
.ver 7:0:0:24
}
.assembly BCSAPINET
{
.custom instance void [mscorlib]System.Security.SecurityRulesAttribute::.ctor(valuetype [mscorlib]System.Security.SecurityRuleSet) = ( 01 00 01 00 00 )
.custom instance void [mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = ( 01 00 1A 2E 4E 45 54 46 72 61 6D 65 77 6F 72 6B // ....NETFramework
2C 56 65 72 73 69 6F 6E 3D 76 34 2E 30 01 00 54 // ,Version=v4.0..T
0E 14 46 72 61 6D 65 77 6F 72 6B 44 69 73 70 6C // ..FrameworkDispl
61 79 4E 61 6D 65 10 2E 4E 45 54 20 46 72 61 6D // ayName..NET Fram
65 77 6F 72 6B 20 34 ) // ework 4
.custom instance void [mscorlib]System.CLSCompliantAttribute::.ctor(bool) = ( 01 00 01 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
// bool) = ( 01 00 01 01 00 00 )
.custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = ( 01 00 00 00 00 )
.custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 23 74 68 65 47 75 61 72 64 21 20 53 65 72 // ..#theGuard! Ser
76 69 63 65 20 4D 61 6E 61 67 65 6D 65 6E 74 20 // vice Management
43 65 6E 74 65 72 00 00 ) // Center..
.custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 18 C2 A9 20 43 6F 70 79 72 69 67 68 74 20 // ..... Copyright
31 39 39 39 20 2D 20 32 30 31 31 00 00 ) // 1999 - 2011..
.custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 09 42 53 4D 41 50 49 4E 45 54 00 00 ) // ...BSMAPINET..
.custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 1F 52 45 41 4C 54 45 43 48 20 53 6F 66 74 // ...REALTECH Soft
77 61 72 65 20 50 72 6F 64 75 63 74 73 20 47 6D // ware Products Gm
62 48 00 00 ) // bH..
.custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 )
.custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 26 46 72 6F 6E 74 65 6E 64 20 67 65 6E 65 // ..&Frontend gene
72 69 63 20 61 67 65 6E 74 20 71 75 65 72 79 20 // ric agent query
69 6E 74 65 72 66 61 63 65 00 00 ) // interface..
.custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 0E 4E 65 74 77 6F 72 6B 4D 61 6E 61 67 65 // ...NetworkManage
72 00 00 ) // r..
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool SkipVerification = bool(true)},
[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool UnmanagedCode = bool(true)}}
.hash algorithm 0x00008004
.ver 7:0:0:0
}
.module BCSAPINET.dll
// MVID: {13C2871C-68A2-4993-BB00-33610F2F59AC}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0002 // WINDOWS_GUI
.corflags 0x00000010 //
// Image base: 0x03450000
[/code]
Any advices appreciated.
Regards
Frank
View the full article
It is simple C++/CLI VS2010 SP1 dll project (on a W2K3 x86 machine) which refers 6 Core and 2 additional strong-named assemblies as you can see from ildasm outprint below. I have an SNK file to apply for the dll. From the VS Build Detailed Log I can
verify that link exe is issued twice first with KEYFILE specified and secondly with KEYFILE omitted.
I have tried to workaround this problem by delay signing and executing a post build step as outlined here ( http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/61b58555-3579-40c9-9625-b17a9955e3f5 http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/61b58555-3579-40c9-9625-b17a9955e3f5 ).
But this does not work because sn complains that the assembly is NOT signed, therefore it cannot resign it (even when issuing explicitly on a command line). For further reference here is the relevant excerpt from the detailed build log:
Relevant Detailed Log Excerpt:
<pre>1>Done building target "PreLinkEvent" in project "BSMAPINET.vcxproj".
1>Target "Link" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.Targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Using "Link" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
<span style="color:#0000ff
1>Task "Link"
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1376
1> Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /KEYFILE:"......CommonVersionrelease.net.snk" /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /a /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r "DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUG.NETFRAMEWORK,VERSION=V4.0.ASSEMBLYATTRIBUTES.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGAPP.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGASSEMBLYINFO.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.EMBED.MANIFEST.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNATIVE.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNET.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGTESTBSMSERVERNET.OBJ" /b MSBuildConsole_CancelEventd5ff85296f6541b9bd8643b3f523594f /c "Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe" /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /KEYFILE:"......CommonVersionrelease.net.snk" /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1>Done executing task "Link".
1>Task "Message" skipped, due to false condition; ($(EmbedManifestBy) != LINK) was evaluated as (LINK != LINK).
1>Done building target "Link" in project "BSMAPINET.vcxproj".
1>Target "_DetermineManagedStateForLink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "_DetermineManagedStateForLink" in project "BSMAPINET.vcxproj".
1>Target "ComputeMetaGenInputs" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "MetaGenInputsOutputs" depends on it):
1>Task "Delete" skipped, due to false condition; ($(OutputAssemblyMetagenFile) != and $(ConsumeAnyMetaAssembly) == false and Exists($(OutputAssemblyMetagenFile))) was evaluated as (DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll.metagen != and true == false and Exists(DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll.metagen)).
1>Done building target "ComputeMetaGenInputs" in project "BSMAPINET.vcxproj".
1>Target "MetaGenInputsOutputs" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.MetaGen.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "MetaGenInputsOutputs" in project "BSMAPINET.vcxproj".
1>Target "MetaGen" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.MetaGen.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Building target "MetaGen" completely.
1>Input file "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" is newer than output file "Debug\metagen.write.1.tlog".
1>Using "METAGEN" task from assembly "Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "METAGEN"
1>Done executing task "METAGEN".
1>Done building target "MetaGen" in project "BSMAPINET.vcxproj".
1>Target "ComputeLinkImportLibraryOutputsForClean" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Task "WriteLinesToFile" skipped, due to false condition; (@(_LinkImportLibrary) != ) was evaluated as ( != ).
1>Done building target "ComputeLinkImportLibraryOutputsForClean" in project "BSMAPINET.vcxproj".
1>Target "AfterLink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Link" depends on it):
1>Done building target "AfterLink" in project "BSMAPINET.vcxproj".
1>Target "_Link" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "BuildLink" depends on it):
1>Done building target "_Link" in project "BSMAPINET.vcxproj".
1>Target "_ALink" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "BuildLink" depends on it):
1>Done building target "_ALink" in project "BSMAPINET.vcxproj".
1>Target "ComputeManifestInputsTargets" skipped. Previously built successfully.
1>Target "MakeDirsForManifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "Manifest" depends on it):
1>Task "MakeDir"
1>Done executing task "MakeDir".
1>Done building target "MakeDirsForManifest" in project "BSMAPINET.vcxproj".
1>Target "Manifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Manifest" depends on it):
1>Task "Delete"
1> Deleting file "DebugBCSAPINET.dll.embed.manifest".
1>Done executing task "Delete".
1>Using "Mt" task from assembly "Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Mt"
1> Crogram FilesMicrosoft SDKsWindowsv7.0Abinmt.exe /nologo /verbose /out:"DebugBCSAPINET.dll.embed.manifest" /manifest DebugBCSAPINET.dll.intermediate.manifest
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.INTERMEDIATE.MANIFEST /b MSBuildConsole_CancelEventb5e3a621aa6743a59b83c4d8083e46ea /c "Crogram FilesMicrosoft SDKsWindowsv7.0Abinmt.exe" /nologo /verbose /out:"DebugBCSAPINET.dll.embed.manifest" /manifest DebugBCSAPINET.dll.intermediate.manifest
1>Done executing task "Mt".
1>Task "RC"
1> Crogram FilesMicrosoft SDKsWindowsv7.0Abinrc.exe /nologo /fo"DebugBCSAPINET.dll.embed.manifest.res" DebugBCSAPINET_manifest.rc
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET_MANIFEST.RC /b MSBuildConsole_CancelEvent16c391249d694e6a878e9f0ea63e53ca /c "Crogram FilesMicrosoft SDKsWindowsv7.0Abinrc.exe" /nologo /fo"DebugBCSAPINET.dll.embed.manifest.res" DebugBCSAPINET_manifest.rc
1>Done executing task "RC".
1>Done building target "Manifest" in project "BSMAPINET.vcxproj".
1>Target "ComputeManifestGeneratedLinkerInputs" skipped. Previously built successfully.
1>Target "LinkEmbedManifest" in file "Crogram FilesMSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.Targets" from project "DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETBSMAPINET.vcxproj" (target "_Manifest" depends on it):
<span style="color:#0000ff 1>Task "Link"
1> Environment Variables passed to tool:
1> VS_UNICODE_OUTPUT=1412
1> Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1> Tracking command:
1> Crogram FilesMicrosoft SDKsWindowsv7.0AbinNETFX 4.0 ToolsTracker.exe /a /d C:WINDOWSMicrosoft.NETFrameworkv4.0.30319FileTracker.dll /i DrojectsNetworkManagerdevBSMBSMSvcBSMAPINETDebug /r "DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUG.NETFRAMEWORK,VERSION=V4.0.ASSEMBLYATTRIBUTES.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGAPP.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGASSEMBLYINFO.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBCSAPINET.DLL.EMBED.MANIFEST.RES|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNATIVE.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGBSMSERVERNET.OBJ|DROJECTSNETWORKMANAGERDEVBSMBSMSVCBSMAPINETDEBUGTESTBSMSERVERNET.OBJ" /b MSBuildConsole_CancelEventfb4d7520ca0744ec9377fd072dce89d5 /c "Crogram FilesMicrosoft Visual Studio 10.0VCbinlink.exe" /ERRORREPORTROMPT /OUT:"DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll" /INCREMENTAL /NOLOGO /LIBPATH:Libraries_devLIBsNMNM61libDebug /MANIFEST /ManifestFile:"DebugBCSAPINET.dll.intermediate.manifest" /MANIFESTUAC:"level=asInvoker uiAccess=false" /DEBUG /PDB:"DrojectsNetworkManagerdevBSMbinDebugBCSAPINET.pdb" /ASSEMBLYDEBUG /TLBID:1 /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 /DLL Debugapp.res
1> DebugBCSAPINET.dll.embed.manifest.res
1> DebugAssemblyInfo.obj
1> DebugBSMServerNative.obj
1> DebugBSMServerNET.obj
1> DebugTestBSMServerNet.obj
1> "Debug.NETFramework,Version=v4.0.AssemblyAttributes.obj"
1>Done executing task "Link".
1>Task "Message"
1> BSMAPINET.vcxproj -> DrojectsNetworkManagerdevBSMBSMSvcBSMAPINET....binDebugBCSAPINET.dll
[/code]
ILDASM info:
<pre>// Metadata version: v4.0.30319
.module extern KERNEL32.dll
.module extern MSVCR100D.dll
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (CD 95 65 AD 55 34 B6 AD 72 9D 3F BB 80 DA 0A 6C // ..e.U4..r.?....l
49 E5 F2 5B ) // I..[
.ver 4:0:0:0
}
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (49 5B AD 3A D8 09 75 36 30 77 14 15 51 02 69 F6 // I[.:..u60w..Q.i.
DE 26 7B B3 ) // .&{.
.ver 4:0:0:0
}
.assembly extern System.Data
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (FB 4E 0C 6E 9A 11 98 9A 54 BD 57 59 98 F2 D0 75 // .N.n....T.WY...u
A3 0A 93 18 )
.ver 4:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (D1 AD 65 23 DB A9 C1 F1 9D D2 1D 57 B4 FA 6E 9A // ..e#.......W..n.
0D A9 6F 99 ) // ..o.
.ver 4:0:0:0
}
.assembly extern System.Xml
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .zV.4..
.hash = (CF C3 B1 72 08 69 BD BB E6 44 00 42 96 52 1F 3A // ...r.i...D.B.R.:
DA 09 74 8C ) // ..t.
.ver 4:0:0:0
}
.assembly extern Microsoft.VisualC
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.hash = (42 DD BE 18 E0 BC 5D 94 9E E6 15 5C DA 78 D3 8E // B.....].....x..
53 A7 A1 AB ) // S...
.ver 10:0:0:0
}
.assembly extern nmdbid.net
{
.publickeytoken = (FA 96 9F 7C 42 5C 59 1F ) // ...|BY.
.hash = (D5 61 1A B8 49 88 5A 9C 17 B0 A3 E2 CA 5F 1D 15 // .a..I.Z......_..
09 8A F8 E8 )
.ver 6:4:0:4
}
.assembly extern nmdb.net
{
.publickeytoken = (48 AA 51 A8 E7 EF CD 8D ) // H.Q.....
.hash = (B9 4B F4 F5 95 55 BD 26 EB 5F A9 8F 80 9C 2E E2 // .K...U.&._......
42 85 5B 2D ) // B.[-
.ver 7:0:0:24
}
.assembly BCSAPINET
{
.custom instance void [mscorlib]System.Security.SecurityRulesAttribute::.ctor(valuetype [mscorlib]System.Security.SecurityRuleSet) = ( 01 00 01 00 00 )
.custom instance void [mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = ( 01 00 1A 2E 4E 45 54 46 72 61 6D 65 77 6F 72 6B // ....NETFramework
2C 56 65 72 73 69 6F 6E 3D 76 34 2E 30 01 00 54 // ,Version=v4.0..T
0E 14 46 72 61 6D 65 77 6F 72 6B 44 69 73 70 6C // ..FrameworkDispl
61 79 4E 61 6D 65 10 2E 4E 45 54 20 46 72 61 6D // ayName..NET Fram
65 77 6F 72 6B 20 34 ) // ework 4
.custom instance void [mscorlib]System.CLSCompliantAttribute::.ctor(bool) = ( 01 00 01 00 00 )
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
// bool) = ( 01 00 01 01 00 00 )
.custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = ( 01 00 00 00 00 )
.custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 23 74 68 65 47 75 61 72 64 21 20 53 65 72 // ..#theGuard! Ser
76 69 63 65 20 4D 61 6E 61 67 65 6D 65 6E 74 20 // vice Management
43 65 6E 74 65 72 00 00 ) // Center..
.custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 18 C2 A9 20 43 6F 70 79 72 69 67 68 74 20 // ..... Copyright
31 39 39 39 20 2D 20 32 30 31 31 00 00 ) // 1999 - 2011..
.custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 09 42 53 4D 41 50 49 4E 45 54 00 00 ) // ...BSMAPINET..
.custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 1F 52 45 41 4C 54 45 43 48 20 53 6F 66 74 // ...REALTECH Soft
77 61 72 65 20 50 72 6F 64 75 63 74 73 20 47 6D // ware Products Gm
62 48 00 00 ) // bH..
.custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 )
.custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 26 46 72 6F 6E 74 65 6E 64 20 67 65 6E 65 // ..&Frontend gene
72 69 63 20 61 67 65 6E 74 20 71 75 65 72 79 20 // ric agent query
69 6E 74 65 72 66 61 63 65 00 00 ) // interface..
.custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 0E 4E 65 74 77 6F 72 6B 4D 61 6E 61 67 65 // ...NetworkManage
72 00 00 ) // r..
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool SkipVerification = bool(true)},
[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool UnmanagedCode = bool(true)}}
.hash algorithm 0x00008004
.ver 7:0:0:0
}
.module BCSAPINET.dll
// MVID: {13C2871C-68A2-4993-BB00-33610F2F59AC}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0002 // WINDOWS_GUI
.corflags 0x00000010 //
// Image base: 0x03450000
[/code]
Any advices appreciated.
Regards
Frank
View the full article