updating Visual Studio templates on new release of jQuery (and other libraries) - visual-studio

Now that Visual Studio => 2010 has jQuery support, I'm wondering how I can update the project template when a new jQuery release comes out? Currently when you create a project, it automatically creates the 1.4.1 files (in VS2010), but jQuery is ever evolving, and often updates it version.
How can I tell Visual Studio to use the more recent version of jQuery (or other libraries for that matter)?

You can use NuGet
right-click on your project in Solution Explorer
click on "Manage NuGet Packages" in context menu
type "jQuery" in the search box on the top right corner of the dialog box
press Enter key and wait for results
look for "jQuery" in the results, SELECT it and click "Install" button
(after installation, you previous jquery and related files will be replaced with the latest ones)
Alternatively, you can create an Empty project and install the the nuget package(s) through the Package Manager Console. This can include ALL of the libraries that you default to.
PM> Install-Package jQuery
From there, save it as a new template, and whenever you create a new project, simply run the following terminal command before starting work.
PM> Update-Package
more info on Update-Package

You can create a new project template with jQuery 1.4.2 included: http://msdn.microsoft.com/en-us/library/ms247120%28v=VS.100%29.aspx

Automatic update have some issues. If you are using jQuery library with some additional plugin and they depend on the previous jQuery library framework then they will not work. That is why you need to think carefully before updating the jQuery library from version to version.
UPDATE:
You could modify an existing template for Visual Studio which will allow you to refer to the new version of jQuery. Here is an article about creating custom Visual Studio templates.
http://msdn.microsoft.com/en-us/library/ms247119(v=VS.80).aspx

This whole Nuget/update version model in JQuery is a huge mess! (Who designed this system?)
What I do is simply avoid the JQuery template piece in Visual Studio and place the current JQuery javascript links in ONE PLACE in your web project so its pasted into every single page......either the MVC Layout page, usercontrol, or masterpage. You can mix and match controls. But it doesnt matter as modern browsers cache these files after the first download anyway.
Now when you do a JQuery update, you can fix it in one simple place in your web project. All ECMAscripts have been done this way anyway the past 15 years using server side includes or other strategies. I'm still not sure why you want a template to stuff links in hundreds of view pages in MVC you now have to customize one by one when you get different versioned files names. I think ASP.NET MVC has gone backwards in its design for that reason.

Related

ASP.NET MVC Custom View Path breaks Visual Studio shortcuts

I've seen a lot of articles on how to change the default paths for an ASP.NET MVC project so you can relocate or rename your Controllers, Models, and Views folders by extending the RazorViewEngine and specifying new path formats.
So far, this works great but the side-effect is that it has broken the Visual Studio shortcuts for "Go to View" or "Add View...".
Any ideas on whether those shortcut options can be customized to know about the new paths I've specified?
Thanks in advance! - Scott
The Visual Studio features cannot be extended to support custom paths. However, in the ASP.NET and Web Frameworks 2012.2 update that will soon be released (you can download a preview right now from here), the Add View functionality was updated to be a lot more flexible regarding which folders will have it enabled and which won't. It now supports Add View in any folder that is anywhere under a folder called "Views".
Regarding Go To View, that was not updated because unfortunately there is no way for the VS tooling to be aware of runtime customizations made to the view engine - I agree it would be cool, though!
(BTW my source for this information is that I work on ASP.NET MVC at Microsoft.)

Unable to update Nuget Package for JQuery

I have a project in VS 2010 and using Visual Source Safe 2005 for source control system. Whenever I try to update my NuGet Package. It shows "Installed" but, there are a lot of red color lines that appear and go as Nuget is isntalling packages.
I assume the installation is not correct for this. Can anybody help on this?
It looks like it's failing to uninstall a previous version of jquery ui because it has been modified from the original.
Try manually delete all the jquery files and remove the package node from the packages.config in the project file.
Because you want to keep your custom jquery ui, but appear to either upgrading all packages or upgrading a package with a dependency on a newer version of jquery you are getting these errors.
If you are just trying to update all packages, and don't have any that rely on jquery ui I would remove it from the packages.config. The files will still be there but no longer managed by NuGet.
If you are trying to upgrade a specific package that has a higher jquery ui dependency, then you can fake that the higher version is installed by editing the config, however the dependency is probably there for a reason and I wouldn't recommend doing this.

Is it possible to provide custom content for the VS2012 Start Page?

