Hasan A Yousef
Hasan A Yousef

Reputation: 24988

publish the Views in dot net core

In my app, after dotnet run I was able to see the view called by:

return View("~/Views/v1.cshtml"); 

and I got the Views folder copied in the publish folder after adding in my project.json the below:

"publishOptions": {
     "include": ["Views"]
}

but after publishing the app, using the:

dotnet publish --output "publish" --configuration release

and running the:

e:\myApp\publish\dotnet myApp.dll

The view had not been displayed in the browser after being called by the controller.

what is the mistake i'm doing here, and how to get it fixed? thanks

Upvotes: 1

Views: 1695

Answers (1)

J. Doe
J. Doe

Reputation: 2747

If your using non-convention patch to Views don't use project relative patch (like ~/ or ./). So proper will be

return View("Views/v1.cshtml");

Upvotes: 2

Related Questions