Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Check if custom parameter is set

$
0
0

I have a multi project template that reads the "$ext_projectname$" parameter in the child projects. This parameter is defined by the "CopyParameters" attribute in the ProjectTemplateLink:

<ProjectTemplateLink ProjectName="Interface" CopyParameters="true">
          ProjectTemplates\Interface\Interface.vstemplate</ProjectTemplateLink>

When I install my template through the VSIX mechanism, it works just fine. The VSIX also installs als child template projects as a seperate template, so that you can create projects manually instead of using the multiple projects template.

The problem is that if I generate a project from a child template, some variables are missing, e.g. the ext_* parameters.

I need to check if the parameter is set and if not, create the template differently.

I tried the following code:

$if$ ($ext_projectname$)namespace $ext_projectname$.$projectname$
$else$namespace $projectname$
$endif$

and also

$if$ ($ext_projectname$ == "")$namespace $projectname$
$else$namespace $ext_projectname$.$projectname$
$endif$

but none if it seems to work, when I use the child template, I see code like this in my class file:

namespace $ext_projectname$.MyProject

Is it possible to check for unknown / empty custom parameters?

I can't find any documentation on conditional templates on the MSDN.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>