Skip to content

Commit

Permalink
Fix build when using source generators (#6534)
Browse files Browse the repository at this point in the history
Fixes #6522
  • Loading branch information
ThomasGoulet73 authored Jun 14, 2022
1 parent 611b64d commit 6021101
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@
MSBuildBinPath="$(MSBuildBinPath)"
ReferencePathTypeName="ReferencePath"
CompileTypeName="Compile"
AnalyzerTypeName="Analyzer"
GeneratedCodeFiles="@(_GeneratedCodeFiles)"
ReferencePath="@(ReferencePath)"
BaseIntermediateOutputPath="$(BaseIntermediateOutputPath)"
Expand All @@ -449,7 +450,7 @@
CompileTargetName="$(_CompileTargetNameForLocalType)"
GenerateTemporaryTargetAssemblyDebuggingInformation="$(GenerateTemporaryTargetAssemblyDebuggingInformation)"
IncludePackageReferencesDuringMarkupCompilation="$(IncludePackageReferencesDuringMarkupCompilation)"
Analyzers="$(Analyzers)"
Analyzers="@(Analyzer)"
TemporaryTargetAssemblyProjectName="$(_TemporaryTargetAssemblyProjectName)"
MSBuildProjectExtensionsPath="$(MSBuildProjectExtensionsPath)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport()
// Add GeneratedCodeFiles to Compile item list.
AddNewItems(xmlProjectDoc, CompileTypeName, GeneratedCodeFiles);

// Add Analyzers to Analyzer item list.
AddNewItems(xmlProjectDoc, AnalyzerTypeName, Analyzers);

// Replace implicit SDK imports with explicit SDK imports
ReplaceImplicitImports(xmlProjectDoc);

Expand All @@ -274,7 +277,6 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport()
( nameof(BaseIntermediateOutputPath), BaseIntermediateOutputPath ),
( nameof(MSBuildProjectExtensionsPath), MSBuildProjectExtensionsPath ),
( "_TargetAssemblyProjectName", Path.GetFileNameWithoutExtension(CurrentProject) ),
( nameof(Analyzers), Analyzers )
};

AddNewProperties(xmlProjectDoc, properties);
Expand Down Expand Up @@ -481,9 +483,20 @@ public bool GenerateTemporaryTargetAssemblyDebuggingInformation
/// Required for Source Generator support. May be null.
///
/// </summary>
public string Analyzers
public ITaskItem[] Analyzers
{ get; set; }

/// <summary>
/// AnalyzerTypeName
/// The appropriate item name which can be accepted by managed compiler task.
/// It is "Analyzer" for now.
///
/// Adding this property is to make the type name configurable, if it is changed,
/// No code is required to change in this task, but set a new type name in project file.
/// </summary>
[Required]
public string AnalyzerTypeName { get; set; }

/// <summary>
/// BaseIntermediateOutputPath
///
Expand Down

0 comments on commit 6021101

Please sign in to comment.