-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Regression in dotnet publish using .NET 9 SDK 9.0.200 #47227
Comments
I think this is a duplicate of #43908 |
Don't think it is a duplicate, we use |
@alexbereznikov did your binlog also say you were using .NET SDK 9.0.200 or higher? And you are also using WFP? If so, I do think it is a duplicate. The timing of the issue is not really relevant here - it was logged against the SDK while we were still working on making 9.0.200 - the only reason it hit you just now is because of the rate of update of the AzDo runners - if they updated with nightlies or previews I suspect you would have seen this much sooner. |
I inspected binlog again and yes, the issue is very similar to #43908 but task name is different - |
So, I added this to Directory.Build.targets (essentially reverting #43908 fix) <Target Name="AddImplicitDefineConstants_Temp"
Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' "
DependsOnTargets="GenerateTargetPlatformDefineConstants;GenerateNETCompatibleDefineConstants;GeneratePlatformCompatibleDefineConstants;_DisableDiagnosticTracing"
BeforeTargets="CoreCompile" >
<PropertyGroup>
<DefineConstants Condition=" '@(_ImplicitDefineConstant)' != '' " >$(DefineConstants);@(_ImplicitDefineConstant)</DefineConstants>
<FinalDefineConstants Condition=" '@(_ImplicitDefineConstant)' != '' and '$(Language)' == 'VB' " >$(FinalDefineConstants),@(_ImplicitDefineConstant->'%(Identity)=-1', ',')</FinalDefineConstants>
</PropertyGroup>
</Target> And it started to compile again. My opinion - that change led to this regression. For me it reproduces with msbuild as well |
Cc @Sergio0694 |
Version Used:
9.0.200
Steps to Reproduce:
Expected Behavior:
Project is compiled successfully.
Actual Behavior:
Compilation fails because the directive #if NET6_0_OR_GREATER present in Program.cs file is not respected.
TestApp.zip
Description:
Seems the logic that adds the /define constants during build process has changed. Please inspect both log files I've attached, produced when compiling the same TestApp using SDKs 9.0.103 and 9.0.200. Inspect line 48 in both files.
In 9.0.103 the /define constants looks correct:
while in 9.0.200 the produced set with the constants is way shorter:
Since that the constant NET6_0_OR_GREATER is not included in the CoreCompile step, the build fails, because in my test app I use it to include/exclude a non-compilable line "DoNotCompile" (Program.cs, line 10).
Not sure why, but this behavior is reproducible when I have a .xaml file and it contains a namespace to the current project (see View.xaml, line 3).
If you remove line 3 in View.xaml, the compilation will work fine with SDK 9.0.200.
The issue is not reproducible with dotnet build or msbuild commands.
Hope it will be fixed soon.
The text was updated successfully, but these errors were encountered: