Exporting a Visual Studio Add-in - visual-studio-2013

Anyone had a need ( or more importantly, know how ) to move a Visual Studio Add-in from one machine to another? Of course it would be easy if I had access to the .vsix, but that's in a bit bucket somewhere. I tried poking around the registry and File Explorer, but didn't see anything likely.
Doing a Tools / Import and Export Settings got part of it - there's a placeholder on the toolbar that has the add-in's name, but none of the buttons show, and, unlike the original machine, the new machine's dropdown to Add / Remove buttons shows nothing.

First you need to find an .AddIn file that declares an add-in for Visual Studio. Usually it is located in the "c:\Users[user_name]\Documents\Visual Studio 2013\Addins\" directory, but can be in any Add-in File Paths listed in Options - Environment - Add-in Security.
In the .AddIn file there is an Assembly entry that contains a .dll name that implements the add-in.
You need to copy both files (.AddIn and .dll) to a new machine, plus optional auxiliary add-in files.
(BTW .vsix is not used to deploy add-ins.)

I recommend using the guide - Syncing Visual Studio Extensions and Settings with Dropbox :
http://www.larswilhelmsen.com/2012/01/08/syncing-visual-studio-extensions-and-settings-with-dropbox/
and complete it as you did with the Import and Export Settings (as noted in the guide too).
Other than that, there is not VS2013 extension for exporting VS extension, the only extention which work well is for VS2010 - ExtensionSync.
Source: https://visualstudiogallery.msdn.microsoft.com/dbaf0ac9-fb7b-4fb3-b34d-ea2269276d3c

Related

How to update web-installed Microsoft Visual Studio 2017 offline (saved layout)?

I have Visual Studio 2017 which was installed from the web.
Meanwhile, the corporate firewall rules changed and it's no longer possible to update the installation (download.visualstudio.microsoft.com is blocked).
At home I was able to download a complete Visual Studio 2017 layout to an external drive.
Now, how can I instruct Visual Studio Installer to use the external drive layout instead of trying to download from the web?
After googling a bit, I found some clues here and there, but never got a direct answer. I had to do some experiments until I found a very simple solution:
Open folder C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances (or equivalent in your machine). This folder should contain a subfolder with the VS2017 instance GUID (from now on referred to as VS_GUID). Note: ProgramData is a hidden folder.
(Optional) Create a backup of file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json in another directory of your choice.
Edit file C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\{VS_GUID}\state.json (note: VS_GUID is the sub-folder name found in step 1)
and change layoutPath to your local layout folder and installChannelUri to the full path to ChannelManifest.json (which should be present in the layout folder root).
Example (when layout path is D:\vs2017layout):
(...)
"layoutPath":"D:\\vs2017layout",
"installChannelUri":"D:\\vs2017layout\\ChannelManifest.json"
(...)
Save state.json and launch vs_professional_xxxxxxxxx.yyyyyyyy.exe (or equivalent) which is located in the layout folder. If it detects the updated installation files then the "download" progress should move to 100%.
This worked for me.

Qt5VSAddin for Visual Studio 2013 - where are the Settings saved to? And/or how to disable addin?

