unexpected/unnecessary `refs` directory in published output of ASP.NET Core application
See original GitHub issueSteps to reproduce
- create new ASP.NET Core (.NET Framework) application template in Visual Studio
- publish a release build
Expected behavior
- The only DLLs included local to the
.exe
would be third-party libraries loaded as nugget packages
Actual behavior
- There is a
refs
directory that contains manySystem.*
DLLs, a copy of the application, and the DLL for Razor Tooling - The
refs
directory can be removed and the application still runs and Razor pages still render
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
unexpected/unnecessary refs directory in published output ...
Steps to reproduce create new ASP.NET Core (.NET Framework) application template in Visual Studio publish a release build Expected behavior ...
Read more >What is 'refs' folder in ASP.NET Core app's publish ...
If your Asp.Net Core application uses MVC, you would likely be using ... unexpected/unnecessary `refs` directory in published output of ASP.
Read more >Refs folder not created during dotnet build
When I run dotnet publish , everything works fine. In particular, a refs folder is created in the published directory with the referenced...
Read more >When publishing a web application using ...
AspNetCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program ... This result in the "refs" folder being published along with the app files.
Read more >Administrator, Agricultural Marketing Service.
List of Subjects in 7 CFR Part 63 Administrative practice and procedure, ... EPA approved the applications and published a Federal Register ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you don’t want this directory published, you can remove:
"preserveCompilationContext": true
from your project.json. But note that removing that setting may completely break your Razor compilation at runtime.
Closing as “by design”.
@pranavkm
I don’t understand what’s going on here.
“Razor compilation is attempting to use the same refs to compile the view at runtime as the ones that the application used.”
This suggests that there are two separate sets of dependencies.
But isn’t the code compiling the view contained in the Microsoft.AspNetCore assemblies? And aren’t those assemblies loaded into the application’s app domain? So don’t they have the same dependencies as the application anyway, since they are part of the same application?
Also the assemblies in /refs don’t even look like the actual assemblies they purport to be. E.g. Microsoft.CSharp.dll in/refs is 23k, except that no real Micorsoft.CSharp.dll is actually 23k, the real ones are 1.1MB (Dotnet Core) and 472K (Dotnet Framework).
There is clearly more going on here than meets the eye and I need to understand it as I am designing our first ASP.Net Core application.
Is there a fuller more technical explanation of this somewhere or can someone here explain this please?