Custom Item Template Group - visual-studio

I'm building out custom item templates to work with our internal platform. Is it possible to have these templates appear in their own group say "MyGroup" as opposed to being dropped into one of the other pre-existing groups?

Depending on how you are deploying your custom item template, I've found two ways to do this.
If you are simply deploying the .zip file, you can place it in a sub-folder in the appropriate language folder inside your ItemTemplates directory. For example:
\My Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#\MyGroup\myTemplate.zip
If you are installing your custom template as part of a VSIX file, then open up the your .vsixmanifest file in the designer in Visual Studio, go to the "Content" section (at the bottom), and remove your Item Template. Now, add it back using the "Add Content" button, and specify a "subfolder" (e.g. "MyGroup"). Now, when you install your extension, your Item Templates should show up inside a group with the same name as the specified sub-folder.

Related

clion: exclude files from project view

My Project View in CLion lists not only C++ files and headers but also built libraries (.la) and object files (.o). I don't want to see them. What can I do to make them not appear in the list?
In the menu go to Files/Settings: in the dialog box chose the item File types. The last field in the dialog is Ignored files and folders. It contains semicolon-separated patterns that will be applied and, if the file matches one of these, ignored. Wildcards like * are allowed.
So just add ;*.la;*.o at the end.
You can also define a so-called "Scope" by clicking on the gear icon at the right of the project view's header bar -> "Edit scopes". This will present you with a nice ui to define your filter. Afterwards, click on the triangle next to "Project" in the project view header bar and select your newly created scope.
If you are using version control(git) you can also add the file extensions to the .gitignore file and Clion should hide those files as well. If you're not using version control then adding the file extensions to the Clion Ignored files and folders list.

Multiple build configuration in Advanced Installer

I am using Advanced Installer with Visual Studio 2010.
I managed to create an .aip project, but when I want to add the files from the relevant VS projects, I have to choose the exact location of these files.
I want to use more then one build configuration so I can use config transforms to change my .config files depend on the build configuration I choose.
This is a problem for me because when I compile in Debug the .exe & .dll files goes to bin\Debug, but when I compile in, lets say, Staging these files goes to bin\Staging.
How can I get Advanced Installer to get the right files, meaning get them from the target folder of the build configuration I chosen?
Advanced Installer does not support this by default, but with a little bit of tweaking you can get this working. Let me explain how:
the first requirement is to have your output folders generated by VS in the same parent folder, as you have them both placed in "bin\".
now you need to open your project in Advanced Installer GUI and do the following:
create two builds in Media page, called Debug and Staging
create a property called "Configuration" or what name would you like, from Install Parameters page
in the New Property dialog you will have options to set per-build values for your property. Set them to "Debug" and "Staging", i.e. the names of the folders created by VS
now go to File -> Options -> Path Variables and define a new path variable with your full path for the debug/staging, the one you current have in the project.
from the Home tab, in the toolbar, use the "Convert Paths" wizard and then save the project.
Now, it comes the tricky part, you will need to edit the project file in a text editor, like Notepad++, capable of saving the file in UTF-8 format. Once you open the file look for this XML node:
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
<ROW Name="BIN_DIR" Path="<your path>\bin\Debug" Type="2" Content="0"/>
You might have multiple variables here if you are already using this feature. You need to edit the value and replace "Debug" with "[|Configuration]".
Now you can save and build the project and it should pickup the correct files for each of the two builds.

Visual Studio: can I copy a project's properties to use in another project?

