Azure / Azure/azure-functions-openapi-extension
Could not find file 'C:\home\site\wwwroot\ref'.
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
I'm using package Microsoft.Azure.WebJobs.Extensions.OpenApi 1.4.0, and using ZipDeploy to deploy to Azure. But it returns the error mentioned in title when I send get request https://xxx.azurewebsites.net/api/swagger/ui.
After digging into a little bit, I find it's probably due to C:\home\site\wwwroot\ref is actually an empty folder, but C:\home\site\wwwroot\bin\ref has lots of dlls. So I tried to copy all dlls under bin\ref to ref, then ZipDeploy to Azure, problem solved.
I noticed function RenderSwaggerUI calls SetApplicationAssemblyAsync which has a default parameter `appendBin = true`. In Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Functions, it passes in false explictly, but in Microsoft.Azure.WebJobs.Extensions.OpenApi it uses default parameter true. I'm pretty sure I'm using the latter package, so don't understand why it didn't looks for bin\ref.
So my question is -
1) Why it wants to look up in C:\home\site\wwwroot\ref?
2) Shall I copy bin\ref to ref before deploying to Azure? is there any parameter to let dotnet publish dlls to both ref and bin\ref?
```
[OpenApiIgnore]
public static async Task RenderSwaggerUI(
[OpenApiHttpTriggerContext] OpenApiHttpTriggerContext openApiContext,
HttpRequest req, ExecutionContext ctx, ILogger log)
{
log.LogInformation("SwaggerUI page was requested.");
var request = new HttpRequestObject(req);
var result = default(string);
var content = default(ContentResult);
try
{
var auth = await openApiContext.SetApplicationAssemblyAsync(ctx.FunctionAppDirectory)
.AuthorizeAsync(request)
.ConfigureAwait(false);
public virtual async Task SetApplicationAssemblyAsync(string functionAppDirectory, bool appendBin = true)
{
if (!this._dllpath.IsNullOrWhiteSpace())
{
return this;
}
var runtimepath = this.GetRuntimePath(functionAppDirectory, appendBin);
var runtimename = await this.GetRuntimeFilenameAsync(functionAppDirectory);
var dllpath = $"{runtimepath}{Path.DirectorySeparatorChar}{runtimename}";
this._dllpath = dllpath;
return this;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.