Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResolveComReference task should support PublicSign #4317

Open
KirillOsenkov opened this issue Apr 17, 2019 · 4 comments
Open

ResolveComReference task should support PublicSign #4317

KirillOsenkov opened this issue Apr 17, 2019 · 4 comments
Labels
Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. triaged

Comments

@KirillOsenkov
Copy link
Member

Currently ResolveComReference accepts KeyFile and DelaySign parameters:
https://github.com/Microsoft/msbuild/blob/518c2fb4bd8621fe0d97e8a233f9ae9599d4b8d4/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2734

However if a project specifies DelaySign=false and PublicSign=true then the project that has a ComReference such as:

  <ItemGroup>
    <COMReference Include="SHDocVw">
      <Guid>{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>1</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
      <EmbedInteropTypes>True</EmbedInteropTypes>
    </COMReference>
  </ItemGroup>

Fails the build with:

SHDocVw error MSB3299: The key file 'f:\agent\FinalPublicKey.snk' does not contain a public/private key pair.[f:\agent\Test.csproj]

because the .snk only contains the public key.

@rainersigwald
Copy link
Member

rainersigwald commented Apr 17, 2019 via email

@AaronRobinsonMSFT
Copy link
Member

@KirillOsenkov I am interested in the root problem here. Is this an issue purely because of the <EmbedInteropTypes>True</EmbedInteropTypes>? I don't fully understand how the signing of a project that references a COM library is impacted by that reference. Perhaps this is an issue with the generation of the PIA via tlbimp?

@KirillOsenkov
Copy link
Member Author

Caveat: I don't know anything about ResolveComReference. Background: I was switching DelaySign to PublicSign on a large solution, and it is done in one shared location (Directory.Build.props). When I did that, the project that contained the COM reference started failing to build (the ResolveComReference task logged an error):

image

I have worked around it by switching that particular project back to DelaySign. However I've decided to file a bug just in case because it felt like switching to PublicSign shouldn't break that way.

Adding @nguerrera to see if he has any insights.

@KirillOsenkov KirillOsenkov added the Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. label Apr 9, 2020
@KirillOsenkov
Copy link
Member Author

Ran into this again. Every time I try to eliminate DelaySign from a solution (so it doesn't require StrongNameHijack on the machine to build it), and replace with PublicSign, if the solution uses ResolveComReference we hit this.

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. triaged
Projects
None yet
Development

No branches or pull requests

4 participants