"Enable Optimizations" not differentiating between Debug and Release configuration for AnyCPU

Pino Carafa 121 Reputation points
2021-01-26T14:25:03.81+00:00

I am developing a Solution with a good few VB.NET projects in it.

In the x86 and x64 configurations I have made sure that "Enable Optimizations" is checked in the Release configuration and unchecked in the Debug configuration.

In the AnyCPU configurations, however, it doesn't seem to be able to have different settings between the Release and Debug configuration. When I check the checkbox, it will show as checked both in the Release and Debug configuration. When I uncheck it, it will show as unchecked in both.

This wouldn't be a big deal as I could just as easily debug the software in an x86 or an x64 configuration, except for the fact that the software is using Add-In Express and it MUST be built for AnyCPU.

Is this a known bug? Can it be addressed? Am using Visual Studio 2019 and keeping it up to date.

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
948 questions
{count} votes

Accepted answer
  1. Michael Taylor 48,981 Reputation points
    2021-01-26T14:37:22.59+00:00

    Why do you believe the settings are the same? I created a quick VB console app in 16.8.4 and the Debug configuration does not enable optimizations and the Release configuration does as I would expect. Decompiling the generated code for both debug and release builds indicates the assembly has the appropriate optimization flags set for the JIT when it runs later on.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Pino Carafa 121 Reputation points
    2021-01-27T15:53:37.293+00:00

    I accepted @Michael Taylor earlier answers but the real "aha" moment came when I was looking at his or her comments on @Tianyu Sun-MSFT 's earlier answer.

    0 comments No comments