Parameterize the target framework of a Visual Studio template project - visual-studio

When exporting a project as a template in Visual Studio I noticed that the "TargetFramework" property of the .csproj file in the .zip archive is not parameterized but hardcoded as the framework version used to create the project from which the template.
My question is - is it possible to create a project template but make it so that the "TargetFramework" property is changed depending on the user's settings/machine/etc.?

If you want to honor the framework selected by the user on the new project dialog, you can use the targetframeworkversion parameter, so the csproj template would be <TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion>.
If you don't want the user to select the target framework version, you should disable the corresponding combo box on the new project dialog, I don't know if there is a way to achieve this. Then, on the project wizard, you have to either set the value of the parameter targetframeworkversion or add your own parameter.

Related

OpenGL set up problem when create new project via Visual Studio express 2017?

I'm using VisualStudio express 2017 as the IDE. I have set up everything for the OpenGL and everything works fine. But there is a problem, I realized that I have to set up the library and dependencies every time when I create a new project. Can anyone help me with this problem?
There's a solution to that called a Property Sheet. Since I don't use VS Express, I'll explain how to create and reuse properties for a Visual Studio Community Edition project.
Create a new project, for example a C++ Console Application (or whatever programming language you're using)
To display Property Manager go to View > Property Manager or View > Other Windows > Property Manager
In the Property Manager, left-click on the "triangle symbol" next to your project name to display the configurations.Choose the configuration you want to set up (here Debug | Win32 is highlighted)
.
Right-click on the configuration. Choose Add New Project Property Sheet. A property page dialog box appears. Enter a name (file extension .props) and where to save it. Click Add.
Left-click on the "triangle symbol" next to your configuration. You should now see your newly created property sheet. Double-click on it.
Now configure your project how you want, include dependencies , libraries, Linker etc.
After configuring, right-click on your property sheet. Save it.
Now everytime you create a new project, right-click on your project name in the Property Manager and click Add existing property sheet and brwose to its location.

Custom default referances for Solution Visual C# 2010

Is there a way to configure the current solution such that every new project created (or imported possibly) has references that you can configure rather than having to go through every project and add reference?
You can't configure solution for adding references to newly created/imported projects. But you can export a project template based on your project:
Create new project
Add desired references to this project
Invoke File -> Export Template... menu item
Select "Project Template" option and desired project in combo-box
Set template name on next page and click finish
Now you can create project from template you've created and it will have references you've added on step 2.

Check project path in custom Visual Studio wizard

I have created a custom template wizard for Visual Studio 2010. Thus I'm implementing the Microsoft.VisualStudio.TemplateWizard.IWizard interface. I want projects generated by this wizard to always be placed in a certain directory. If the user selected another directory a message box would show the error "Blah projects must be placed in C:\Blah".
Q: Before the wizard is shown, is it possible to check the project's destination directory?

Visual Studio: Set default startup project

I have a Visual Studio 2010 solution with several projects.
One of the projects is set as the default project, but I want to change that by default.
I know that I can right click the project I want to be the startup project and select "Set as StartUp project", but this setting will be stored in the user's files (.slo and .user files).
As a company policy, we don't check these files in the source control system, therefore when another user opens the solution it will have a different project as the startup object.
Is there another way to set these values? Something like a setting on the .sln or .proj files?
Thanks
From Arian Kulp's site, the way to change the default startup project for a solution is to edit the .sln file. You'll see some Project and EndProject lines. The first Project listed will be the default startup project, so just move the one you want to the top.
Follow these steps:
Choose the name of the project which you want to set default startup project
Click to the Project on toolbar and then click Set as startup project

Compile error when trying to debug a Visual Studio integration project

I'm currently working on a Visual Studio integration project for VS2010 (a custom highlighter) I'm using Irony and the LanguageServiceTemplate from this Code project article. However that template is build for 2008 and the changes made in VS2010 when it comes to integrating breaks the template.
When I try to compile I get the following error:
Source.extension.vsixmanifest file not found in project. If a file with this name is present in the project, make sure the build action is set to "None".
Any ides of what I can do to fix it?
You have two options depending on how your package is constructed.
1) Edit the project file and remove the following line.
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
If you do this, you will lose a few things like the automatic zipping of your item and project templates.
2) Add a source.extension.vsixmanifest file to the root of your project. You can get one by creating a new VSIX Project. After you install the Visual Studio 2010 SDK, this is under the Extensibility category. If you add no content, it won't create a vsix file.
The second method is probably the best route to go. I have a specific VSIX project that I use to pull in various other package projects. If you only have one project, you can use the new vsixmanifest file to include the project to make an installer.

Resources