Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypassing the question: Do you want to run this action [Y(yes)|N(no)]? #8399

Closed
granitbunjaku opened this issue Sep 25, 2024 · 8 comments
Closed

Comments

@granitbunjaku
Copy link

I need to execute a script after a project is created with that template. So, I added that script as postAction and it works fine but I'm facing a problem that when I create the project using dotnet new it asks me for confirmation if I want to run the action:

photo

Can I somehow bypass this and always run the actions? cause when I create the project using rider or vs, I can't specify this answer (yes or no) as this happens during the creation.

@sayedihashimi
Copy link
Member

FYI custom postActions don’t run in Visual Studio, that is by design for the time being.

@granitbunjaku
Copy link
Author

FYI custom postActions don’t run in Visual Studio, that is by design for the time being.

So, there is no way to execute postActions when creating project with my custom template using Visual Studio?

@sayedihashimi
Copy link
Member

No, what are you trying to accomplish with the postAction? Maybe there is an alternative.

@granitbunjaku
Copy link
Author

No, what are you trying to accomplish with the postAction? Maybe there is an alternative.

I have these json files on my template project. The json files contain sourceName that gets replaced after creating the project, after creation I need these files to be moved somewhere else, I was doing this via postAction shell script

@sayedihashimi
Copy link
Member

You can probably do that by modifying some content in template.json. @baronfel do we have any docs on how to modify the folder where certain files will be generated?

@granitbunjaku
Copy link
Author

You can probably do that by modifying some content in template.json. @baronfel do we have any docs on how to modify the folder where certain files will be generated?

Thank you for the idea. I achieved this by adding on template.json the following (needed to do the exclude thing to exclude the folder when project is created):

"sources": [
{
"source": "./TheDirectoryThatContainsJsonFiles",
"target": "C:\Users\GranitBunjaku\Desktop\TheDirectoryIWantThemOn"
},
{
"modifiers": [
{
"exclude": [ "TheDirectoryThatContainsJsonFiles/*" ]
}
}
]

@sayedihashimi
Copy link
Member

Happy to hear that you got it working. Be careful using full paths though. If you are all set, please close this issue.

@granitbunjaku
Copy link
Author

Happy to hear that you got it working. Be careful using full paths though. If you are all set, please close this issue.

Thanks again for your help and for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants