Skip to content

Commit

Permalink
Modifying output options due to Aspire target change
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
timheuer committed Mar 7, 2024
1 parent 6ab6787 commit 48fca44
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 13 additions & 5 deletions src/Commands/ManifestGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec
var options = await General.GetLiveInstanceAsync();

string manifestPath;
string manifestFileName = "manifest.json";

if (options.UseTempFile)
{
// get temp path to a file and rename the file extension to .json extension
manifestPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName().Replace(".", "") + ".json");
manifestPath = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
}
else
{
manifestPath = Path.Combine(projectPath, options.DefaultName);
manifestPath = Path.Combine(projectPath, options.DefaultPath);
}

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

await VS.Documents.OpenAsync(manifestPath);
try
{
await VS.Documents.OpenAsync(Path.Combine(manifestPath,manifestFileName));
}
catch (Exception ex)
{
await pane.WriteLineAsync(OutputWindowManager.GenerateOutputMessage($"Unable to open manifest:{ex.Message}", "ManifestGen", LogLevel.Error));
}

Cleanup:
await VS.StatusBar.EndAnimationAsync(StatusAnimation.Build);
Expand Down
8 changes: 4 additions & 4 deletions src/Options/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public class GeneralOptions : BaseOptionPage<General> { }
public class General : BaseOptionModel<General>
{
[Category("Manifest file")]
[DisplayName("Default file name")]
[Description("The default name of the manifest file to be generated")]
[DefaultValue("aspire-manifest.json")]
public string DefaultName { get; set; } = "aspire-manifest.json";
[DisplayName("Default path name")]
[Description("The default path of the folder where the manifest file will be generated")]
[DefaultValue(".aspire")]
public string DefaultPath { get; set; } = ".aspire";

[Category("Manifest file")]
[DisplayName("Use temporary file")]
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.1",
"version": "0.2",
"publicReleaseRefSpec": [
"^refs/heads/main", // we release out of main
"^refs/tags/v\\d+\\.\\d+" // we also release tags starting with vN.N
Expand Down

0 comments on commit 48fca44

Please sign in to comment.