dotnet / dotnet/aspnetcore

RazorRuntimeCompilation fails when a non-managed dll is part of the project.

Open
#18,699 6 comments 1 reaction 0 assignees View on GitHub
affected-very-few area-mvc bug feature-runtime-compilation investigate severity-blocking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Describe the bug
Whenever a non-managed dll is included in the bin folder during debug RazorRuntimeCompilation fails with the following error: `Metadata file '...gsdll64.dll' could not be opened -- PE image doesn't contain managed metadata.`

### To Reproduce
New project with nuget packages
```
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Ghostscript
```
Create a simple controller with a razor page. Load the page in debug mode, modify the razor page, and refresh.

Startup:
```
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews().AddRazorRuntimeCompilation();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
```

### Further technical details
- ASP.NET Core version: 3.1.101
```
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\

Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
```
- The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version: Visual Studio 2019: 16.4.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.