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
If I use this in a project and build with Visual Studio the code is included. But when I analyse that same project with buildalyzer the preprocessor symbols are not added. Only the default symbols.
This will compile in VS and dotnet build, but not in buildalyzer
Context
I'm not sure yet why they are missing in Buildalyzer. They should be added on SDK style projects. But there is a message saying: For traditional, non-SDK-style projects, you have to manually configure the conditional compilation symbols for the different target frameworks in Visual Studio via the project's properties pages.
So it might just be the case some SDK assembly is not loaded? Or if we have bad luck this is custom logic in MSBuild thats used in VS and the dotnet CLI.
Either way I can't compile the project that builalyzer returns... I also see no workaround as the symbols are added at parse time and can't be changed once the syntax tree has been parsed.
The issue is that the DefineConstants property is lacking the *_OR_GREATER constants. But I have found a property that contains all constants we need. It's private so we can't access it.
I'll try to create a PR that makes this public and will also fix the internal usage so Buildalyzer support the new preprocessor symbols from now on.
As mentioned on this page https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives I can use new symobols in preprocessor if like
NETCOREAPP3_1_OR_GREATER
which should be added if the targetframework is greater than 3.1.If I use this in a project and build with Visual Studio the code is included. But when I analyse that same project with buildalyzer the preprocessor symbols are not added. Only the default symbols.
Reproduction
Reference .NET 6 and add to a file
This will compile in VS and dotnet build, but not in buildalyzer
Context
I'm not sure yet why they are missing in Buildalyzer. They should be added on SDK style projects. But there is a message saying:
For traditional, non-SDK-style projects, you have to manually configure the conditional compilation symbols for the different target frameworks in Visual Studio via the project's properties pages.
So it might just be the case some SDK assembly is not loaded? Or if we have bad luck this is custom logic in MSBuild thats used in VS and the dotnet CLI.
Either way I can't compile the project that builalyzer returns... I also see no workaround as the symbols are added at parse time and can't be changed once the syntax tree has been parsed.
Issue was found in stryker-mutator/stryker-net#1828
The text was updated successfully, but these errors were encountered: