Skip to content

func pack errors in custom handler project because 'functions.metadata' not found #4677

@lilyjma

Description

@lilyjma

Version

4.3.0

Description

Running func pack in a custom handler errors because 'functions.metadata' not found in deployment structure. The custom handler is an mcp server, and has FWR set to dotnet-isolated. Running dotnet publish as suggested doesn't help -

local.settings.json found in root directory (/Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet).
Resolving worker runtime to 'dotnet-isolated'.
local.settings.json found in root directory (/Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet).
Resolving worker runtime to 'dotnet-isolated'.
 
Validating project...
 
  Validate host.json: PASSED
 
Building .NET project...
  Determining projects to restore...
  All projects are up-to-date for restore.
  QuickstartWeatherServer -> /Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet/bin/Release/net8.0/QuickstartWeatherServer.dll
  QuickstartWeatherServer -> /Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet/output/
 
 
Validating published output...
  Validate Published Structure: FAILED
    Required file 'functions.metadata' not found in deployment structure. Ensure 'dotnet publish' has been run.
Published output validation failed: Required file 'functions.metadata' not found in deployment structure. Ensure 'dotnet publish' has been run.

Running command inside output directory

I tried running func pack inside the output directory instead of the root. Ran into a different error -

lily@MacBookPro output % func pack 
local.settings.json found in root directory (/Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet/output).
Resolving worker runtime to 'dotnet-isolated'.
local.settings.json found in root directory (/Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet/output).
Resolving worker runtime to 'dotnet-isolated'.

Validating project...

  Validate host.json: PASSED

Building .NET project...
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.


Error publishing .NET project

Here's what's inside that directory

/Users/lily/Desktop/Functions/mcp/functions-hosting/test/mcp-sdk-functions-hosting-dotnet/output
lily@MacBookPro output % ls -la
total 3304
drwxr-xr-x  22 lily  staff     704 Oct 23 19:22 .
drwxr-xr-x@ 24 lily  staff     768 Oct 27 10:50 ..
-rw-r--r--   1 lily  staff     361 Oct 23 19:09 host.json
drwxr-xr-x   5 lily  staff     160 Oct 23 19:22 infra
-rw-r--r--   1 lily  staff     175 Oct 14 12:42 local.settings.json
-rwxr--r--   1 lily  staff  332856 Jun 10 13:55 Microsoft.Extensions.AI.Abstractions.dll
-rwxr--r--   1 lily  staff   63768 Sep 16  2024 Microsoft.Extensions.DependencyInjection.Abstractions.dll
-rwxr--r--   1 lily  staff   30480 Sep 16  2024 Microsoft.Extensions.Diagnostics.Abstractions.dll
-rwxr--r--   1 lily  staff   51472 Sep 16  2024 Microsoft.Extensions.Hosting.Abstractions.dll
-rwxr--r--   1 lily  staff   65288 Jan 16  2025 Microsoft.Extensions.Logging.Abstractions.dll
-rwxr--r--   1 lily  staff   64776 Jan 17  2024 Microsoft.Extensions.Options.dll
-rwxr--r--   1 lily  staff   60416 Jun 20 12:25 ModelContextProtocol.AspNetCore.dll
-rwxr--r--   1 lily  staff  729600 Jun 20 12:25 ModelContextProtocol.Core.dll
-rwxr--r--   1 lily  staff   32256 Jun 20 12:25 ModelContextProtocol.dll
-rwxr-xr-x   1 lily  staff  124448 Oct 23 19:18 QuickstartWeatherServer
-rw-r--r--   1 lily  staff   10072 Oct 23 19:18 QuickstartWeatherServer.deps.json
-rw-r--r--   1 lily  staff   16384 Oct 23 19:18 QuickstartWeatherServer.dll
-rw-r--r--   1 lily  staff   23452 Oct 23 19:18 QuickstartWeatherServer.pdb
-rw-r--r--   1 lily  staff     469 Oct 23 19:18 QuickstartWeatherServer.runtimeconfig.json
-rw-r--r--   1 lily  staff      53 Oct 15 17:30 QuickstartWeatherServer.staticwebassets.endpoints.json
-rwxr--r--   1 lily  staff   41752 May  8 19:55 System.Net.ServerSentEvents.dll
-rw-r--r--   1 lily  staff     499 Oct 23 19:22 web.config

FYI @im-samz

Steps to reproduce

  1. Clone this repo: https://github.com/Azure-Samples/mcp-sdk-functions-hosting-dotnet
  2. Run func pack in the root

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions