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

Cannot realize the function of hiding parameters #4102

Closed
zhenlei520 opened this issue Nov 10, 2021 · 7 comments
Closed

Cannot realize the function of hiding parameters #4102

zhenlei520 opened this issue Nov 10, 2021 · 7 comments
Labels
need-customer-info Requires feedback from author

Comments

@zhenlei520
Copy link

zhenlei520 commented Nov 10, 2021

Describe the bug:

I hope that the MinimalAPI option appears when the Framework is 6.0, and the MinimalAPI option is hidden when the Framework is 5.0.

It’s just that the parameters are defined by me. For example, there are two parameters A and B, but there is a dependency between parameters A and B. B can be selected only when A is enabled. If A is disabled, B cannot be selected. , This scene cannot be realized on Viaual Studio

Further technical details

.NET SDK (reflecting any global.json):
Version: 6.0.100

@MayueCif
Copy link

There is another problem,I try to control a parameter disabled, similar to Docker selece windows/linux.it`s not work

@bekir-ozturk bekir-ozturk added the need-investigation The issue needs the second look and more investigation label Nov 15, 2021
@vlada-shubina
Copy link
Member

@zhenlei520

There is no generic feature allowing to hide specific parameters based on conditions in Visual Studio.
However there is a special processing for framework parameter which you can benefit from.

In order to do so:

  1. Your templates should use Framework parameter for framework selection of type choice, with choices defined as in Microsoft templates (net5.0, netstandard2.0, netappcore3.1), depending on the frameworks to be supported by the template. The name and choices are important.

  2. You should create a separate template per each flavour (i.e. set of parameters to be shown). Those templates should have different identity, but share same groupIdentity, shortName and name. I would also recommend to define different precedence value in those templates, so if the user doesn't specify framework (this may be the case for CLI), the template with higher precedence is preferred. All of those templates should have corresponding framework defined via Framework parameter, with supported choices for this kind of template. There might be multiple frameworks defined in single template, however the frameworks defined should not overlap with other templates. You may pack these templates in same or individual NuGet packages, depending on your needs.

Those templates (having same groupIdentity) will be shown as one in both CLI and Visual Studio.

When template is run by Visual Studio, first it offers framework selection, and then depending on framework choice the parameters from corresponding individual template will loaded. This allows you to "hide" the parameters not applicable for given template.

When template is run in CLI, similarly the user is specifying framework using the option, so correct template will be derived and run.

Let me know if you have any additional questions.

@vlada-shubina vlada-shubina added need-customer-info Requires feedback from author and removed need-investigation The issue needs the second look and more investigation labels Nov 29, 2021
@vlada-shubina
Copy link
Member

@MayueCif not sure if I understand your question, it would be good if you can provide more information and preferably in a separate issue if the problem is different from the one described initially.

Thank you

@vlada-shubina vlada-shubina removed their assignment Nov 30, 2021
@zhenlei520
Copy link
Author

@MayueCif不确定我是否理解您的问题,如果您能提供更多信息并且最好在单独的问题中提供,如果问题与最初描述的问题不同,那将会很好。

谢谢

I hope to achieve a scenario similar to that when docker is not enabled, docker os cannot be selected, and when docker is enabled, docker os can be selected

@vlada-shubina
Copy link
Member

@zhenlei520 thank you for clarification. Unfortunately, this is not possible - we don't have a way to specify that parameter A depends on parameter B.
Docker parameters are not generic parameters, they have custom logic, and enabled separately.

@vlada-shubina
Copy link
Member

Similar request: #2173

@zhenlei520
Copy link
Author

类似请求:#2173

Okay, that’s really a pity, it would be great if this function can be realized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-customer-info Requires feedback from author
Projects
None yet
Development

No branches or pull requests

4 participants