FluentEmail icon indicating copy to clipboard operation
FluentEmail copied to clipboard

Can't find Antiforgery package

Open dontbesorry80 opened this issue 4 years ago • 7 comments

When using FluentEmail it seems to work find for text emails, but when I try to use Templates. I get the following error when using .Net Core 3.1

Cannot find reference assembly 'Microsoft.AspNetCore.Antiforgery.dll' file for package Microsoft.AspNetCore.Antiforgery

Is this something that's already known about? Is there a workaround?

dontbesorry80 avatar May 29 '20 12:05 dontbesorry80

<PropertyGroup>
    <PreserveCompilationReferences>true</PreserveCompilationReferences>
    <PreserveCompilationContext>true</PreserveCompilationContext>
 </PropertyGroup>

Add .csproj file

huseyingoztok avatar Jun 10 '20 14:06 huseyingoztok

Out of curiosity, why does this fix the problem?

chitoiur avatar Jul 28 '20 21:07 chitoiur

I only needed <PreserveCompilationReferences>true</PreserveCompilationReferences> in my .NET 5 web application. Is an issue with RazorLight rather than FluentEmail afaik.

DavidDeSloovere avatar Dec 03 '20 08:12 DavidDeSloovere

Could this be highlighted in the documentation? This took some time to find the solution.

ThatMouse avatar Sep 03 '21 16:09 ThatMouse

This does not work in .NET 6

<PropertyGroup>
    <PreserveCompilationReferences>true</PreserveCompilationReferences>
    <PreserveCompilationContext>true</PreserveCompilationContext>
 </PropertyGroup>

Add .csproj file

alexrait avatar Mar 06 '22 07:03 alexrait

For net 6 use:

<PropertyGroup>
	<PreserveCompilationReferences>true</PreserveCompilationReferences>
	<PreserveCompilationContext>true</PreserveCompilationContext>
	<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
	<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>

noproblemoh avatar Aug 17 '22 13:08 noproblemoh

For net 6 use:

<PropertyGroup>
	<PreserveCompilationReferences>true</PreserveCompilationReferences>
	<PreserveCompilationContext>true</PreserveCompilationContext>
	<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
	<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>

noproblemoh avatar Aug 17 '22 14:08 noproblemoh