I have a Visual Studio Template Wizard where eventually I need to conditionally (based in user selections) change the .NET target with:
// project is of type EnvDTE.Project
project.Properties.Item("TargetFrameworkMoniker").Value = ".NETFramework,Version=v4.5"
The problem is that after this all references to project properties return "Project Unavailable".
After changing the .NET target I need to add some assemblies as references and without the project being available this no longer works.
Inverting the tasks order (first adding the references then changing the target) does not work, because I am adding some dependencies that require .NET 4.5 (and project is originally .NET 4.0).