So I just updated my app to use ASP.NET Core RC2. I published it using Visual Studio and noticed that my Area is not published:
This snapshot is from src\MyProject\bin\Release\PublishOutput
:
And here is my Area, named Admin
in Visual Studio:
Am I missing an step or what?
You need to configure your
publishOptions
section ofproject.json
to include theAreas
folder which is not included in the default template:ex:
Update
If you want to ensure that your controllers and other .cs files are not included, you can blacklist with the
exclude
property ofpublishOptions
like so:If you prefer more restrictive security, you can simply whitelist .cshtml files instead of including the entire Areas folder like so:
Note
Be careful using wildcards like
**.cshtml
as they will include all files in all subdirectories, including thebin
directory. If you have any views in yourbin
folder from a previous build, they will be duplicated again inside the new build output until the path becomes too long.Adding Areas will copy everything including the .cs files.
so should add
"Areas/**/Views/**/*.cshtml"
and"Areas/ * /.cshtml"
under publish options instead of only"Areas"