Skip to content

Commit ef1a6d1

Browse files
committed
Changing to match CLI commands and more optional output location.
1 parent a01ec55 commit ef1a6d1

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/Commands/ManifestGen.cs

+13-5
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,23 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec
3939
}
4040
else
4141
{
42-
manifestPath = Path.Combine(solutionPath, options.DefaultPath);
42+
manifestPath = options.RelativeTo == RelativeTo.Solution
43+
? Path.Combine(solutionPath, options.DefaultPath)
44+
: Path.Combine(projectPath, options.DefaultPath);
4345
}
4446

47+
// ensure that the manifestPath directory exists
48+
Directory.CreateDirectory(manifestPath);
49+
50+
// reset the path to include the manifest file name now that the directory exists
51+
manifestPath = Path.Combine(manifestPath, manifestFileName);
52+
4553
await VS.StatusBar.StartAnimationAsync(StatusAnimation.Build);
4654
await VS.StatusBar.ShowProgressAsync(STATUS_MESSAGE, 1, 2);
4755
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage(STATUS_MESSAGE, "ManifestGen", LogLevel.Information));
48-
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Generating using: msbuild /t:GenerateAspireManifest /p:AspireManifestPublishOutputPath={manifestPath}", "ManifestGen", LogLevel.Information));
56+
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Generating using: dotnet run --publisher manifest --output-path {manifestPath}", "ManifestGen", LogLevel.Information));
4957
var result = await Cli.Wrap("dotnet")
50-
.WithArguments($"msbuild /t:GenerateAspireManifest /p:AspireManifestPublishOutputPath={manifestPath}")
58+
.WithArguments($"dotnet run --publisher manifest --output-path {manifestPath}")
5159
.WithWorkingDirectory(projectPath)
5260
.WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer))
5361
.WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer))
@@ -64,12 +72,12 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec
6472
}
6573
else
6674
{
67-
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Manifest created at {manifestPath}\\{manifestFileName}", "ManifestGen", LogLevel.Information));
75+
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Manifest created at {manifestPath}", "ManifestGen", LogLevel.Information));
6876
}
6977

7078
try
7179
{
72-
await VS.Documents.OpenAsync(Path.Combine(manifestPath,manifestFileName));
80+
await VS.Documents.OpenAsync(Path.Combine(manifestPath));
7381
}
7482
catch (Exception ex)
7583
{

src/Options/General.cs

+16-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ public class General : BaseOptionModel<General>
1313
{
1414
[Category("Manifest file")]
1515
[DisplayName("Default path name")]
16-
[Description("The default path of the folder where the manifest file will be generated. This will be at the solution root.")]
16+
[Description("The default path of the folder where the manifest file will be generated.")]
1717
[DefaultValue(".aspire")]
1818
public string DefaultPath { get; set; } = ".aspire";
1919

20+
[Category("Manifest file")]
21+
[DisplayName("Relative to Solution or Project")]
22+
[Description("Choose whether relative to the Solution or Project")]
23+
[DefaultValue(RelativeTo.Project)]
24+
public RelativeTo RelativeTo { get; set; } = RelativeTo.Project;
25+
2026
[Category("Manifest file")]
2127
[DisplayName("Use temporary file")]
22-
[Description("Use a temporary file on disk instead of project location")]
28+
[Description("Use a temporary file on disk instead of project location. Note if this is true, Default path name and Relative path are ignored.")]
2329
[DefaultValue(true)]
2430
public bool UseTempFile { get; set; } = true;
2531

@@ -28,4 +34,12 @@ public class General : BaseOptionModel<General>
2834
[Description("Enables azd debug output (--debug) to the infra synth")]
2935
[DefaultValue(false)]
3036
public bool AzdDebug { get; set; } = false;
37+
}
38+
39+
public enum RelativeTo
40+
{
41+
[Description("Project")]
42+
Project,
43+
[Description("Solution")]
44+
Solution
3145
}

0 commit comments

Comments
 (0)