Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Make Blazor Project Name Dynamic For Non '.cs' files

$
0
0

I am working with Blazor, and I have been tasked to create a template, in VS, so that all of our developers have base starting point for new projects.

When I export as a template, it all goes pretty smooth. When using the template, I was pleasantly surprised to see all of the namespaces automatically update to the new project name. However, I have one instance of a name space that is within a .razor (non razor.cs) file, as follows (let's say I use the template to create a project called NewProject):

<TemplateFiles.Shared.AddressBookDialog          @ref="Addrbook"          CloseEventCallback="@OpenAddressBook_OnDialogClose"/>

How can I make the TemplateFiles project name become dynamic so that it updates to the new project name (NewProject.Shared.AddressBookDialog) automatically?

I have tried using a string to set the path dynamically (shown here):

string projectName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

but it does not seem to like the string @projectName reference within the line of code.

Is there a best practice to achieve this?


Viewing all articles
Browse latest Browse all 4839

Trending Articles