-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find view (After publish) #54
Comments
Hi @aleksandaryanakiev, thanks for reporting the issue. Is it possible for you to provide a minimal sample that reproduces the issue? |
Hi, I've spent around an hour this morning trying to get a simple Unit Test working. ` [Test]
` I'd created a local Views folder in the NUnit Test project, but that wouldn't work. I've tried following your examples here: https://code.soundaranbu.com/send-emails-with-razor-templating-in-asp-net-core/ more closely by creating a separate class library for the EmailTemplates. Just continue to get:
/Views/WelcomeEmailTemplate.cshtml
Am I missing something here? I just wanted to use Razor rendering for email templates, and your library looked like a simple solution. |
Hi @gabs247, it's unfortunate that you are facing these issues. I would like to know if you have followed all these steps here: You can also clone this repository and navigate to the examples folder or test cases to see if it's working for you. If it works then you can compare it to yours. If still you are facing the issue, I am happy to take a look at a simple reproducible sample if you can provide one. Awaiting your response. Thanks. |
Thanks @soundaranbu, will try cloning when I have some time and see if I can get the samples to work. I tried following those steps and the other examples to see if I'd missed something, I'm using .NET 6, but kept getting the error indicating that the View couldn't be found. cheers |
I'm not able to reproduce this issue. Hence closing. Feel free to reopen if you can provide any sample project to reproduce the issue. |
I am getting the same issue. Request to reopen. |
Hi @nsbgit, thanks for reporting your issue. As mentioned earlier, this can be reopened with a minimal sample that reproduces the issue. I look forward to the sample. Thanks |
Not sure if this was the issue for the other users, but I was running into the same issue with the latest version (1.9.0). I got the same error after copy/pasting pieces of code from one project (where everything worked fine) to another. In the end I found out that I forgot to add the dependency in Startup.cs as described in the documentation: In ASP.NET Core, add dependency like below in ...
services.AddTransient<ExampleService>();
//add after registering all the dependencies
services.AddRazorTemplating(); |
Hi, getting same issue, is it necessary to create RazorLibrary, what if we want to keep razor template in same project as web api project? |
Hey @prabhpahul, you don't need to. But you'll have to make your API's .csproj look similar to this https://github.com/soundaranbu/Razor.Templating.Core?tab=readme-ov-file#razor-views-in-library |
But I do have another project which works perfectly fine with out this. Also, how does only complaints in docker works fine if you run on IIS or dotnet run command locally through vs code |
Have you tried to publish in your local & run the build output? Did that work? |
Yes, it works as expected. Only when I run on it docker complains. Also, I'm currently using Microsoft.NET.Sdk.Web changing to Razor Sdk is triggering lot of other changes. I am adding manually reference to razor pages to make it work
|
I was able to fix it, use was Template folder not mounting in docker after publish, had to add a itemgroup in cs proj,
|
When I run locally my code everything works as expected, but after I publish it in docker I get this error:
`An Exception has occured when generating PDF Document: Unable to find view '~/Views/CashBookTemplate.cshtml'. The following locations were searched:
~/Views/CashBookTemplate.cshtml
Hint:
Can you help?
The text was updated successfully, but these errors were encountered: