microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
290 stars 133 forks source link

Fail to create a containerized function app when opening a .NET 7.0/8.0 containerized function project in VS Code #4003

Open v-xinda opened 8 months ago

v-xinda commented 8 months ago

OS: All Build Version: 20240229.2 Regression: Not a Regression

Repro Steps:

  1. Open a .NET 7.0 containerized function project in VS Code.
  2. Right click on the Function App tree item and click on the command "Create Function App in Azure…" -> Click "Container Image" -> Enter a name -> Select a location.
  3. Check whether succeeds to create a containerized function app.

Expect: Succeed to create a containerized function app.

Actual: Fail to create a containerized function app. image Log details as below:

2024/03/01 09:22:12 Downloading source code...
2024/03/01 09:22:12 Finished downloading source code
2024/03/01 09:22:13 Using acb_vol_6bc92908-68b0-4267-b195-ab1e1ef48715 as the home volume
2024/03/01 09:22:13 Setting up Docker configuration...
2024/03/01 09:22:13 Successfully set up Docker configuration
2024/03/01 09:22:13 Logging in to registry: cscon111e3c.azurecr.io
2024/03/01 09:22:14 Successfully logged into cscon111e3c.azurecr.io
2024/03/01 09:22:14 Executing step ID: build. Timeout(sec): 28800, Working directory: '', Network: ''
2024/03/01 09:22:14 Scanning for dependencies...
2024/03/01 09:22:14 Successfully scanned dependencies
2024/03/01 09:22:14 Launching container with name: build
Sending build context to Docker daemon  302.1kB

Step 1/6 : FROM mcr.microsoft.com/dotnet/sdk:6.0 AS installer-env
6.0: Pulling from dotnet/sdk
5d0aeceef7ee: Pulling fs layer
7c2bfda75264: Pulling fs layer
950196e58fe3: Pulling fs layer
ecf3c05ee2f6: Pulling fs layer
819f3b5e3ba4: Pulling fs layer
19984358397d: Pulling fs layer
d99f9f96f040: Pulling fs layer
d6d23fc1b8fc: Pulling fs layer
ecf3c05ee2f6: Waiting
819f3b5e3ba4: Waiting
19984358397d: Waiting
d99f9f96f040: Waiting
d6d23fc1b8fc: Waiting
7c2bfda75264: Verifying Checksum
7c2bfda75264: Download complete
950196e58fe3: Verifying Checksum
950196e58fe3: Download complete
5d0aeceef7ee: Verifying Checksum
5d0aeceef7ee: Download complete
ecf3c05ee2f6: Verifying Checksum
ecf3c05ee2f6: Download complete
819f3b5e3ba4: Verifying Checksum
819f3b5e3ba4: Download complete
19984358397d: Verifying Checksum
19984358397d: Download complete
d6d23fc1b8fc: Verifying Checksum
d6d23fc1b8fc: Download complete
d99f9f96f040: Verifying Checksum
d99f9f96f040: Download complete
5d0aeceef7ee: Pull complete
7c2bfda75264: Pull complete
950196e58fe3: Pull complete
ecf3c05ee2f6: Pull complete
819f3b5e3ba4: Pull complete
19984358397d: Pull complete
d99f9f96f040: Pull complete
d6d23fc1b8fc: Pull complete
Digest: sha256:fdac9ba57a38ffaa6494b93de33983644c44d9e491e4e312f35ddf926c55a073
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:6.0
 ---> 694fe26693f8
Step 2/6 : COPY . /src/dotnet-function-app
 ---> 1c6bc9a02810
Step 3/6 : RUN cd /src/dotnet-function-app && mkdir -p /home/site/wwwroot && dotnet publish *.csproj --output /home/site/wwwroot
 ---> Running in 3060476bcaed
MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
/usr/share/dotnet/sdk/6.0.419/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0.  Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0. [/src/dotnet-function-app/cs-con.csproj]
The command '/bin/sh -c cd /src/dotnet-function-app && mkdir -p /home/site/wwwroot && dotnet publish *.csproj --output /home/site/wwwroot' returned a non-zero code: 1
2024/03/01 09:22:26 Container failed during run: build. No retries remaining.
failed to run step ID: build: exit status 1

Run ID: ca1 failed after 15s. Error: failed during run, err: exit status 1

More Info:

  1. This issue also reproduces when a .NET 8.0 containerized function project opened in VS Code.
  2. This issue doesn't reproduce when a .NET 6.0/6.0 isolate containerized function project opened in VS Code.
v-xinda commented 8 months ago

Verified this issue on the latest build 20240306.1, this issue also reproduces for the TypeScript V3 Model project. image And there is an extra step "Enter the name for the new container app resource...". image

motm32 commented 8 months ago

The Typescript issue is a known upstream issue. I have opened an issue on the azure-functions-core-tools repo: https://github.com/Azure/azure-functions-core-tools/issues/3614