Sp-dev-docs: Command line switches for --skip-feature-deployment and --is-domain-isolated produce invalid results

Created on 30 Nov 2018  ·  11Comments  ·  Source: SharePoint/sp-dev-docs

The documentation states that the “—is-domain-isolated” value should be either “y” or “n” and that the “—skip-feature-deployment” value should be either “true” or “false”. Neither is correct. Both of these are switches, neither have actual values that should be supplied via the command line.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

docs-comment generator spfx-general bug-confirmed

Most helpful comment

As referenced above, generating a SharePoint solution via SPFx project template on VS2019 community edition resulted in a project with faulty config file (package-solution.json) "Expected type boolean but found type string", manually changing both skipFeatureDeployment and isDomainIsolated entries to false instead of "false" fixed it.

All 11 comments

For most cases, y/n and true/false for swithch is OK.

Not in this case. Setting a value of “true” or “false” (or “y”/“n”) in the command line produces a matching text value in the package-solution.json file, which is invalid according to the schema and will throw build errors. The schema expects boolean values, which are produced correctly when the commands are used as switches (which is what the help file indicates but not the online documentation).


From: Seiya Su notifications@github.com
Sent: Sunday, December 2, 2018 20:36
To: SharePoint/sp-dev-docs
Cc: Eric Shupps; Author
Subject: Re: [SharePoint/sp-dev-docs] Incorrect guidance for --is-domain-isolated and --skip-feature-deployment switches (#3042)

For most cases, y/n and true/false for swithch is OK.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/SharePoint/sp-dev-docs/issues/3042#issuecomment-443563630, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALoSZKpp4K_RR8NS74tUtvi0eB4d6fASks5u1IA3gaJpZM4Y7yUy.

Thanks for the heads up @eshupps .

Update to this. The problem is primarily with the --is-domain-isolated option. It does accept "true" or "false" but not "y" or "no" as the online documentation indicates. The schema, however, still shows the option as invalid.

OK, I've pushed updates to the docs. You don't need to specify any options with the flag, just supply the flag itself.

Re-opening for a regression in v1.8.0.0. The command-line switches only produce the desired result if the user wants the boolean value of true to be inserted into the package-solution.json file. Omitting the flags causes the user to be prompted by the generator, which violates the silent execution objective of the command line switches. Any values passed as a parameter to either switch will be inserted into package-solution.json as a string value.

Take the following example:

yo @microsoft/sharepoint
  --solution-name "MySPFxProject1"
  --component-name "Test 1"
  --component-description "Test 1"
  --component-type "webpart"
  --framework "none"
  --skip-install
  --environment "spo"
  --package-manager "npm"
  --skip-feature-deployment
  --is-domain-isolated
  --skip-cache

This produces the correct package-solution.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "my-sp-fx-project-1-client-side-solution",
    "id": "734d14ab-507b-4664-83d1-c15ea7a4323b",
    "version": "1.0.0.0",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": true,
    "isDomainIsolated": true
  },
  "paths": {
    "zippedPackage": "solution/my-sp-fx-project-1.sppkg"
  }
}

However, omitting either switche causes the generator to prompt for input, which it should not do. Instead, it should insert a false value into package-solution.json. If, as the documentation suggests, a string value of "false" is added as a parameter, this is not parsed to produce a boolean result but rather inserted as a string. Take the following example:

yo @microsoft/sharepoint 
  --solution-name "MySPFxProject1" 
  --component-name "Test 1" 
  --component-description "Test 1" 
  --component-type "webpart" 
  --framework "none" 
  --skip-install 
  --environment "spo" 
  --package-manager "npm" 
  --skip-feature-deployment false 
  --is-domain-isolated false 
  --skip-cache

This produces the following invalid result:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "my-sp-fx-project-1-client-side-solution",
    "id": "734d14ab-507b-4664-83d1-c15ea7a4323b",
    "version": "1.0.0.0",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": "false",
    "isDomainIsolated": "false"
  },
  "paths": {
    "zippedPackage": "solution/my-sp-fx-project-1.sppkg"
  }
}

The same is true of any string value, such as "false", "n", n, no, $false, or anything else - the value is simply converted to a string and the project fails to build.

@eshupps tweaked the issue you submitted for readability... I added line breaks to the yo commands just for readability

As referenced above, generating a SharePoint solution via SPFx project template on VS2019 community edition resulted in a project with faulty config file (package-solution.json) "Expected type boolean but found type string", manually changing both skipFeatureDeployment and isDomainIsolated entries to false instead of "false" fixed it.

This is still an issue with SPFx 1.9.1

Still exists in SPFx 1.10.0

April 13, 2020, this is still an issue. Don't understand why it can't be fixed

Was this page helpful?
0 / 5 - 0 ratings