Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit 2e1ed0b

Browse files
committed
Only generate code when Generator metadata is set
This was the documented and (I believe) prior behavior, but somewhere along the lines it must have regressed. Fixes #33
1 parent e454034 commit 2e1ed0b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/CodeGeneration.Roslyn.Tasks/build/CodeGeneration.Roslyn.BuildTime.targets

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
3+
44
<Target Name="GenerateCodeFromAttributes" DependsOnTargets="ResolveReferences" BeforeTargets="CoreCompile;PrepareResources">
5+
<ItemGroup>
6+
<Compile_CodeGenInputs Include="@(Compile)" Condition=" '%(Compile.Generator)' == 'MSBuild:GenerateCodeFromAttributes' " />
7+
</ItemGroup>
58
<PropertyGroup>
69
<GenerateCodeFromAttributesToolPathOverride Condition="'$(GenerateCodeFromAttributesToolPathOverride)' == ''">codegen</GenerateCodeFromAttributesToolPathOverride>
710
<_CodeGenToolOutputBasePath>$(IntermediateOutputPath)$(MSBuildProjectFile).dotnet-codegen</_CodeGenToolOutputBasePath>
@@ -18,15 +21,15 @@ $(MSBuildProjectDirectory)
1821
--generatedFilesList
1922
$(_CodeGenToolGeneratedFileListFullPath)
2023
--
21-
@(Compile, '%0d%0a')
24+
@(Compile_CodeGenInputs, '%0d%0a')
2225
</_CodeGenToolResponseFileLines>
2326
<_GenerateCodeToolVersion>(n/a)</_GenerateCodeToolVersion>
2427
</PropertyGroup>
2528
<!--Write response file with arguments for dotnet codegen-->
2629
<WriteLinesToFile File="$(_CodeGenToolResponseFileFullPath)" Lines="$(_CodeGenToolResponseFileLines)" Overwrite="true" />
2730
<Delete Condition="Exists('$(_CodeGenToolGeneratedFileListFullPath)') == 'true'"
2831
Files="$(_CodeGenToolGeneratedFileListFullPath)" ContinueOnError="true" />
29-
32+
3033
<!--Check and print tool version used-->
3134
<Exec Command="dotnet $(GenerateCodeFromAttributesToolPathOverride) --version" ConsoleToMsBuild="true"
3235
StandardOutputImportance="normal" ContinueOnError="true">
@@ -47,5 +50,5 @@ $(_CodeGenToolGeneratedFileListFullPath)
4750
<FileWrites Include="$(_CodeGenToolResponseFileFullPath);$(_CodeGenToolGeneratedFileListFullPath)" />
4851
</ItemGroup>
4952
</Target>
50-
53+
5154
</Project>

0 commit comments

Comments
 (0)