InternalsVisibleTo PublicKey does not respect variables in NET5 Preview SDK
See original GitHub issueI’m hoping this is the right place, please let me know If I shouldraise the issue elsewhere.
For SDK versions prior to .NET 5 previews it is possible to declare InternalsVisibleTo
values in a Directory.Build.props
file in subfolders using the following approach.
<InternalsVisibleTo Include="SixLabors.ImageSharp.Web.Tests" PublicKey="$(SixLaborsPublicKey)" />
Where the variable had been declared in a root Directory.Build.props
file.
<SixLaborsPublicKey> KEY HERE </SixLaborsPublicKey>
When attempting to build a solution via dotnet build
with any .NET 5 preview SDK installed the folllowing error occurs.
error CS1726: Friend assembly reference 'SixLabors.ImageSharp.Web.Tests' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
What has changed which breaks current behavior and what (other than disabling the preview via global.json) is the correct workaround?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
InternalsVisibleTo attribute isn't working
In the External Tools dialog box, click Add and enter Get Assembly Public Key in the Title box. Fill the Command box by...
Read more >InternalsVisibleToAttribute Class (System.Runtime. ...
Specifies that types that are ordinarily visible only within the current assembly are visible to a specified assembly.
Read more >Version History - Documentation for GleamTech products
Fixed: In some cases, root folder quota was not respected, and chunks continued to be uploaded. A file that exceeds quota, will be...
Read more >Declaring InternalsVisibleTo in the csproj
A convention is to declare assembly attribute in the file AssemblyInfo.cs. With the new SDK-based project, there is no AssemblyInfo.cs by ...
Read more >C# 10 in a Nutshell
If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ladeak, this fix is not in https://github.com/dotnet/sdk/blob/release/7.0.1xx-preview5/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateAssemblyInfo.targets, but it is in https://github.com/dotnet/sdk/blob/release/7.0.1xx-preview6/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateAssemblyInfo.targets:
https://github.com/dotnet/sdk/blob/18c815b323b4ea40db52788c146de9b2c89c9baf/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateAssemblyInfo.targets#L109-L111
The SDK version does support
PublicKey
as well, but as a global property, rather than as metadata attached to an individual IVT: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.GenerateAssemblyInfo.targets#L108-L112