Search code examples
c#visual-studiovisual-studio-templates

create vs template and selecting framwork


hi Hi I have created a Visual Studio template, But when the user changes the framework version when creating a new project, nothing happens in the program and only uses version 4.7.2 this is my projecttemplate

<PropertyGroup>
    <RootNamespace>$safeprojectname$</RootNamespace>
    <AssemblyName>$safeprojectname$</AssemblyName>
    <TargetFrameworkVersion>4.7.2</TargetFrameworkVersion>
  </PropertyGroup>

and this is my wpfapp.vstemplate

<TemplateData>
    <RequiredFrameworkVersion>4.0</RequiredFrameworkVersion>
    <MaxFrameworkVersion>4.7.2</MaxFrameworkVersion>
  </TemplateData>

if i create a new project and i set framwork to 4.5, The project is created with framework 4.7.2 so how to fix this?


Solution

  • Use $targetframeworkversion$ instead of 4.7.2 in your project template.