dotnet / dotnet/arcade

Add DllSafeSearchPathAttribute by default to all .NET Core assemblies

Open
#1,888 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

Can we consider adding the following attribute to all .NET Core assemblies by default.

```
[assembly:DefaultDllImportSearchPathsAttribute(DllImportSearchPath::AssemblyDirectory | DllImportSearchPath::System32)]
```

BuildTools already seems to do this here:

- Initializes `IncludeDllSafeSearchPathAttribute` property [here](https://github.com/dotnet/buildtools/blob/4642e67685b9c21c4d5160ea7665843a48ed8155/src/Microsoft.DotNet.Build.Tasks/PackageFiles/versioning.targets#L43)
- Generates the assembly attribute [here](https://github.com/dotnet/buildtools/blob/6736870b84e06b75e7df32bb84d442db1b2afa10/src/Microsoft.DotNet.Build.Tasks/PackageFiles/GenerateAssemblyInfo.Sdk.targets#L41)

Assemblies that are now generated in an Arcade SDK based repo seem to be silently losing this assembly level attribute.

cc @ericstj, @rladuca, @stevenbrix, @dotnet/wpf-developers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.