Roslyn: Question: How do I use the "refs" tag?

Created on 6 Aug 2019  路  2Comments  路  Source: dotnet/roslyn

Alternatively, projects that use .NET SDK can set PreserveCompilationContext build property to true. Publishing such project will copy reference assemblies for the framework the project targets to a refs sub-directory of the publish directory.

I used < PreserveCompilationContext > true < / PreserveCompilationContext > and published the WEB application, but I didn't see the refs subfolder. How do I use the refs tag?

image

Area-Compilers

Most helpful comment

A quick trace though the code indicates that you also need to add:

<MvcRazorExcludeRefAssembliesFromPublish>False</MvcRazorExcludeRefAssembliesFromPublish>

By default the web sdk disables the refs folder, because it would otherwise always be generated due to internal details of how razor view pre-compilation works.

Adding that property tells the web that you really do want the refs folder.

This probably does need to be better documented.

All 2 comments

A quick trace though the code indicates that you also need to add:

<MvcRazorExcludeRefAssembliesFromPublish>False</MvcRazorExcludeRefAssembliesFromPublish>

By default the web sdk disables the refs folder, because it would otherwise always be generated due to internal details of how razor view pre-compilation works.

Adding that property tells the web that you really do want the refs folder.

This probably does need to be better documented.

@KevinCathcart Thanks, It works .It's so Cool!

Was this page helpful?
0 / 5 - 0 ratings