aws / aws-toolkit-visual-studio

AWS Toolkit for Visual Studio - a plugin to interact with AWS
https://aws.amazon.com/visualstudio/
Apache License 2.0
108 stars 29 forks source link

Cannot publish DotNet 5 app with blazor webassembly to Lambda #153

Closed genifycom closed 6 months ago

genifycom commented 3 years ago

Describe the bug

When trying to publish a DotNet 5 webassembly app to Lambda for Visual Studio 16.9.4 using the AWS Toolkit 1.21.0.0, I get the following error

... publish: C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets(617,5): error MSB4096: The item "C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\bin\Release\net5.0\AWSBlazor.Client.runtimeconfig.json" in item list "AllPublishItemsFullPathWithTargetPath" does not define a value for metadata "RelativePath". In order to use this metadata, either qualify it by specifying %(AllPublishItemsFullPathWithTargetPath.RelativePath), or ensure that all items in this list define a value for this metadata. [C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\AWSBlazor.Client.csproj]

To Reproduce

Create a DotNet 5 Blazor Webassembly app with host included. Replace the Server with an AWS Lambda Serverless app and try to publish to lambda. Project included for reference. AWSBlazor.zip

Expected behavior

This project does run locally, but I am unable to publish to Lambda using the AWS Toolkit.

Screenshots

Desktop (please complete the following information):

Additional context

genifycom commented 3 years ago

Just tried this again with the AWS Toolkit 1.21.1.0 with the same result.

... publish: C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets(617,5): error MSB4096: The item "C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\bin\Release\net5.0\AWSBlazor.Client.runtimeconfig.json" in item list "AllPublishItemsFullPathWithTargetPath" does not define a value for metadata "RelativePath". In order to use this metadata, either qualify it by specifying %(AllPublishItemsFullPathWithTargetPath.RelativePath), or ensure that all items in this list define a value for this metadata. [C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\AWSBlazor.Client.csproj]

bryceitoc9 commented 3 years ago

Hi @genifycom

Are there any other logs, and are you able to deploy this via a sam deploy command? The logs should show the exact commands we're running, but for the most part, we're running a sam build to a temp directory, a sam package to an S3 bucket, and following up with a sam deploy.

genifycom commented 3 years ago

Hi there. This is using the AWS Toolkit in Visual Studio "Publish to AWS Lambda..."

As such, it is using Docker (DotNet 5) and dotnet publish.

The build log follows:

Processing CloudFormation resource AspNetCoreFunction Initiate packaging of . for resource AspNetCoreFunction Building Docker image for C:\Dev\Projects\AWSBlazor\AWSBlazor\AWSServerApp. Creating image tag from project: awsserverapp Executing publish command Deleted previous publish folder ... invoking 'dotnet publish', working folder 'C:\Dev\Projects\AWSBlazor\AWSBlazor\AWSServerApp../bin/Release/net5.0/linux-x64/publish' ... dotnet publish "C:\Dev\Projects\AWSBlazor\AWSBlazor\AWSServerApp." --output "C:\Dev\Projects\AWSBlazor\AWSBlazor\AWSServerApp../bin/Release/net5.0/linux-x64/publish" --configuration "Release" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false ... publish: Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET ... publish: Copyright (C) Microsoft Corporation. All rights reserved. ... publish: Determining projects to restore... ... publish: All projects are up-to-date for restore. ... publish: AWSBlazor.Shared -> C:\Dev\Projects\AWSBlazor\AWSBlazor\Shared\bin\Release\net5.0\AWSBlazor.Shared.dll ... publish: AWSBlazor.Client -> C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\bin\Release\net5.0\AWSBlazor.Client.dll ... publish: AWSBlazor.Client (Blazor output) -> C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\bin\Release\net5.0\wwwroot ... publish: AWSServerApp -> C:\Dev\Projects\AWSBlazor\AWSBlazor\AWSServerApp\bin\Release\net5.0\linux-x64\AWSServerApp.dll ... publish: C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets(617,5): error MSB4096: The item "C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\bin\Release\net5.0\AWSBlazor.Client.runtimeconfig.json" in item list "AllPublishItemsFullPathWithTargetPath" does not define a value for metadata "RelativePath". In order to use this metadata, either qualify it by specifying %(AllPublishItemsFullPathWithTargetPath.RelativePath), or ensure that all items in this list define a value for this metadata. [C:\Dev\Projects\AWSBlazor\AWSBlazor\Client\AWSBlazor.Client.csproj] Error executing "dotnet publish"

bryceitoc9 commented 3 years ago

Oh, I think you might have the wrong extension (this is the VS Code extension, not the Visual Studio one). I'll go ahead and transfer this to that repo.

genifycom commented 3 years ago

Ah, sorry about that. Thank you