Replacing string literal values in Visual Studio project templates
Posted
by Daniel A. White
on Stack Overflow
See other posts from Stack Overflow
or by Daniel A. White
Published on 2010-03-18T01:03:20Z
Indexed on
2010/03/18
1:11 UTC
Read the original article
Hit count: 400
I notice when I create a project template from an existing project in my solution, it does a semi-string replace to update references. However, it does not replace string literals. It does update my web.config
file, but not code files.
The project template:
namespace MyTemplateProject
{
class MyClass {
public string GetStringValue() { return "MyProjectTemplate"; }
}
}
The generated code when used as a template:
namespace MyActualNewProject
{
class MyClass {
public string GetStringValue() { return "MyProjectTemplate"; }
}
}
How can I instruct the template maker to replace "MyProjectTemplate"
wih "MyActualNewProject"
?
© Stack Overflow or respective owner