-
Notifications
You must be signed in to change notification settings - Fork 394
Description
Product
dotnet CLI (dotnet new)
Describe The Bug
I'm creating some templates to speed up the creation process for certain projects, specifically when using clean architecture. My templates work correctly when used from the terminal, but if I try to create any of these projects from any IDE, it ignores the postActions. I tried it with Rider and Visual Studio, and it didn't work with either. Basically, I'm adding dynamic NuGet packages depending on whether the user wants to use NativeAOT or not, but these are completely ignored.
Here is the code, as you can see I have to comment the post actions to go in other way.:
{
"$schema": "http://json.schemastore.org/template",
"author": "kopticx",
"classifications": [
"AWS",
"API",
"Lambda",
"Aot",
"Annotations",
"Clean Architecture"
],
"name": "AWS Lambda Function with Clean Architecture and support for Native AOT",
"description": "AWS Lambda Function configured for Dependency Injection with Lambda Annotations, Clear Architecture and support for Native AOT",
"identity": "Kopticx.Lambda.Function.CleanArch.CSharp",
"groupIdentity": "Kopticx.Lambda.Function.CleanArch",
"shortName": "Kopticx.Lambda.CleanArch",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "MyCleanArchAwsLambdaTemplate",
"preferNameDirectory": true,
"symbols": {
"UseNativeAOT": {
"type": "parameter",
"dataType": "bool",
"defaultValue": false,
"description": "Enable Native AOT compilation for the project"
}
},
"sources": [
{
"modifiers": [
{
"condition": "(!UseNativeAOT)",
"exclude": [
"src/MyCleanArchAwsLambdaTemplate.Lambda/AssemblyInfo.cs",
"src/MyCleanArchAwsLambdaTemplate.Lambda/aws-lambda-tools-defaults-aot.json",
"src/MyCleanArchAwsLambdaTemplate.Lambda/serverless-aot.template",
"src/MyCleanArchAwsLambdaTemplate.Infrastructure/Serializer/**"
]
},
{
"condition": "(UseNativeAOT)",
"exclude": [
"src/MyCleanArchAwsLambdaTemplate.Lambda/aws-lambda-tools-defaults-standard.json",
"src/MyCleanArchAwsLambdaTemplate.Lambda/serverless-standard.template"
]
}
],
"rename": {
"aws-lambda-tools-defaults-aot.json": "aws-lambda-tools-defaults.json",
"serverless-aot.template": "serverless.template",
"aws-lambda-tools-defaults-standard.json": "aws-lambda-tools-defaults.json",
"serverless-standard.template": "serverless.template"
}
}
]
// Post Actions will be ignored by any IDE, will use 'ItemGroup' condition instead until resolved
// "postActions": [
// {
// "condition": "(UseNativeAOT)",
// "description": "Adding Reference to Microsoft.Extensions.Options NuGet package",
// "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
// "continueOnError": true,
// "manualInstructions": [
// {
// "text": "Manually add the reference to Microsoft.Extensions.Options to your project file"
// }
// ],
// "args": {
// "targetFiles": ["MyCleanArchAwsLambdaTemplate.Lambda.csproj"],
// "referenceType": "package",
// "reference": "Microsoft.Extensions.Options",
// "version": "9.0.10",
// "projectFileExtensions": ".csproj"
// }
// },
// {
// "condition": "(UseNativeAOT)",
// "description": "Adding Reference to Amazon.Lambda.RuntimeSupport NuGet package",
// "actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
// "continueOnError": true,
// "manualInstructions": [
// {
// "text": "Manually add the reference to Amazon.Lambda.RuntimeSupport to your project file"
// }
// ],
// "args": {
// "targetFiles": ["MyCleanArchAwsLambdaTemplate.Lambda.csproj"],
// "referenceType": "package",
// "reference": "Amazon.Lambda.RuntimeSupport",
// "version": "1.13.4",
// "projectFileExtensions": ".csproj"
// }
// }
// ]
}dotnet Info
output
.NET SDK: Version: 9.0.300 Commit: 15606fe0a8 Workload version: 9.0.300-manifests.87b8cca8 MSBuild version: 17.14.5+edd3bbf37Runtime Environment:
OS Name: Mac OS X
OS Version: 26.0
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.300/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.5
Architecture: arm64
Commit: e36e4d1a8f
.NET SDKs installed:
7.0.410 [/usr/local/share/dotnet/sdk]
8.0.410 [/usr/local/share/dotnet/sdk]
9.0.300 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
Visual Studio Version
No response
Additional context
No response