I'm working with Visual Studio 2013 professional and Qt 5, so I installed Qt5VSAddin, which is working as intended (I can choose an installed Qt version; meta compiling etc is working; Creating new VS Qt project works like a charm).
However I would like to use the same project and solution files on different machines, where Qt isn't necessarily installed in the same directory.
At the moment, the Qt addin changes the content of the project's .vcxproj.user file and adds the line <QTDIR>directorypath</QTDIR> with "directorypath" being the path I've chosen in QT5->"Qt options"->"Qt versions" of the addin. So if I compile on that machine, QTDIR in the .user is changed to that machine's Qt installation directory, meaning that I'll destroy the project file for anyone else trying to compile the project on another machine (maybe someone without the addin).
What I want to do is to change this Qt version information to a path relative to an environmental variable, like <QTDIR>$(MY_QTDIR)</QTDIR> or <QTDIR>$(MY_DEV_ENVIRONMENT)/Qt/</QTDIR>. Unfortunately, Qt5VSAddin does not allow to create QT versions with environmental variables (at least not with $() syntax) because it does not let you click on the "OK" button in this case.
I tried to change it in the .vcxproj.user file direcly, which does work (I can compile the project this way on another machine without the addin), but on VS2013 restart or clean->build it will overwrite the changes again.
I tried to deactivate the Qt5VSAddin in extras->add-in-manager (unchecked all 3 boxes) but after VS restart, the addin is active again. How can I deactivate it completely without uninstalling (I would still like to create new Qt projects with the addin occasionally)
Is there a way to set the Qt version path of the Qt5VSAddin including an environmental variable?
If not from the GUI, maybe I can change it directly in some config file? unfortunately I couldn't find the file/location where the addin configuration parameters are placed. So where are those pathes and settings saved to?!?
Addin stores its settings and Qt paths in registry: HKCU\Software\Digia\Qt5VS2013\ and HKCU\Software\Digia\Versions\ accordingly.
I didn't find yet where those settings are placed.
I tried to create a fantasy-named-folder and search for that foldername within all files on my drive, but didn't find it...
However I found the reason why I could not deactivate the Qt5 addin in Visual Studio for longer than the current session:
Visual Studio has to be started as Administrator to change the Addin options (at least for the Qt5 Addin) persistently!
After deactivating the addin, everything works as I like it.
I'm still interested in finding and manipulating the Qt-Versions pathes of the addin, since accessing the new project->Qt5 Projects templates, without re-activating the addin, results in a broken/incomplete project. So to get a working new Qt project, atm I have to restart VS as admin, activate the addin and create the project there (followed by manually editing ther .user file and deactivating the addin as admin again)...
UPDATE: Unchecking only the "start" addin option as an admin, I can activate the addin for non-admins on-the-fly to create a new project. I think I will be able to work this way, however I'm still interested in the second question.

Deploy a VSPackage to create a new project type using Setup Project

I create a new custom project type using a VSPackage project inheriting of MPF library (http://mpfproj11.codeplex.com/). As a result I obtain a .vsix but I need add this project type using a .msi. I'm using the Visual Studio 2010 Setup projet for it. In my setup project I add the content of the VS Package in the same directory where the .vsix put then, but I think Ineed to put in the registre the new type of project because when I use the setup , the project template does not come out in Visual Studio and when I give double click the file with extension of the type of new project and does not recognize it. When I look the registry after install the vsix, this was one of the things that I found diferent. I add this entries in my setup project but It's not working yet.I'm missing something else?
In the projecttemplatedir is the directory where I put the .dll of the project type, the vsixmifest and pkgdef. The project template is in [User]\Documents\Visual Studio 2013\Templates\ProjectTemplates\[Name of new Project Type]\[projecttemplate.zip]
Best Regards
PS: The project type is for VS 2013 but I'm using the VS 2010 Setup project ;)
OK, so first the "don't"s of doing this:
In general, if you are installing via MSI you shouldn't be doing anything user-specific -- no writing in HKEY_CURRENT_USER, nor writing within their Documents folder, LocalAppData, or Visual Studio folders, etc. If you see yourself writing files or registry keys in either of those places, that should be your hint that there's a better way to do what you're trying to do. For what you've shown so far, this raises more than a few red flags for me.
Second, don't ever go writing keys into 12.0_Config. That part of the hive is nothing more than a cache that's built up from other parts of the registry and on-disk .pkgdef files from extensions. It's rebuilt in any number of senarios, including installing new extensions. Any writes there you should presume will get blown away at any time. If you need to write things there you should either (a) write in HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\[version] and run devenv /setup or (2) [preferred] put your keys in a .pkgdef inside your extension which gets merged into 12.0_Config for you automatically.
Now the dos:
You said you already had a .vsix produced by the SDK: you can put project templates in there. You can then register those templates in the .vsixmanifest and those will pull in. That's far easier than mucking around with files in Documents -- that's the user's directory...don't go playing with that.
Once you have a .vsix that does most of what you need, you should simply take the files within that and install the files in a folder within C:\Program Files [(x86)]\Microsoft Visual Studio 12.0\Common7\IDE\Extensions. Even better, you might just want to WiX toolset to build your installer, since it has built-in support for installing extensions. It also has built-in support for invoking the "/setup" process if that's what you need to do as well. Visual Studio Setup projects are no longer supported in newer versions of Visual Studio, so you're better off starting with a technology that isn't already obsolete. WiX is even what we use at Microsoft to do the setup work for Visual Studio itself, so it's definitely up to the task.
Last point: almost everything when it comes to Visual Studio extensibility can be done with a VSIX directly, so presume there's a good way to do something that way before falling back to an MSI. Internally, we can register the entire C# and VB language services with just a VSIX -- they're quite powerful.
I found the answer in this link Registering Project and Item Templates. I set projecttemplatedir entry with
[User]\Documents\Visual Studio 2013\Templates\ProjectTemplates[Name of new Project Type][projecttemplate.zip] that is where i put the project template.

Edit $(IncludePath) "macro" in Visual Studio 2010

Visual Studio 2010 ("Project Properties" dialog)
I've installed Visual Studio 2010 Ultimate and it has apparently imported the default directories for my Win32 C++ includes and libraries. Every new Win32 C++ project I create automatically adds my old include/library directories which screws up my build.
So my question is this: How can I edit $(IncludePath) in Visual Studio 2010?
or is $(IncludePath) specific to this project and only the result of the "Inherit from parent or project defaults" checkbox? (in which case the question turns into: How do I edit project defaults for that since it appears to be depreciated in Visual Studio options)
Thanks!
NOTE: The %include% environment variable is not defined in Windows. It does show up if you enter "echo %include%" in the VS2010 command prompt (not the Windows command prompt), but it's not the same values as what I'm trying to get rid of in the screenshots)
In VS2010, these paths are specified in one or more property sheets (the respective changes are discussed in an instructive article on the VS Project Team Blog).
You can add those yourself per-project, but the project also includes one specifying all the default values.
On my system it is located in C:\Users\<user>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props.
You can access it from Visual Studio by opening the Property Manager window (View->Other Windows->Property Manager), and then doubleclick the property sheet. You can also add property sheets yourself from this window (which will take precedence over the default one).
It is also perfectly legal to remove the reference to Microsoft.Cpp.Win32.user.props. That is useful if you need to ensure the project is entirely self-contained: that it doesn't get include paths from the environment, for example. Then you just have to specify the paths in the project itself, or in a custom property sheet that is part of the project (recommended for ease of reuse)
VC++ Directories in VS2010 are project-specific. There are no global settings like in VS2008.
There is INCLUDE environment variable which corresponds to $(IncludePath), so check it first.
Formerly VS saved all global settings in Documents and Settings\\Local Settings\Application Data\Microsoft\VisualStudio\\VCComponents.dat so try to delete such file if it is present for all VS versions. I don't have such file for VS2010, but it's worth checking in your case.
Hope this helps.

