Skip to content

Commit 48fca44

Browse files
committed
Modifying output options due to Aspire target change
- Remove DefaultName as now file is always manifest.json - Added DefaultPath which is where it will be created - Changed temporary file to use temppath + manifest.json naming This is due to changes in Aspire Preview 4+ for the apphost and requires those versions to work in this new manner.
1 parent 6ab6787 commit 48fca44

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

src/Commands/ManifestGen.cs

+13-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec
3030
var options = await General.GetLiveInstanceAsync();
3131

3232
string manifestPath;
33+
string manifestFileName = "manifest.json";
34+
3335
if (options.UseTempFile)
3436
{
35-
// get temp path to a file and rename the file extension to .json extension
36-
manifestPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName().Replace(".", "") + ".json");
37+
manifestPath = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
3738
}
3839
else
3940
{
40-
manifestPath = Path.Combine(projectPath, options.DefaultName);
41+
manifestPath = Path.Combine(projectPath, options.DefaultPath);
4142
}
4243

4344
await VS.StatusBar.StartAnimationAsync(StatusAnimation.Build);
@@ -62,10 +63,17 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec
6263
}
6364
else
6465
{
65-
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Manifest created at {manifestPath}", "ManifestGen", LogLevel.Information));
66+
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Manifest created at {manifestPath}\\{manifestFileName}", "ManifestGen", LogLevel.Information));
6667
}
6768

68-
await VS.Documents.OpenAsync(manifestPath);
69+
try
70+
{
71+
await VS.Documents.OpenAsync(Path.Combine(manifestPath,manifestFileName));
72+
}
73+
catch (Exception ex)
74+
{
75+
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Unable to open manifest:{ex.Message}", "ManifestGen", LogLevel.Error));
76+
}
6977

7078
Cleanup:
7179
await VS.StatusBar.EndAnimationAsync(StatusAnimation.Build);

src/Options/General.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class GeneralOptions : BaseOptionPage<General> { }
1212
public class General : BaseOptionModel<General>
1313
{
1414
[Category("Manifest file")]
15-
[DisplayName("Default file name")]
16-
[Description("The default name of the manifest file to be generated")]
17-
[DefaultValue("aspire-manifest.json")]
18-
public string DefaultName { get; set; } = "aspire-manifest.json";
15+
[DisplayName("Default path name")]
16+
[Description("The default path of the folder where the manifest file will be generated")]
17+
[DefaultValue(".aspire")]
18+
public string DefaultPath { get; set; } = ".aspire";
1919

2020
[Category("Manifest file")]
2121
[DisplayName("Use temporary file")]

version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "0.1",
3+
"version": "0.2",
44
"publicReleaseRefSpec": [
55
"^refs/heads/main", // we release out of main
66
"^refs/tags/v\\d+\\.\\d+" // we also release tags starting with vN.N

0 commit comments

Comments
 (0)