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

Conditional Avalonia.Diagnostics #266

Open
PetSerAl opened this issue Aug 25, 2024 · 0 comments
Open

Conditional Avalonia.Diagnostics #266

PetSerAl opened this issue Aug 25, 2024 · 0 comments

Comments

@PetSerAl
Copy link

Is your feature request related to a problem? Please describe.

Avalonia template include conditional package Avalonia.Diagnostics with Condition attribute directly on PackageReference element.

<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="AvaloniaVersionTemplateParameter" />

Such approach is not friendly with lock file. For example:

dotnet restore --use-lock-file -property:Configuration=Debug
dotnet restore --use-lock-file --locked-mode -property:Configuration=Release

Second command will fail with NU1004 error.

Describe the solution you'd like

Move conditional attribute to metadata IncludeAssets and PrivateAssets:

<PackageReference Include="Avalonia.Diagnostics" Version="AvaloniaVersionTemplateParameter">
  <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
  <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>

That exclude assembly from Release build output, but allows restore with --locked-mode.

Describe alternatives you've considered

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant