Quantcast
Channel: WE MOVED to github.com/nuget. This site is not monitored!
Viewing all articles
Browse latest Browse all 7612

Commented Issue: Custom Variables and Install Dialog [1438]

$
0
0
I would like to be able to specify custom variables to use in code and config transforms. When a package with these custom variables gets installed a dialog would prompt the user to set the values of the custom variables.

In the simplest form these variables would all be strings and you would add them to your nuspec file like this:

<metadata>
....
<variables>
<add name="waStorageAccount" title="Windows Azure Storage Account" />
<add name="waStorageKey" title="Windows Azure Storage Key" />
</variables>
</metadata>

You could then use these variables inside code or config transforms. For example, a web.config would look like this:

<configuration>
<appSettings>
<add key="StorageAccount" value="$waStorageAccount$" />
<add key="StorageKey" value="$waStorageKey$" />
<appSettings>
</configuration>

After the package is installed, the user would be prompted with a dialog that asks them to input the values of the custom variables. At which point the values would be transformed into the config or code files. This would work in a similar way in PS, but without the GUI.

Additional options could be to specify the type of the variable such as a simple type like string, int32, DateTime or a more complicated type such as a list of options. You could also add simple validation such as length, required/not required, range, etc.


Comments: An alternative would be to specify properties on the command line and in the console eg: install-package mypackage -Properties hello=world;foo=bar and: nuget install mypackage -Properties hello=world;foo=bar This would be consistent to how the package command works. This has the advantage to powershell as it would not consider this a changed file if the changes are within a token.

Viewing all articles
Browse latest Browse all 7612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>