none
Failed to build C# project if it Strong Sign is enabled and it has Language Resources embedded with the error al1044 RRS feed

  • Question

  • 
    

    Failed to build C# Windows Application if Strong name signing is enabled and this project has Language specific string resources embedded. Error: AL1044. In the AssemblyInfo.cs, I've assigned SN Key file path in the Assembly attributes with delay sign set to true. From the error what I observed was, the key path AL is trying to read is not correct. I gave the path as "..\common\snpubkey.snk", but AL.exe is trying to read from "..\..\common\snpubkey.snk". This looks to be bug from VS. Any workaround or fix available for this issue?



    • Edited by jbp11787 Monday, May 4, 2015 9:01 AM
    • Moved by Tina-Shi Tuesday, May 5, 2015 3:36 AM the issue is related to the CRL
    Monday, May 4, 2015 8:50 AM

Answers

  • I was able to reproduce your problem by using Visual Studio 2010 SP1 and putting these attributes in Properties\AssemblyInfo.cs:

    [assembly: AssemblyDelaySign(true)]
    [assembly: AssemblyKeyFile(@"..\common\snpubkey.snk")]

    The error was:

    GenerateSatelliteAssemblies:

    c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\AL.exe /culture:fi-fi /delaysign+ /out:obj\x86\Debug\fi-fi\asmsign.resources.dll /platform:x86 /template:obj\x86\Debug\asmsign.exe /embed:obj\x86\Debug\asmsign.Resources.fi-fi.resources

    ALINK : error AL1044: Error reading key file '..\..\common\snpubkey.snk' -- The system cannot find the path specified.

    The compiler also reported two warnings:

    1. warning CS1699: Use command line option '/delaysign' or appropriate project settings instead of 'AssemblyDelaySign'
    2. warning CS1699: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile'

    The documentation of warning CS1699 appears to mention your problem: "Attributes also make it more difficult for the project system to properly sign satellite assemblies."

    I then removed those attributes, opened the properties of the project, selected the Signing tab, checked "Sign the assembly" and "Delay sign only", selected "<Browse…>" under "Choose a strong name key file", and browsed to the snpubkey.snk file. Visual Studio copied that file to the project folder and set the AssemblyOriginatorKeyFile and DelaySign properties in the *.csproj file. When I built the project, the command lines of Csc.exe and AL.exe included the /delaysign+ /keyfile:snpubkey.snk options, and the build succeeded.

    I then removed snpubkey.snk from the project, chose Project → Add Existing Item…, browsed to the ..\common\snpubkey.snk file, and chose Add As Link.  This caused the absolute path of the ..\common\snpubkey.snk file to appear in the combo box under "Choose a strong name key file", and I selected it from there. Visual Studio saved the relative path to the *.csproj file as <AssemblyOriginatorKeyFile>..\common\snpubkey.snk</AssemblyOriginatorKeyFile>. When I built the project, the command lines of Csc.exe and AL.exe include the /delaysign+ /keyfile:..\common\snpubkey.snk options, and the build succeeded.

    If these workarounds do not suit your requirements, you could also try putting the absolute file name in the AssemblyKeyFileAttribute.


    • Edited by ranta Wednesday, May 6, 2015 9:04 AM add a paragraph about CS1699
    • Marked as answer by jbp11787 Tuesday, May 12, 2015 5:18 AM
    Wednesday, May 6, 2015 9:00 AM

All replies

  • Hi jbp11787,

    Thank you for posting in MSDN forum.

    Since this issue is related to the assembly, so we will move this issue to the CLR forum:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=clr ,you will get better support.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Tina-Shi Tuesday, May 5, 2015 3:35 AM
    Tuesday, May 5, 2015 3:35 AM
  • Can someone look at this issue asap?
    Wednesday, May 6, 2015 5:47 AM
  • I was able to reproduce your problem by using Visual Studio 2010 SP1 and putting these attributes in Properties\AssemblyInfo.cs:

    [assembly: AssemblyDelaySign(true)]
    [assembly: AssemblyKeyFile(@"..\common\snpubkey.snk")]

    The error was:

    GenerateSatelliteAssemblies:

    c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\AL.exe /culture:fi-fi /delaysign+ /out:obj\x86\Debug\fi-fi\asmsign.resources.dll /platform:x86 /template:obj\x86\Debug\asmsign.exe /embed:obj\x86\Debug\asmsign.Resources.fi-fi.resources

    ALINK : error AL1044: Error reading key file '..\..\common\snpubkey.snk' -- The system cannot find the path specified.

    The compiler also reported two warnings:

    1. warning CS1699: Use command line option '/delaysign' or appropriate project settings instead of 'AssemblyDelaySign'
    2. warning CS1699: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile'

    The documentation of warning CS1699 appears to mention your problem: "Attributes also make it more difficult for the project system to properly sign satellite assemblies."

    I then removed those attributes, opened the properties of the project, selected the Signing tab, checked "Sign the assembly" and "Delay sign only", selected "<Browse…>" under "Choose a strong name key file", and browsed to the snpubkey.snk file. Visual Studio copied that file to the project folder and set the AssemblyOriginatorKeyFile and DelaySign properties in the *.csproj file. When I built the project, the command lines of Csc.exe and AL.exe included the /delaysign+ /keyfile:snpubkey.snk options, and the build succeeded.

    I then removed snpubkey.snk from the project, chose Project → Add Existing Item…, browsed to the ..\common\snpubkey.snk file, and chose Add As Link.  This caused the absolute path of the ..\common\snpubkey.snk file to appear in the combo box under "Choose a strong name key file", and I selected it from there. Visual Studio saved the relative path to the *.csproj file as <AssemblyOriginatorKeyFile>..\common\snpubkey.snk</AssemblyOriginatorKeyFile>. When I built the project, the command lines of Csc.exe and AL.exe include the /delaysign+ /keyfile:..\common\snpubkey.snk options, and the build succeeded.

    If these workarounds do not suit your requirements, you could also try putting the absolute file name in the AssemblyKeyFileAttribute.


    • Edited by ranta Wednesday, May 6, 2015 9:04 AM add a paragraph about CS1699
    • Marked as answer by jbp11787 Tuesday, May 12, 2015 5:18 AM
    Wednesday, May 6, 2015 9:00 AM
  • Thanks Ranta, this workaround helped me.
    Tuesday, May 12, 2015 5:19 AM