C#: Change asp.net core view generation to be opt out

This commit is contained in:
Tamas Vajk
2024-01-29 10:52:26 +01:00
parent d19ad49313
commit d7de5fcfcb
3 changed files with 10 additions and 6 deletions

View File

@@ -112,10 +112,10 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
}
var webViewExtractionOption = Environment.GetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS");
if (bool.TryParse(webViewExtractionOption, out var shouldExtractWebViews) &&
if (webViewExtractionOption == null ||
bool.TryParse(webViewExtractionOption, out var shouldExtractWebViews) &&
shouldExtractWebViews)
{
logger.LogInfo("Generating source files from cshtml and razor files...");
GenerateSourceFilesFromWebViews(allNonBinaryFiles);
}
@@ -445,6 +445,14 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
logger.LogInfo($"Found {views.Length} cshtml and razor files.");
if (!fileContent.IsNewProjectStructureUsed)
{
logger.LogInfo("Generating source files from cshtml files is only supported for new (SDK-style) project files");
return;
}
logger.LogInfo("Generating source files from cshtml and razor files...");
var sdk = new Sdk(dotnet).GetNewestSdk();
if (sdk != null)
{

View File

@@ -1,6 +1,4 @@
import os
from create_database_utils import *
os.environ['CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS'] = 'true'
run_codeql_database_create(lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"])

View File

@@ -1,6 +1,4 @@
import os
from create_database_utils import *
os.environ['CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS'] = 'true'
run_codeql_database_create(lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"])