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

Add to solution action ("D396686C-DE0E-4DE6-906D-291CD29FC5DE") fails #2453

Closed
gurustron opened this issue Aug 19, 2020 · 4 comments · Fixed by #2690
Closed

Add to solution action ("D396686C-DE0E-4DE6-906D-291CD29FC5DE") fails #2453

gurustron opened this issue Aug 19, 2020 · 4 comments · Fixed by #2690
Assignees
Labels
size:2.0 triaged The issue was evaluated by the triage team, placed on correct area, next action defined.

Comments

@gurustron
Copy link

I've stumbled across two scenarios when add to solution action fails. Repository with reproducers.

  1. The most critical for me - when project files(csproj) are placed to nested folder (not in the same as .template.config) replace for primaryOutputs.path for csproj is not performed:
{
  "$schema": "http://json.schemastore.org/template",
  "author": "gurustron",
  "classifications": [
    "MyTestFailsNestedDir"
  ],
  "name": "MyTestFailsNestedDir",
  "identity": "AddFailsNestedDir",
  "shortName": "test-add-sln-nested-fails",
  "tags": {
    "language": "C#"
  },
  "sourceName": "AddFailsNestedDir",
  "preferNameDirectory": true,
  "sources": [
    {
      "source": "./",
      "target": "../"
    }
  ],
  "primaryOutputs": [
    {
      "path": "AddFailsNestedDir.csproj"
    }
  ],
  "postActions": [
    {
      "actionId": "D396686C-DE0E-4DE6-906D-291CD29FC5DE",
      "manualInstructions": [],
      "args": {
        "primaryOutputIndexes": "0"
      }
    }
  ]
}

folder strucutre:

TemplateRepro.sln\ 
	AddFailsNestedDir\
		.template.config\
			template.json
		AddFailsNestedDir\
			...
			AddFailsNestedDir.csproj
  1. If postaction.args.primaryOutputIndexes is omitted in template.json the replace is not performed and folder is not added to the attempted addition despite next written in the schema "if not specified, all primary outputs are used":
{
  "$schema": "http://json.schemastore.org/template",
  "author": "gurustron",
  "classifications": [
    "MyTestFailsOutIndex"
  ],
  "name": "MyTestFailsOutIndex",
  "identity": "MyTestFailsOutIndex",
  "shortName": "test-add-sln-outind-fails",
  "tags": {
    "language": "C#"
  },
  "sourceName": "AddFailsOptIndex",
  "preferNameDirectory": true,
  "primaryOutputs": [
    {
      "path": "AddFailsOptIndex.csproj"
    }
  ],
  "postActions": [
    {
      "actionId": "D396686C-DE0E-4DE6-906D-291CD29FC5DE",
      "manualInstructions": []
    }
  ]
}

When project files are on the same level and postaction.args.primaryOutputIndexes is specified - everything works:

{
  "$schema": "http://json.schemastore.org/template",
  "author": "gurustron",
  "classifications": [
    "MyTestWorks"
  ],
  "name": "MyTestWorks",
  "identity": "AddToSlnWorks",
  "shortName": "test-add-sln-works",
  "tags": {
    "language": "C#"
  },
  "sourceName": "AddToSlnWorks",
  "preferNameDirectory": true,
  "primaryOutputs": [
    {
      "path": "AddToSlnWorks.csproj"
    }
  ],
  "postActions": [
    {
      "actionId": "D396686C-DE0E-4DE6-906D-291CD29FC5DE",
      "manualInstructions": [],
      "args": {
        "primaryOutputIndexes": "0"
      }
    }
  ]
}

I have 5.0 and 3.1.401 sdks installed (using former one via global.json)

@AR-May AR-May added need-investigation The issue needs the second look and more investigation triaged The issue was evaluated by the triage team, placed on correct area, next action defined. labels Aug 24, 2020
@AR-May AR-May self-assigned this Sep 10, 2020
@AR-May
Copy link
Member

AR-May commented Sep 10, 2020

Hello @gurustron!

As for your first question: it seems that add to solution action works badly when a target directory is specified: "target": "../". I can reproduce the issue, thank you for providing the repository with test templates.

As a possible workaround, if you may use the default target directory and use paths that are relative to the directory containing the .template.config folder ("path": "AddFailsNestedDir/AddFailsOptIndex.csproj") for primaryOutput paths, that should fix the problem.

Well, concerning your second question: as far as I do know, the replacement and the post-action works there. You have a typo in your template.json: AddFailsOptIndex instead of AddFailsOutIndex. However, there was a problem with paths when primaryOutputIndexes were not specified and user used -o or -n option. The fix is not yet included in any release, so for now it is better to use primaryOutputIndexes.

@AR-May AR-May added size:2.0 and removed need-investigation The issue needs the second look and more investigation labels Sep 10, 2020
@gurustron
Copy link
Author

@AR-May Thank you for the info!

@AR-May AR-May removed their assignment Sep 11, 2020
@AR-May AR-May self-assigned this Sep 28, 2020
@AR-May AR-May added the need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases label Sep 28, 2020
@AR-May AR-May added need-discussion Requires internal discussion prior to answering in an issue. and removed need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases labels Oct 5, 2020
@AR-May AR-May removed their assignment Oct 16, 2020
@AR-May AR-May added the need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases label Oct 16, 2020
@vlada-shubina vlada-shubina self-assigned this Oct 28, 2020
@vlada-shubina vlada-shubina removed the need-discussion Requires internal discussion prior to answering in an issue. label Oct 28, 2020
@vlada-shubina vlada-shubina removed the need-pm-discussion Need agreement from PM that the issue aligns to targeted stories for any of the next 2 releases label Nov 4, 2020
@vlada-shubina
Copy link
Member

Agreed on the following, in case of

following template structure

-	.template.config
-	AddFailsNestedDir
-	AddFailsNestedDir\AddFailsNestedDir.csproj
-	AddFailsNestedDir\Program.cs

the following template configuration:

  "sourceName": "AddFailsNestedDir",
  "preferNameDirectory": true,
  "sources": [
    {
      "source": "./",
      "target": "../"
    }
  ]

expected outcome

-	<output name>.csproj
-	Program.cs

primaryOutputs path should contain AddFailsNestedDir.csproj as the final location after template instantiation.

The fix should be implemented considering above, the primary outputs returned by API should contain <output name>.csproj.
The documentation on primaryOutputs to be updated to explain this case.

@vlada-shubina
Copy link
Member

The issue with incorrect primary outputs in case non-default target or source rename is used is fixed in #2690.

vlada-shubina added a commit that referenced this issue Jan 21, 2021
fixes #2453 fixes #2682 fixes incorrect primary outputs in case non-default target or source rename is used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:2.0 triaged The issue was evaluated by the triage team, placed on correct area, next action defined.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants