Skip to content

Validate missing solution #117

Description

@TomProkop

Title

pp-entity creation should fail input validation when solution metadata root is missing

Summary

Creating a pp-entity in an empty output folder currently reaches post-actions and fails late in AddEntityToSolutionXml.ps1 because Other/Solution.xml is missing. This should be rejected during input validation before scaffolding starts.

Steps to Reproduce

  1. Create an empty folder: temp/txc-entity-demo
  2. Run:
txc ws comp create pp-entity \
  -o temp/txc-entity-demo \
  --param Behavior=New \
  --param LogicalName=temporaryentity \
  --param LogicalNamePlural=temporaryentities \
  --param DisplayName='Temporary Entity' \
  --param DisplayNamePlural='Temporary Entities' \
  --param PublisherPrefix=tmp

Actual Result

  • Output says template creation started/succeeded.
  • Post-action AddEntityToSolutionXml.ps1 fails because ./Other/Solution.xml does not exist.
  • Operation rolls back after doing work.

Representative error:

Cannot find path '.../temp/txc-entity-demo/Other/Solution.xml' because it does not exist.
Post-action(s) failed, all changes rolled back: Adding entity to solution.xml

Expected Result

The CLI should fail during input validation with a clear message before scaffolding:

  • Required structure is missing (for example Other/Solution.xml).
  • User must create/initialize a proper solution first, then run pp-entity creation.

Proposed Change

Add pre-flight validation for pp-entity creation:

  1. Validate output target contains a valid solution metadata root.
  2. If validation fails, stop immediately with non-zero exit code.
  3. Return a direct, actionable error, for example:
    • "Invalid target folder for pp-entity: missing Other/Solution.xml. Initialize or create a solution structure first."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions