manuelbl / SwissQRBill.NET

.NET library for Swiss QR bill payment slips (aka QR-Rechnung)
MIT License
86 stars 32 forks source link

Set ContinuousIntegrationBuild = true only in Release configuration #53

Closed 0xced closed 2 years ago

0xced commented 2 years ago

This breaks debugging unit tests. Anyway, it's already set by the continuous integration workflow:

env: Configuration: Release ContinuousIntegrationBuild: true

manuelbl commented 2 years ago

I've never had any issues debugging unit test. Can you be more specific? How do you run into problems?

I'm asking because this change now causes problems. The pack command fails since package validation fails (both from within Visual Studio as well as from the command line):

C:\Users\m\Documents\SwissQRBill.NET\Core>dotnet pack --configuration Release
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  Core -> C:\Users\m\Documents\SwissQRBill.NET\Core\bin\Release\netstandard2.0\Codecrete.SwissQRBill.Core.dll
  Tool 'dotnet-validate' (version '0.0.1-preview.280') was restored. Available commands: dotnet-validate

  Restore was successful.
  Validating C:\Users\m\Documents\SwissQRBill.NET\Core\bin\Release\Codecrete.SwissQRBill.Core.3.0.4.nupkg
   Source Link: ? Valid

   Deterministic (dll/exe): ? Non deterministic
      Ensure that the following property is enabled for CI builds and you're using at least the 2.1.300 SDK:
      <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
      The following assemblies have not been compiled with deterministic settings:
      lib\netstandard2.0\Codecrete.SwissQRBill.Core.dll

   Compiler Flags: ? Valid

C:\Users\m\Documents\SwissQRBill.NET\Core\Core.csproj(67,5): error MSB3073: The command "dotnet validate package local bin\Release\Codecrete.SwissQRBill.Core.3.0.4.nupkg" exited with code 1.
0xced commented 2 years ago

I've never had any issues debugging unit test. Can you be more specific? How do you run into problems?

I'm using Rider (on both macOS and Windows) and with the ContinuousIntegrationBuild MSBuild property set to true, Rider can't see breakpoints in the Core, PixelCanvas, and Windows projects so it becomes impossible to debug:

image

The pack command fails since package validation fails

Indeed validation fails when the ContinuousIntegrationBuild property is not set and that's expected. You can make the validation pass by explicitly setting ContinuousIntegrationBuild to true:

dotnet pack --configuration Release -p:ContinuousIntegrationBuild=true

Note that for a real continuous integration build, i.e. on GitHub actions, the ContinuousIntegrationBuild setting is set to true and the configuration is set to Release through environment variables (all environment variables are available to the Microsoft Build Engine (MSBuild) project file as properties):

https://github.com/manuelbl/SwissQRBill.NET/blob/2acda640e4690657c940ed7b7aad360b5a2ad547/.github/workflows/continuous-integration.yml#L5-L7

manuelbl commented 2 years ago

Is there a way to make the Pack command within Visual Studio work again?

0xced commented 2 years ago

I just did this in 78a87e5a02491f995de90dec07220609d784d4b9:

<ContinuousIntegrationBuild Condition="$(Configuration) == 'Release'">true</ContinuousIntegrationBuild>

This way, packing with the Release configuration works and debugging in Rider with the Debug configuration also works. 🥳

0xced commented 2 years ago

Thanks for merging! 🚀 Are you planing to release a new version on NuGet soon?

manuelbl commented 2 years ago

I will likely release it within 2 days. The port to Java is already done.