Skip to content

Commit d7de5fc

Browse files
committed
C#: Change asp.net core view generation to be opt out
1 parent d19ad49 commit d7de5fc

File tree

3 files changed

+10
-6
lines changed
  • csharp

3 files changed

+10
-6
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ public DependencyManager(string srcDir, IDependencyOptions options, ILogger logg
112112
}
113113

114114
var webViewExtractionOption = Environment.GetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS");
115-
if (bool.TryParse(webViewExtractionOption, out var shouldExtractWebViews) &&
115+
if (webViewExtractionOption == null ||
116+
bool.TryParse(webViewExtractionOption, out var shouldExtractWebViews) &&
116117
shouldExtractWebViews)
117118
{
118-
logger.LogInfo("Generating source files from cshtml and razor files...");
119119
GenerateSourceFilesFromWebViews(allNonBinaryFiles);
120120
}
121121

@@ -445,6 +445,14 @@ private void GenerateSourceFilesFromWebViews(List<FileInfo> allFiles)
445445

446446
logger.LogInfo($"Found {views.Length} cshtml and razor files.");
447447

448+
if (!fileContent.IsNewProjectStructureUsed)
449+
{
450+
logger.LogInfo("Generating source files from cshtml files is only supported for new (SDK-style) project files");
451+
return;
452+
}
453+
454+
logger.LogInfo("Generating source files from cshtml and razor files...");
455+
448456
var sdk = new Sdk(dotnet).GetNewestSdk();
449457
if (sdk != null)
450458
{
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import os
22
from create_database_utils import *
33

4-
5-
os.environ['CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS'] = 'true'
64
run_codeql_database_create(lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"])
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import os
22
from create_database_utils import *
33

4-
5-
os.environ['CODEQL_EXTRACTOR_CSHARP_STANDALONE_EXTRACT_WEB_VIEWS'] = 'true'
64
run_codeql_database_create(lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"])

0 commit comments

Comments
 (0)