Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
<VersionMajor>$(_VersionBase.Split('.')[0])</VersionMajor>
<VersionMinor>$(_VersionBase.Split('.')[1])</VersionMinor>
<VersionMajorMinor>$(VersionMajor).$(VersionMinor)</VersionMajorMinor>
<_RspFilePath>$(IntermediateOutputPath)replace-text-args.rsp</_RspFilePath>
<_ReplaceTextScriptPath>$(RepoRoot)tools/scripts/replace-text.cs</_ReplaceTextScriptPath>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -121,22 +123,25 @@
<Replacements Include="$(OpenTelemetryInstrumentationRuntimeVersion)" />
</ItemGroup>

<PropertyGroup>
<SourcesFilesArgs>&quot;@(SourceFiles, '&quot; &quot;')&quot;</SourcesFilesArgs>
<ReplacementsArgs>&quot;@(Replacements, '&quot; &quot;')&quot;</ReplacementsArgs>
</PropertyGroup>

<!-- Build the .rsp file content as an item group -->
<ItemGroup>
<CommandArgs Include="dotnet" />
<CommandArgs Include="$(RepoRoot)tools/scripts/replace-text.cs" />
<CommandArgs Include="--files" />
<CommandArgs Include="$(SourcesFilesArgs)" />
<!-- Replacement tokens and their values -->
<CommandArgs Include="--replacements" />
<CommandArgs Include="$(ReplacementsArgs)" />
<_RspLines Include="--files" />
<_RspLines Include="@(SourceFiles)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each line is treated as an argument, right? that's why we don't need to quote around them anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's my understanding, @baronfel?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More accurately, each line in the response file is trimmed and then treated as an individual token.

So yes, but with more words and more nitpicky.

<_RspLines Include="--replacements" />
<_RspLines Include="@(Replacements)" />
</ItemGroup>

<Exec Command="@(CommandArgs, ' ')" WorkingDirectory="$(MSBuildThisFileDirectory)" StandardOutputImportance="Normal" StandardErrorImportance="Normal" />
<!-- Write the .rsp file -->
<WriteLinesToFile File="$(_RspFilePath)"
Lines="@(_RspLines)"
Overwrite="true"
WriteOnlyWhenDifferent="true" />

<!-- Execute the script with the .rsp file, using double dash to pass arguments directly to the script -->
<Exec Command="dotnet &quot;$(_ReplaceTextScriptPath)&quot; -- @&quot;$(_RspFilePath)&quot;"
WorkingDirectory="$(MSBuildThisFileDirectory)"
StandardOutputImportance="Normal"
StandardErrorImportance="Normal" />
</Target>

<!-- Grabs the contents of the templates folder and copies them to IntermediateOutputPath directory -->
Expand Down
Loading