You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with the .NET template engine where applyFileRenamesToArgs does not properly substitute the symbol values for ServiceName and ServiceType within the args of a post-action. I want to pass these parameters to a PowerShell script, but the symbols remain as placeholders (ServiceName}, {ServiceType) rather than being replaced with the actual values input by the user.
Expected Behavior: When using applyFileRenamesToArgs, I expect the symbols specified (ServiceName and ServiceType) to be replaced with the actual values provided by the user during template instantiation.
Template instantiation - example: dotnet new microservice -n TypeTest.MyServiceTest --ServiceType TypeTest --ServiceName MyServiceTest
Post-Action run script - example: powershell -ExecutionPolicy Bypass -File ./Create_file.ps1 TypeTest MyServiceTest
Actual Behavior: The placeholders {ServiceName} and {ServiceType} are not replaced with the user-specified values and are passed to the PowerShell script as literal strings instead.
What I have:
Template instantiation - example: dotnet new microservice -n TypeTest.MyServiceTest --ServiceType TypeTest --ServiceName MyServiceTest
Post-Action run script - example: powershell -ExecutionPolicy Bypass -File ./Create_file.ps1 ServiceType ServiceName
To Reproduce
In template.json
create symbols and postAction run script
Product
dotnet CLI (dotnet new)
Describe The Bug
I'm encountering an issue with the .NET template engine where applyFileRenamesToArgs does not properly substitute the symbol values for ServiceName and ServiceType within the args of a post-action. I want to pass these parameters to a PowerShell script, but the symbols remain as placeholders (ServiceName}, {ServiceType) rather than being replaced with the actual values input by the user.
Expected Behavior: When using applyFileRenamesToArgs, I expect the symbols specified (ServiceName and ServiceType) to be replaced with the actual values provided by the user during template instantiation.
Template instantiation - example:
dotnet new microservice -n TypeTest.MyServiceTest --ServiceType TypeTest --ServiceName MyServiceTest
Post-Action run script - example:
powershell -ExecutionPolicy Bypass -File ./Create_file.ps1 TypeTest MyServiceTest
Actual Behavior: The placeholders {ServiceName} and {ServiceType} are not replaced with the user-specified values and are passed to the PowerShell script as literal strings instead.
What I have:
Template instantiation - example:
dotnet new microservice -n TypeTest.MyServiceTest --ServiceType TypeTest --ServiceName MyServiceTest
Post-Action run script - example:
powershell -ExecutionPolicy Bypass -File ./Create_file.ps1 ServiceType ServiceName
To Reproduce
create symbols and postAction run script
Generate project with standard command with --ServiceName and --ServiceType:
example: dotnet new microservice -n TypeTest.MyServiceTest --ServiceType TypeTest --ServiceName MyServiceTest
dotnet Info
output
.NET SDK: Version: 8.0.303 Commit: 29ab8e3268 Workload version: 8.0.300-manifests.34944930 MSBuild version: 17.10.4+10fbfbf2eRuntime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.303\
.NET workloads installed:
[maui-windows]
Installation Source: VS 17.10.35122.118
Manifest Version: 8.0.61/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.61\WorkloadManifest.json
Install Type: FileBased
[maccatalyst]
Installation Source: VS 17.10.35122.118
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.2.8053\WorkloadManifest.json
Install Type: FileBased
[ios]
Installation Source: VS 17.10.35122.118
Manifest Version: 17.2.8053/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.2.8053\WorkloadManifest.json
Install Type: FileBased
[android]
Installation Source: VS 17.10.35122.118
Manifest Version: 34.0.95/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.95\WorkloadManifest.json
Install Type: FileBased
[aspire]
Installation Source: VS 17.10.35122.118
Manifest Version: 8.0.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.7
Architecture: x64
Commit: 2aade6beb0
.NET SDKs installed:
6.0.427 [C:\Program Files\dotnet\sdk]
8.0.303 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
D:\source\main5\Sources\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Visual Studio Version
I use Visual Studio Code
Additional context
Is my postAction correct?
How should I pass those arguments ?
I also tried to put "applyFileRenamesToArgs": ["ServiceType", "ServiceName"], inside args.. but still it didn't work.
The text was updated successfully, but these errors were encountered: