Skip to content

Commit

Permalink
Only adding _ViewStart to non blazor projects (identity) (#1866) (#1867)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepchoudhery committed Apr 1, 2022
1 parent 5053ee8 commit f3e25ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ internal static List<IdentityGeneratorFile> GetViewImports(IEnumerable<IdentityG
private static readonly string _ViewImportFileName = "_ViewImports";

// Note: "peer" is somewhat of a misnomer, not all of the "peer" files are in the same directory as the layout file.
internal static bool TryGetLayoutPeerFiles(IFileSystem fileSystem, string rootPath, IdentityGeneratorTemplateModel templateModel, out IReadOnlyList<IdentityGeneratorFile> layoutPeerFiles)
internal static bool TryGetLayoutPeerFiles(IFileSystem fileSystem, string rootPath, IdentityGeneratorTemplateModel templateModel, out IReadOnlyList<IdentityGeneratorFile> layoutPeerFiles, bool isBlazorProject)
{
string viewImportsFileNameWithExtension = string.Concat(_ViewImportFileName, ".cshtml");

Expand Down Expand Up @@ -273,8 +273,14 @@ internal static bool TryGetLayoutPeerFiles(IFileSystem fileSystem, string rootPa
ShowInListFiles = false,
ShouldOverWrite = OverWriteCondition.Never
};
peerFiles.Add(layoutPeerViewStart);

//don't need Layout for the start page of a Blazor Server application.
//Still adding Layout file for other added pages.
if (!isBlazorProject)
{
peerFiles.Add(layoutPeerViewStart);
}

layoutPeerFiles = peerFiles;
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private IdentityGeneratorFile[] DetermineFilesToGenerate(IdentityGeneratorTempla
filesToGenerate.AddRange(IdentityGeneratorFilesConfig.GetViewImports(filesToGenerate, _fileSystem, _applicationInfo.ApplicationBasePath));
}

if (IdentityGeneratorFilesConfig.TryGetLayoutPeerFiles(_fileSystem, _applicationInfo.ApplicationBasePath, templateModel, out IReadOnlyList<IdentityGeneratorFile> layoutPeerFiles))
if (IdentityGeneratorFilesConfig.TryGetLayoutPeerFiles(_fileSystem, _applicationInfo.ApplicationBasePath, templateModel, out IReadOnlyList<IdentityGeneratorFile> layoutPeerFiles, templateModel.IsBlazorProject))
{
filesToGenerate.AddRange(layoutPeerFiles);
}
Expand Down

0 comments on commit f3e25ac

Please sign in to comment.