Skip to main content

이 버전의 GitHub Enterprise Server는 다음 날짜에 중단됩니다. 2026-03-17. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.

C# compiler unexpectedly failing

If your MSBuild C# compilation is unexpectedly failing, you may need to amend your application project file.

이 문서의 내용

About these errors

The CodeQL tracer injects some flags into the C# compiler invocation to ensure every component is built and included in the CodeQL database, which may cause your C# code to build differently to what you expect during CodeQL analysis. See 컴파일된 언어에 CodeQL 코드 스캐닝.

/p:EmitCompilerGeneratedFiles=true is one of the injected properties, and emits compiler-generated files during the build process. This option causes the compiler to generate additional files that are used to support features such as improved regular expression support, serialization, and web application view generation. These generated artifacts are typically not written to disk by the compiler, but setting the option to true forces writing the files to disk, and so the extractor can process the files.

For some legacy projects, and projects that use .sqlproj files, you may see that the injected /p:EmitCompilerGeneratedFiles=true property causes unexpected issues with msbuild.

Confirming the cause of the problem

If you have set the "treat warnings as errors" flag, then msbuild will produce an error, which will cause the extraction to fail.

Fixing the problem

You should add the <CompilerGeneratedFilesOutputPath> element to the application's project file. For more information, see Understanding the project file in Microsoft Learn.