I've added several directories, libraries such as matlab, opencv, etc to compile my current C file in Visual Studio project.
All my upcoming projects will require the same setup/properties. Do I need to setup my each project's properties individually or I can do something to apply it to all ?
Try using Property Sheets. These can create a single properties file that can be inherited by multiple projects.
Use "View > Other Windows > Property Manager" to bring up the Property Manager. It will show your projects and configurations.
Right click a configuration, and select "Add New Project Property Sheet...". You can name it, and select a location that works for all your projects.
Once created, you can edit its properties just as you would a build configuration.
To use that property sheet as the basis for other projects, just right click the configuration or project, and select "Add Existing Property Sheet...". Browse to where you saved the original sheet, and it will be inherited.
Any changes to the original sheet will be applied to any project that inherits it, unless they are overridden. If you go into properties higher up the chain, properties that override will have bold type for their values. To get them to always use the value in the base sheet, there will be a "inherit from parent or project defaults" option where applicable.
I am using AtmelStudio 6.1, which is built on Visual Studio 2010 (I believe), and yet doesn't have any Property Manager that I can find.
So, the hackish system I use is:
close (or at least unload via the contextual menu) the project whose configuration you want to modify
open its .cproj file (which is XML) in any text editor (VS works nicely),
MAKE A BACKUP COPY OF IT SOMEWHERE ELSE JUST IN CASE,
open the .cproj file of the project whose configuration data you want to copy,
look for the configuration data you want. Configurations are inside of PropertyGroup tags; for example, in my case it looks like
<PropertyGroup Condition=" '$(Configuration)' == 'Preprocess only' ">
for the configuration named "Preprocess only". Copy from the beginning of that tag until the end of the corresponding
</PropertyGroup>
tag.
Paste the block into the destination .cproj, just after other
</PropertyGroup>
tag. Make sure that the name of the configuration is unique in this file. Save.
You're finished. Now open the project normally in VS and you'll be able to select the added configuration.
For Visual Studio 2010+ you can make a Project Template.
If you choose to automatically add the template to Visual Studio in the template creation wizard, when you create/add a new project, the template will appear (after restarting Visual Studio). Projects created with this template will have the same project properties!
To add source code files to the template, the easiest way is to rearrange the source code files in solution-explorer to be in the root (not under any folder). After doing that, THEN generate the template.
Why? Sometimes putting your files under the default Source Code solution-explorer folder (not in file explorer, the .project.filters label) will fail to copy the source file to the template, you'll see "the document cannot be opened. it has been renamed deleted or moved" when you try to use the template and the file you wanted in the template will NOT be in the file explorer.
If you do want solution-explorer folders, you will have to add them manually to the template by unzipping the template folder, making changes, then re-zipping it again.
For example, literally copy and paste the source files you want the template to have in the template folder and edit the .vstemplate file. M$ Doc on template editing.
<TemplateContent>
<!-- put new file references here and/or in your .vcxproj .vcxproj.filters -->
TargetFileName="HelloWorld.cl">HelloWorld.cl</ProjectItem>
<ProjectItem ReplaceParameters="false"
</TemplateContent>
Related questions:
How do I use VS template I created?
How can i load a template I have created in Visual Studio?
How copy visual studio project?
Simply copying and pasting entire projects and solutions is not recommended for complex or shared projects since various GUID s and filenames may overlap - causing bugs.
For MSVS 2017, the process #AaronMK mentioned doesn't work. Instead do the following:
View -> Other Windows -> Property Manager
Add New Property Sheet.
Edit whatever options you want there.
Give it an appropriate name so that you remember it.
Right button on it and hit "Save {myPropertySheet}"
It would be wise to place it alongside the default property sheets and that you can add it whenever you want (by Property Manager -> Add Existing Property Sheet -> Browse to its location). This directory is: C:\Users\{myUsername}\AppData\Local\Microsoft\MSBuild\v4.0
Alternatively you can edit the default property sheets and use these by default. I wouldn't advice it though as they provide a fallback option in case you mess up. So make backups first if editing default files.

Why cannot add resources to the folder in VS 2010 Express?

Hi
In order to be able to work with e.g. picture, I need to click on Resources.resx and Add Existing Item.
Then it will appear under Resources folder. However I could use Context menu on that Resource folder and add existing item as well but then I cannot work with it and it is not displayed when I use the Resources.resx file.
So I always need to click on Resources.rext when I want to add anything? Also in this "view" I cannot use folders so its pretty messy.
Also what is New Folder in Resources dir good for - when I drag files there, there are not accessible anymore..
Correct; to add something to a ResX file, you need to add it to the ResX file.
Instead of folders, you can use multiple ResX files.
You can also embed images in your assembly (set Build Action to Embedded Resource) instead of using ResX files; you can then create arbitrary directory trees.
To read embedded resources, call typeof(MyType).Assembly.GetManifestResourceStream(name) and remember to close the stream in a using statement.

Visual Studio - how to BULK add files under a given directory as LINK?

How can one add in Visual Studio all the files under a given directory 'as link' (that is, without Visual Studio creating a local copy under current project's directory, which is what happens if one adds a folder as 'existing item')?
In my case, I don't want local copies. Instead, I want to work with existing items in their original locations. And, I don't want to add them by going through each folder. Instead, I want to specify a given folder and click a magic silver bullet button that adds all of the files below it as 'link'.
Thanks in advance.
(Disclaimer - I went through related questions, but all of them result in VS creating local copies.)
For single files
on the add item dialog you can see a small arrow pointing down on the add button
click that (since it is a button with a dropdown) and chose the add as a link menuitem. that will add the item as link
For multiple files
on the add existing items dialog SELECT all the files you want to add as an link and press the menu item ont he add button add as a link
For Multiple files in multiple locations
If you want to select a folder and add all the items on all subfolders then you can do that this way,
on the open dialog do a search for file types you want to add, select them all and do the "add item as link" action.
Since your question changed twice including the change on the title (once)
Visual Studio - how to BULK add files under a given directory as LINK?
edited title
I have added all the things i think you needs let me know if you still like to do something else
Hope this helps
Dan
If you want files under an external directory to be synced automatically in your Visual Studio project (i.e any new files are added to the solution explorer and any deleted ones are removed) then you can specify a wild card in the link. Do to this you will need to edit the project file (.csproj, .vbproj) manually though.
Find the section in the file where the ItemGroup elements are located and add something like this:
<ItemGroup>
<Content Include="..\MyDirectory\*.*" />
</ItemGroup>
This will add all files under MyDirectory (one level up from the project) to the solution automatically.
If you select 'Show all Files' in the Solution Explorer, you can than view all the files and folers and select them and right click to add them using 'Include in Project'.

Resources