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

Use the manifest directory to compute the relative path #247

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions samples/dapr/AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
{
"components": {
"daprservicea": {
"servicea": {
"type": "project.v1",
"path": "..\\..\\ServiceA\\DaprServiceA.csproj",
"env": {},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
}
}
"path": "..\\ServiceA\\DaprServiceA.csproj",
"env": {}
},
"daprserviceb": {
"serviceb": {
"type": "project.v1",
"path": "..\\..\\ServiceB\\DaprServiceB.csproj",
"env": {},
"bindings": {
"http": {
"scheme": "http",
"protocol": "tcp",
"transport": "http"
}
}
"path": "..\\ServiceB\\DaprServiceB.csproj",
"env": {}
},
"service-a": {
"type": "executable.v1",
Expand Down
10 changes: 5 additions & 5 deletions samples/eShopLite/AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"catalogservice": {
"type": "project.v1",
"path": "..\\..\\CatalogService\\CatalogService.csproj",
"path": "..\\CatalogService\\CatalogService.csproj",
"env": {
"ConnectionStrings__catalog": "{catalog.connectionString}"
}
Expand All @@ -36,7 +36,7 @@
},
"basketservice": {
"type": "project.v1",
"path": "..\\..\\BasketService\\BasketService.csproj",
"path": "..\\BasketService\\BasketService.csproj",
"env": {
"ConnectionStrings__basketCache": "{basketCache.connectionString}",
"ConnectionStrings__messaging": "{messaging.connectionString}"
Expand All @@ -52,7 +52,7 @@
},
"myfrontend": {
"type": "project.v1",
"path": "..\\..\\MyFrontend\\MyFrontend.csproj",
"path": "..\\MyFrontend\\MyFrontend.csproj",
"env": {
"GRAFANA_URL": "{grafana.bindings.grafana-http}"
},
Expand All @@ -67,14 +67,14 @@
},
"orderprocessor": {
"type": "project.v1",
"path": "..\\..\\OrderProcessor\\OrderProcessor.csproj",
"path": "..\\OrderProcessor\\OrderProcessor.csproj",
"env": {
"ConnectionStrings__messaging": "{messaging.connectionString}"
}
},
"apigateway": {
"type": "project.v1",
"path": "..\\..\\ApiGateway\\ApiGateway.csproj",
"path": "..\\ApiGateway\\ApiGateway.csproj",
"env": {}
},
"prometheus": {
Expand Down
3 changes: 2 additions & 1 deletion src/Aspire.Hosting/Publishing/ManifestPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private void WriteProject(ProjectComponent projectComponent, Utf8JsonWriter json
}

var manifestPath = _options.Value.OutputPath ?? throw new DistributedApplicationException("Output path not specified");
var relativePathToProjectFile = Path.GetRelativePath(manifestPath, metadata.ProjectPath);
var manifestDirectory = Path.GetDirectoryName(manifestPath) ?? throw new DistributedApplicationException("Could not get directory name of output path");
var relativePathToProjectFile = Path.GetRelativePath(manifestDirectory, metadata.ProjectPath);
jsonWriter.WriteString("path", relativePathToProjectFile);

WriteEnvironmentVariables(projectComponent, jsonWriter);
Expand Down