ligershark / side-waffle

A collection of Item- and Project Templates for Visual Studio
Other
657 stars 205 forks source link

How to respond to .NET Target Framework Version ComboBox #361

Closed RehanSaeed closed 8 years ago

RehanSaeed commented 8 years ago

In the VS new project dialogue, there is a .NET Target Framework Version ComboBox. How can we hook into this using SideWaffle if I want to change some code based on the target framework version?

codewithtyler commented 8 years ago

cc: @sayedihashimi

sayedihashimi commented 8 years ago

The value comes in via a property to the template. For example http://reasoncodeexample.com/2013/06/09/creating-visual-studio-project-templates/. If you want to customize content I'm not sure if there is a better way than a custom wizard.

RehanSaeed commented 8 years ago

So it looks like I can use $targetframeworkversion$? I just want to add it to my csproj:

<PropertyGroup>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>

And also in my Web.config:

<system.web>
    <compilation debug="true" enablePrefetchOptimization="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
</system.web>

Thanks, that sounds simple enough.

sayedihashimi commented 8 years ago

Yeah should be able to use that. FYI we have some examples of it being used here in SideWaffle https://github.com/ligershark/side-waffle/blob/b8c7e04b5ee287335bdf70b1eb3b38545dc59332/Project%20Templates/Nancy.CSharp.AspNetHost/_preprocess.xml. Can we close this or is there some other info/action needed?