Visual Studio 2012 (and 2010, too) has a Start Page that has links and streamed videos. Is it possible for my package to provide content on this page, e.g., create a separate section next to Welcome/Windows 8/etc.?
I finally got a custom start page working in VS2012 - my issue was I could not install the Start Page Project Template in 2012 as the extension only installs on 2010 (which I don't have access to) and my My Documents folder is mapped to a network drive, so putting the raw XAML file in My Documents/Visual Studio 2012/Startpages didn't work as Visual Studio refused to use this "untrustworthy file".
Download the Start Page Template from here.
Rename the file to .zip and extract it.
Copy the "\Solution\CSharp\Extensibility\StartPage.zip" file to your project template folder (by default "My Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#").
Create a new project using this template.
Follow the instructions here to upgrade from 2010 to 2012 start page.
Update the project properties target framework to 4.5.
Update the project references in the Control project by removing the Microsoft.VisualStudio.Shell.10.0 reference and adding the Microsoft.VisualStudio.Shell.11.0 and Microsoft.VisualStudio.Shell.Immutable.11.0 references.
Update the namespaces references in the xaml file by replacing the existing ones with the two below.
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.11.0"
xmlns:vsfxim="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.Immutable.11.0"
Replace the references to vsfx:VsBrushes keys to vs:EnvironmentColors keys, e.g. vsfx:VsBrushes.StartPageBackgroundKey to vs:EnvironmentColors.StartPageTabBackgroundBrushKey
In the VSIX project, make the following changes to the source.extension.vsixmanifest file (values depending on if 2010 support is desired, it is not for me):
Add an author, the default empty tag is not allowed: <Author>Ken</Author>
Change/add the visual studio support version to 11.0: <VisualStudio Version="11.0">
Change the supported runtime edition to include 4.5: <SupportedFrameworkRuntimeEdition MinVersion="4.5" MaxVersion="4.5" />
The VSIX solution should now build and spit out a VSIX file in the project bin folder. Install this and you can now choose your Start Page from the drop down list in the visual studio options.
I haven't actually developed my custom start page beyond this, but hopefully it is a helpful to people wanting to get started developing them with VS2012
EDIT: A project which includes a basic 2012 start page, custom control and can be deployed via VSIX: template
Custom Start Pages, via google:
http://msdn.microsoft.com/en-us/library/aa991992.aspx

How do I remove or disable PHP editor in Aptana Studio 3?

I am trying to install Aptana as an Eclipse plugin for Zend Studio because the HTML/Javascript editor is so much better in Aptana, but I still want Zend Studio to handle PHP. I am receiving an "Unsupported content type in editor" message when I try to edit PHP files. It appears that Aptana is trying to take over my PHP editing. I am not sure if the message is Aptana complaining because the Zend Studio is opening the file or Zend Studio complaining because Aptana wants the file. Obviously, a conflict exists as if I make the Aptana editor the default for PHP or uninstall the Aptana plug in, the message goes away.
I am wondering if I can just completely disable or remove the PHP Plugin from Aptana Studio 3 and see if that solves the issue?
looks like if you install Eclipse Indigo and then add the Aptana 3 addon then you go to the Project Natures in the project preferences you can see a few options:
PHP
Rails
Ruby
Web
org.eclipse.php.core.PHPNature
Disable the first PHP option and rebuild your project. It will work. And you have the zend codeintel as well.
Unfortunately, the Aptana3 plugin does that. It does the same thing with PDT and it's most annoying since there Aptana plugin does other things so beautifully. It would be nice if you could elect which editor to use and have both handle PHP files just fine, but it seems that having more than one editor in Eclipse assigned to PHP causes conflicts. And unfortunately, there is no way to remove just the PHP component from the Aptana Studio plugin.
You could install the Aptana Studio 2, which does not have the PHP editor (I understand) and/or you could install the stand-alone version of Aptana Studio 3 to do the things that you want to do with it and leave the plugin out out of your Eclipse installation, but that's not so ideal, I guess. I'd also love to see a better resolution to multiple PHP editors working nicely in Eclipse (and being able to set one -- i.e., for now, not Aptana -- as primary default).
#Lowell - It's not Aptana Studio fault ;-) Unfortunately, it's a WST issue that is opened forever and not being attended. Since PDT and Zend Studio depends on WST, this problem surface when there is another product that sets up the content-types as they should in Eclipse.
See more details at: https://jira.appcelerator.org/browse/APSTUD-3185 (this one is for the CSS editor, but it's the same with other editors that share same file-extensions. See Max Stepanov's explanation on the bottom).
Removing the project natures that were contributed by Aptana is a partial workaround. You can right-click your PHP project and select Properties, navigate to the Project Natures item and un-check the 'PHP' nature. After that, you will be able to open the PHP files with Zend Studio's editor. However... it's only a partial workaround because you'll still need the Zend's PHP Nature there in order to have Zend's project management work correctly (e.g. indexing, content-assist etc.).
So... a close-to-complete workaround would be to create a PHP project using Zend PHP project wizard (not Aptana's). Then, after the project was created, follow the natures instructions above and add the Aptana's Web nature to enable the HTML, JS and CSS goodies.
Hope that helps...

Visual Studio Isolated Shell Toolbox not being updated after uninstall/install of new package version

I am developing a DSL package that has a number of toolbar items. If I add a new toolbar item in the DSL explorer install the new package into the Visual Studio isolated shell the new items don't appear. I am testing this on a virtual machine first by installing the first version of the package, uninstalling it and then installing the updated version. It seems that the system is somehow caching the old toolbar settings, etc even though a new version of the DSL package assembly is being installed.
Any ideas why the old tool bar items appear and the new ones don't?
Indeed, a cache mechanism is used. The problem doesn't appear if you use a new account to launch your shell.
I don't know the reasons why this problem occurs but here is a workaround to force the toolbox refresh.
Go to USERPROFILE%\Local Settings\Application Data\Microsoft\AppEnv\Apps\YourShell_GUID\
Remove all tbd files (.tbd) (Don't forget that tbd files are hidden files).
Good luck.

Resources