How to include ignored files when using Publish tool in VS2010?

I have a directory /media/fonts in my asp.net mvc project which contains fonts for my website. When I use the "Publish" tool in Visual Studio this folder is ignored even though it is included in my project. Other folders /media/images and /media/css are included just fine.
Is there any way to tell Visual Studio to not ignore this folder on publish?
Select your font files and Change Build action as Content from Properties Window.
You can fix this permanently by modifying the default Build Action for font file extensions (.eot, .ttf, etc)
http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
The link has been assassinated by the cruel march of time, so here's a copy/paste of its contents:
The default build action of a file type can be configured in the registry. However, instead of hacking the registry manually, we use a much better approach: pkgdef files (a good article about pkgdef files). In essence, pkdef are configuration files similar to .reg files that define registry keys and values that are automatically merged into the correct location in the real registry. If the pkgfile is removed, the changes are automatically undone. Thus, you can safely modify the registry without the danger of breaking anything – or at least, it’s easy to undo the damage.
Finally, here’s an example of how to change the default build action of a file type:
[$RootKey$\Projects{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\FileExtensions.spark]
"DefaultBuildAction"="Content"
The Guid in the key refers to project type. In this case, {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} means “C# projects”. A rather comprehensive list of project type guids can be found here. Although it does not cover Visual Studio 2010 explicitly, the Guids apply to the current version as well. By the way, we can use C# as the project type here, because C# based MVC projects are in fact C# projects (and web application projects). For Visual Basic, you’d use {F184B08F-C81C-45F6-A57F-5ABD9991F28F} instead.
$RootKey$ is an abstraction of the real registry key that Visual Studio stores the configuration under:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config
(Note: Do not try to manually edit anything under this key as it can be overwritten at any time by Visual Studio).
The rest should be self explanatory: this option sets the default build action of .spark files to “Content”, so those files are included in the publishing process.
All you need to do now is to put this piece of text into a file with the extension pkgdef, put it somewhere under
%PROGRAMFILES(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions
(on 64-bit systems) or
%PROGRAMFILES(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions
(on 32-bit systems) and Visual Studio will load and apply the settings automatically the next time it starts. To undo the changes, simply remove the files.
Visual Studio does publish font files. In a special case we renamed extensions from .ttf to .jpg and they got published.

Resources