Giter VIP home page Giter VIP logo

Comments (8)

murst avatar murst commented on May 19, 2024 1

I was finally able to get everything working again on Ubuntu. To summarize, I took the following steps:

  1. I generated a "refs" folder containing all of the required assemblies by adding <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> to the WebApp project. I copied the refs folder to the root web folder on Linux. I then removed the MvcRazorCompileOnPublish tag from my WebApp project.

  2. I removed the _ViewImports.cshtml file from Blogifier.Core/Views. I manually added@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers to all of the views to compensate.

  3. I updated EmbeddedResources.cs as described by the post directly above.

I realize these aren't ideal changes, but that's was was necessary for me to get the core 2.0 package working on ubuntu. Hopefully you guys can find better workarounds.

from blogifier.

rxtur avatar rxtur commented on May 19, 2024 1

Thanks for doing this, we soon will be ready for testing Linux/PostgreSql functionality and this might help to avoid some major headaches.

from blogifier.

murst avatar murst commented on May 19, 2024

I think i found a workaround for the problem.
Adding the following into the WebApp project file:

<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>

will create a 'refs' folder with all the required assemblies. If I FTP the 'refs' folder to my server, the pages work again. The downside is that the initial load after a dotnet restart will cause the loading to be very slow, although that only affects the initial page load. Subsequent page loads are pretty quick.

I only needed to copy the 'refs' folder, and not the 'Views' folder. After the 'refs' folder is copied, you can delete the code above from the webapp project and publish as before, so long as you leave the 'refs' folder on your server in your web directory.

from blogifier.

murst avatar murst commented on May 19, 2024

Just a quick update on this. This might be related to the switch to Core 2.0 (I've been using the dev branch). I noticed other problems, such as the _ViewImports.cshtml file not really working. I've had to update all @model references in the /View/Account/ and /View/Manage/ folder to use fully qualified names, for example:

@model WebApp.Models.AccountViewModels.LoginViewModel
@inject Microsoft.AspNetCore.Identity.SignInManager<WebApp.Models.ApplicationUser> SignInManager

from blogifier.

murst avatar murst commented on May 19, 2024

I made some more progress on this. The reason why the _ViewImports wasn't working seems to be because it was conflicting with the _ViewImports from the Blogifier.Core project. Its possible that, since they were both in an identical location, they were conflicting with each other. Removing the _ViewImports.cshtml from Blogifier.Core made my WebApp work correctly.

I'm starting to understand how you guys got the Views from Blogifier.Core to work in the WebApp (and the purpose of the "PrependFileProvider" setting). Unfortunately, this doesn't seem to work anymore for me in the latest core 2.0 build on Ubuntu. I'll try to figure out why....

EDIT: By the way, the reason for the conflict of _ViewImports was because I had "PrependFileProvider" set to true. It seems that this caused the EmbeddedFileProvider to execute first, and hence the _ViewImports from Blogifier.Core was probably being used instead of the _ViewImports from my WebApp. I'm not certain that this was happening, but it does seem to explain why the Views from my WebApp weren't working unless I provided the full paths in the Views.

from blogifier.

murst avatar murst commented on May 19, 2024

In attempting to get the Views from Blogifier.Core working, I found another problem, which may again be related to the core 2.0 push.

In EmbeddedResources.cs, the following

if(ex.Message == "Write to non-body 304 response.")

needed to be changed to

if(ex.Message == "Write to non-body 304 response." || ex.Message == "Writing to the response body is invalid for responses with status code 304.")

The error message appears to be different than what was expected.

from blogifier.

liuyl1992 avatar liuyl1992 commented on May 19, 2024

I also encountered this problem:
it is broken out after release to Linux,but it is Passed on windows,I think the reason is that Windows and Linux have different paths, do you think?
Exception:
[Error] The view '"/Views/Blogifier/Themes/Standard/Index.cshtml"' was not found. Searched locations: ["/Views/Blogifier/Themes/Standard/Index.cshtml"]

from blogifier.

rxtur avatar rxtur commented on May 19, 2024

The current build is tested and working out of the box on Ubuntu, so closing this up.

from blogifier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.