Given the following csproj,
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
Autobuild only looks at the root <Project> node and sees that it does not have an Sdk attribute, and subsequently incorrectly identifying that it is not compatible and switches to building using Mono. This way of writing SDK-style projects, specifically using <Import /> explicitly, is documented here https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2022#use-the-import-element-anywhere-in-your-project
I believe that the code which identifies whether a project is compatible is located here
https://github.com/github/codeql/blob/main/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs#L50
I have set up a repository which reproduces this issue https://github.com/Arthri/NonStdSdkAutobuild/
Given the following csproj,
Autobuild only looks at the root
<Project>node and sees that it does not have anSdkattribute, and subsequently incorrectly identifying that it is not compatible and switches to building using Mono. This way of writing SDK-style projects, specifically using<Import />explicitly, is documented here https://learn.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2022#use-the-import-element-anywhere-in-your-projectI believe that the code which identifies whether a project is compatible is located here
https://github.com/github/codeql/blob/main/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs#L50
I have set up a repository which reproduces this issue https://github.com/Arthri/NonStdSdkAutobuild/