You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add PostSharpDependencyRestoreProperties to inject MSBuild properties into the generated dependency-restore project #40
The compiler dependency restore runs on a synthetic project generated under %ProgramData%\PostSharp\DependencyRestore\... (BuildTimeDependencyRestorer.CreateDependencyRestoreProject, Core/PostSharp.MSBuild/NetCore/BuildTimeDependencyRestorer.cs). Because it lives outside the repo, users cannot influence it with Directory.Build.props/nuget.config, and they cannot set restore-project properties (e.g. NuGetAudit, NuGetAuditLevel, NoWarn) without a PostSharp update.
This surfaced with the NU1901NuGet.Packaging warning (#39): the only user-side levers today are build-wide (a NuGetAudit=false environment variable, which also affects the user's own build) or band-aids (MSBuildWarningsAsMessages). There is no supported way to tweak just the restore project.
Proposal
Add a PostSharpDependencyRestoreProperties MSBuild property — semicolon-separated Name=Value pairs. The generator injects each pair as a child element of the generated restore project's <PropertyGroup>. It is scoped to the synthetic restore project only and does not affect the user's main build (unlike a global environment variable).
Default empty in Core/PostSharp.MSBuild/PostSharp.properties.
Pass through to the task in Core/PostSharp.MSBuild/PostSharp.targets (the PostSharpCompile invocation).
Surface on Core/PostSharp.MSBuild/PostSharpCompile.cs and on IBuildClient / BuildClient.
Consume in BuildTimeDependencyRestorer.CreateDependencyRestoreProject (and CreateReferencePackRestoreProject for consistency).
Details to get right
Cache invalidation. Fold the properties into dependencyRestoreId (the hash key used for the .touch / project.assets.json up-to-date check). Otherwise an existing cached restore looks up-to-date and the new property is silently ignored until the cache is cleared.
Semicolon escaping. A value such as NoWarn=NU1901;NU1902 collides with the list separator — support %3B for inner semicolons (standard MSBuild escaping).
Apply to both generated projects — the dependency restore project and the reference-pack restore project.
Activity
gfraiteur commentedon Oct 14, 2026
Released in PostSharp 2027.0.4-preview.
-- Claude for Gael