Skip to content
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

bugfix: fixes bug preventing templates to be properly loaded in any environment #2

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/N-Tier.Application/N-Tier.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -7,15 +7,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1"/>
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.4"/>
<PackageReference Include="MailKit" Version="2.15.0"/>
<PackageReference Include="MimeKit" Version="2.15.1"/>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.4" />
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="MimeKit" Version="2.15.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\N-Tier.DataAccess\N-Tier.DataAccess.csproj"/>
<ProjectReference Include="..\N-Tier.DataAccess\N-Tier.DataAccess.csproj" />
</ItemGroup>

<ItemGroup>
<None Remove="Templates\confirmation_email.html" />
<Content Include="Templates\confirmation_email.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions src/N-Tier.Application/Services/Impl/TemplateService.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Reflection;

namespace N_Tier.Application.Services.Impl;
namespace N_Tier.Application.Services.Impl;

public class TemplateService : ITemplateService
{
private readonly string _templatesPath;

public TemplateService()
{
var projectPath = Directory.GetParent(Directory.GetCurrentDirectory()).FullName;
var templateProject = Assembly.GetExecutingAssembly().GetName().Name;

_templatesPath = Path.Combine(projectPath, templateProject, "Templates");
_templatesPath = Path.Combine(AppContext.BaseDirectory, "Templates");
}

public async Task<string> GetTemplateAsync(string templateName)
Expand Down