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

Aspire 9.1 tries to start Lambda project and then debug option not available in Aspire dashboar #43

Open
sjbthfc2 opened this issue Mar 6, 2025 · 5 comments

Comments

@sjbthfc2
Copy link

sjbthfc2 commented Mar 6, 2025

Hi,

Just trying to have a play with the AWS Lambda hosting for Aspire 9.2(https://aws.amazon.com/blogs/developer/building-lambda-with-aspire-part-1/) and I have added a Lambda Function (SQS trigger) and referenced it form the Apphost project. I have also added the pragma to allow preview methods but when I run the AppHost it fails because Aspire is trying to start the Lambda project which is a class library:

"Status": "500 Internal Server Error", "Body": "A project with an Output Type of Class Library cannot be started directly.\r\n\r\nIn order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project."

Is there some other configuration that has to be made, my addition of the Lambda project looks like:
builder.AddAWSLambdaFunction<Projects.MonitorAndControl_EventHandler>("EventHandler", lambdaHandler: "Me.MelCloudHome.MonitorAndControlService.EventHandler.FunctionHandler");

I note a similar issue raised for Rider in the blog post but I am using Visual Studio 17.12.5.

Many Thanks and the Aspire support looks fantastic!

@normj
Copy link
Member

normj commented Mar 7, 2025

There was an issue with the Visual Studio integration with Aspire that was triggering this issue that was fixed in a newer version. I'm currently running version 17.13.2. Can you update your version of VS to the latest and see if the error reproduces?

Here is the issue we worked with the .NET team to address this issue: dotnet/aspire#6120 (comment). I should have called out in the blog post to update the Visual Studio version to the latest.

@sjbthfc2
Copy link
Author

sjbthfc2 commented Mar 7, 2025

Hi,

I have upgraded Visual Studio to 17.13.2 but I still get the same issue. Is it possible this is because I upgraded the Aspire App to 9.1 rather than created a new project, or is this solely a Visual Studio issue?

@normj
Copy link
Member

normj commented Mar 12, 2025

Upgrading an existing project shouldn't matter. In the AppHost project is the Sdk element set to 9.1? For a class library Lambda function our integration writes a profile to the launchsettings.json file of the Lambda project. Can you that profile got written to the launchsettings.json file?

@sjbthfc2
Copy link
Author

I have the following Sdk setting:
<Sdk Name="Aspire.AppHost.Sdk" Version="9.1.0" />

And the Lambda launchSettings.json has:
{ "profiles": { "Mock Lambda Test Tool": { "commandName": "Executable", "commandLineArgs": "--port 5050", "workingDirectory": ".\\bin\\$(Configuration)\\net8.0", "executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-8.0.exe" } } }

@philasmar
Copy link
Contributor

Are you able to share the project with us so we can do some debugging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants