I'm working on an installer that needs to add several files to AVR Studio 5, an IDE developed by Atmel that is based on the Visual Studio Isolated Shell. These files include project templates for the "New Project" dialog.
By experimenting, I found that I can successfully add the project templates and get them to show up in the dialog if I simply copy them into C:\Program Files (x86)\Atmel\AVR Studio 5.0\ProjectTemplates\ and then delete or rename C:\Program Files (x86)\Atmel\AVR Studio 5.0\ProjectTemplateCache\cache.bin. I have not been able to find any good documentation on how the Visual Studio ProjectTemplateCache folder works. It seems to contain the same files as the ProjectTemplates folder, plus the cache.bin file, so I'm not sure why it would be useful. After I rename cache.bin, Visual Studio does not regenerate it, which makes me worried that renaming it might have some permanent consequences. Is renaming cache.bin a bad idea? What problems can it cause?
Is there another, easy way to install new project templates? Ideally I would like something that is easier than creating a Visual Studio Extension (.vsix) file, as recommended in this previous StackOverflow question: Installing a custom project template with Visual Studio Installer project
The installer I am working on uses NSIS, if that matters.
For my isolated shell I copy my template .zip files to 'Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates' and '\ItemTemplates'. I then run my isolated shell with the command line '/installvstemplates'. This rebuilds the caches and when you next run the isolated shell, they show up properly.
I also had to target the isolated shell in my extension manifest files.
Have you tried any of these?
If per user project templates are fine, you can drop them in <My Documents>\AVRStudio\Templates\ProjectTemplates.
Related
I am running Visual Studio 2012 (version 11.0.50727.1)
I have been trying to install https://jsonsource.codeplex.com/, a tool to allow JSON data to be imported using SSIS. To install this, once I have copied the dll's into the correct folder, I need to register them using gacutilexe. this is where my problem starts. I am supposed to run Gacutil.exe from the Visual Studio command line. This is supposed to be present in the Start Menu as VS2012 x86 Native Tools Command Prompt (it isn't), I am also supposed to be able to access it using vsvars32.bat (using the add external tools menu in Visual Studio, and supplying the location of vsvars32.bat as an argument). However, I cannot find vsvars32.bat anywhere within my C drive.
I have found several versions of GacUtil.exe in various subfolders of C:\program files(x86)\Microsoft SDKs\Windows, although the installation guide lead me to believe it should be in C:\Program Files\Microsoft SQL Server\120\DTS\PipelineComponents, i.e. where I copied the dll's for the tool I am installing. I'm not sure which of these (if any) I should be using once I get to the visual studio command prompt. Could do with advice here as well.
vsvars32 is meant to be somewhere within C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools, but it is definitely not present any where within the Visual Studio folder.. There are also folders for Visual Studio 9 and 10, but these do not contain vsvar32 anywhere within them either.
if anyone could help I would be very much indebted - My options as to how to deal with the JSON source files otherwise are extremely limited. (using Management Studio 2012 rather than 2016, so can't use OPENJSON. If anyone can suggest any alternatives, let me know. This includes just any option to get the entire JSON file file into a cell - I could probably build some kind of extensive string manipulation to script to split it all out once I've got them in there, although this seems like entirely the wrong way to go about things...)
The first time you install the 3rd party package in Nuget Package manager, it will automatically download the .dll to your user temp folder, once you close it, it will gone, but it will register for you. If you need to find where the exactly location is, simply double click that new added .dll in solution window, if you try to reinstall, but it does not allow you to do that, delete the package.config file, and try to reinstall that package. Once that is added again, do not forget to double click that .dll, to see where is reside, move to your own folder, register using gacutil -i command, and should be good.
When I select menu add - new item in my project on solution explorer in Visual Studio 2015 and want select new class template i see duplication this template. How to fix it?
Besha,
I've encountered the same problem, which as I'm sure is caused by Xamarin item templates. These templates use the same definitions as native VS studio templates, e.g.:
Name Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2245"
Thus, when VS shows you the items it ends up with duplicate names.
To fix the problem I've scanned all the template files (*.vstemplate) containing the mentioned above GUID and replaced the Name element with a text that suites my needs. E.g. for the Xamarin class I've changed it to be:
Xamarin C# class
instead of Package=".....
Note, that VS uses caching of templates and the caching is different for VS native templates and third party templates. In case of Xamarin, there will be ZIP files containing the templates and cached files with templates extracted from the archives. E.g.:
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\3.11.785.0\T\~IC\IT\Code\GeneralClass.zip\
will contain the extracted templates, while the original archive is there:
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\3.11.785.0\T\IT\Code\GeneralClass.zip
Your goal is to find the non-cached templates and change the Name element there.
Once you've found and fixed the name element, close Visual Studio, launch the command prompt as administrator, go to the
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE folder
and run the following command:
devenv /installvstemplates
It will take a while.
Hopefully, after that you won't see duplicated class items.
Regards.
If you have Xamarin/Xamarin Studio installed (and don't use it), you can also just simply uninstall it, removing the class templates. Unity by default installs Xamarin Studio, and I simply remove it as I develop Unity projects with Visual Studio.
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.
So I have a handful of Visual Studio projects that I need to move to another computer. Is it as simple as a copy and paste or will that mess something up? Both machines will have the same version of Visual Studio installed, so that shouldn't be an issue.
Is there an export function that I've overlooked?
If the Visual Studio version is the same, you can just copy the project folder.
Till the time you are moving your solution file and associated files you should be good.
In case you are using any source control update your solution from there.
Hope you have the same VS version and any addon frameworks you have
You can directly copy the project to the projects folder. This worked perfectly for Visual C++ projects for me (and also some other projects). But when I copied my Cordova App from one PC to the other (Both had Visual Studio 2015), I wasn't able to open the project. Whenever I tried to open the project, trying both the ways - directly from the Project file and the open option in Visual Studio, it at first opened but when I tried to open a file, it just got hung and didn't respond.
This problem may occur because Cordova apps have some configuration files that might be different for different PCs. I am not sure that this is the reason for the problem.
A solution that I used was that I created a new Project and copied the files to the project folders (excluding the configuration files).
Can you save the file to cloud? if so then you could potentially upload the file to cloud and download the file to the new
I've been modifying the VS2010 item and project templates so each time we do a "new project" or "new item" we get it created in a format that works for us. This is all working fine; if we create a new class library we get it with the references we've set up and it doesn't create the "class1.cs" file - that all works. We've made a similar change to the TestProject.zip file that lives in:
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\ProjectTemplates\CSharp\Test\1033
Gone through the same process of zipping it back up, copying it over top of the original and refreshing the cache. However for the test project we can't stop it creating the default "unittest1.cs" file. All of our other changes to the test project are working fine but we just can't stop it creating the "unittest1.cs" file. It was never in the template or csproj file originally so I'm not sure what is creating it.
Can anyone help? What creates the default test file for the test project - I'm wondering if it's a reference to the wizard that is in the template file but have no idea what changes would be needed.
Close Visual Studio
Extract BasicUnitTest.zip from:
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\ItemTemplates\CSharp\1033
Open BasicUnitTest.vstemplate
Remove <ProjectItem ReplaceParameters="true">UnitTest.cs</ProjectItem>
Zip BasicUnitTest.vstemplate into BasicUnitTest.zip (excluding UnitTest.cs)
Go to:
C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\ItemTemplatesCache\CSharp\1033
Delete UnitTest.cs and replace BasicUnitTest.vstemplate with your modified copy
On the next run of Visual Studio you should see the modified UnitTest
Though you can do this for every default template, I recommend creating a new template based on the BasicUnitTest.zip instead of overriding the ones shipped with Visual Studio. It's easier, safer and won't be overwritten by future service packs.