-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolvedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
Description
Static HTML included as partial Throw error on Publish.
Had following code that read /Content/Home/en/*.html
And include it as
`@{
string path = "/wwwroot/Content" + Model;
DirectoryInfo di = new DirectoryInfo("." + path);
FileInfo[] files = di.GetFiles("*.html", SearchOption.AllDirectories);
foreach(FileInfo file in files)
{
<partial name="~@path/@file.Name" />
}
}`
On debugging environment everything works fine.
On Publish: have the next error:
InvalidOperationException: Cannot find reference assembly 'Microsoft.AspNetCore.Antiforgery.dll' file for package Microsoft.AspNetCore.Antiforgery at line
To Reproduce
https://github.com/Equanimaster/AntiforgeryIssue
Build this project, then Publish to Folder and run on IIS.
Tried fixes
- Included all sorts of Nugets that has Antiforgery inside.
- Included all sorts of options related to Antiforgery.dll to be included on Publish.
Found fix
- To include file content as @Html.Raw(File.ReadAllText("./path/to/file.html"));
Metadata
Metadata
Assignees
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolvedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates