Updating a private gallery Visual Studio Extension - visual-studio

We have a Visual Studio Extension that we host in a private gallery. Having installed the initial version, if one returns to the Extension And Updates page, one sees it listed in the list of Installed extensions. Highlighting it shows the [Disable] and [Uninstall] links and in the right-hand pane, one sees the correct 'Created By', 'Date Installed', 'Version' and the 'Automatically update this extension' is checked.
When we prepare an update, we do the following release process:
In the AssemblyInfo.cs, we update the 'AssemblyVersion' and 'AssemblyFileVersion' to the next version, e.g. "1.12.1.0"
In the source.extension.vsixmanifest, we update the 'Version' to the next version (for which we use the same value, i.e. "1.12.1.0")
We then sign the VSIX package
We then put the VSIX file on our private gallery
We then update the atom.xml file - more on this later. The atom.xml file happens to exist in the same folder as our VSIX since we only have a limited number of these extensions.
However, the extension doesn't automatically update when you start Visual Studio, nor does it appear as an update when you visit the 'Extensions and Updates'. Users therefore have to be notified of the new version and then manually uninstall the existing one, and install the update.
Okay, I'm pretty sure that there is nothing untoward with the VSIX file itself; I suspect the atom.xml may be at fault. There are several posts on how to author the atom.xml file, but there is a little inconsistency between these, e.g. MSDN, justinmchase, Kornfeld Eliyahu Peter, stackoverflow etc.
Okay. Here is my atom.xml (slightly edited)
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Our Extension Gallery</title>
<id>uuid:b62cf56a-8a60-4eb6-b217-5e2972e01b39;id=1</id>
<updated>2017-02-28T11:57:22Z</updated>
<entry>
<id>MyAssemblyName.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</id>
<title type="text">Description One</title>
<summary type="text">Description Two</summary>
<published>2017-01-31T11:57:22Z</published>
<updated>2017-02-28T11:57:22Z</updated>
<author>
<name>Me!</name>
</author>
<content type="octet/stream" src="http://server/VisualStudioGallery/MyAssemblyName.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>0681eb6c-4275-4d64-9333-dfdabe14f286</Id>
<Version>1.12.1.0</Version>
</Vsix>
</entry>
</feed>
So what of this do we update in the atom.xml?
feed/updated
feed/entry/updated
feed/entry/Vsix/version
Format of the date
In some examples I've seen '2011-04-14T14:24:22-07:00', whilst in
others I've seen '2012-11-06T22:19:45Z'. Does it matter?
I've tried using the "Time" portion as 'T00:00:01Z' just in case there was any confusion between UTC, Server and Client time. No success.
'feed/entry/id' vs 'feed/entry/Vsix/Id'
Have I got the casing correct for these XML elements?
for 'feed/entry/id', I found that to download I needed to have 'MyAssemblyName.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286', but for feed/entry/Vsix/Id it was just '0681eb6c-4275-4d64-9333-dfdabe14f286'.
I feel like I've tinkered with just about every part of the XML but to no avail. I'm sure it's simple....but what that is eludes me.
Thanks
Griff

For 'feed/entry/id', which is A unique id of the entry. It MUST be exactly the same as to id of the VSIX package!
For feed/entry/Vsix/Id, which is the id of the VSIX package.
Please modify them as the same as the product id of your vsix package.

Thanks to Cole Wu's helpful comments, I finally got this to work.
The two IDs needed to match to get the update to work.
So, just to clarify I have the following:
AssemblyInfo.cs
[assembly: AssemblyVersion("1.15.0.0")]
[assembly: AssemblyFileVersion("1.15.0.0")]
source.extension.manifest
ProductID: MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286
Version: 1.15
atom.xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Our Extension Gallery</title>
<id>uuid:b62cf56a-8a60-4eb6-b217-5e2972e01b39;id=1</id>
<updated>2017-02-28T00:00:01Z</updated>
<entry>
<id>MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</id>
<title type="text">Description 1</title>
<summary type="text">Description 2</summary>
<published>2017-01-31T00:00:01Z</published>
<updated>2017-03-01T00:00:01Z</updated>
<author>
<name>Me</name>
</author>
<content type="octet/stream" src="http://server/VisualStudioGallery/application.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>MyApplication.Microsoft.0681eb6c-4275-4d64-9333-dfdabe14f286</Id>
<Version>1.15</Version>
</Vsix>
</entry>
</feed>
feed/entry/id = feed/entry/Vsix/Id = source.extension.manifest.ProductID
feed/entry/Vsix/Version = source.extension.manifest.Version

Related

VSCode to Visual Studio IDE code snippet conversion

Consider the following VSCode code snippet taken from here:
"var set get f m_":{
"prefix": "varsetgetfm",
"body":[
"${1:int} ${2:VARNM};",
"$1 ${2/^(?:f|m)_?([A-Za-z])(.*)|([A-Z].*)$/${1:/downcase}$2${3:/downcase}/}(){return $2;}",
"void ${2/^(?:f|m)_?([A-Za-z])(.*)|([A-Z].*)$/${1:/downcase}$2${3:/downcase}/}($1 val){$2 = val;}"
]
}
Is there a way to convert this and other snippets from VSCode to a format usable in Visual Studio IDE automatically without having to manually figure out the equivalent? Visual Studio IDE seems to have xml based snippets and not json based snippets like VSCode does.
There’s no existing way. There’s however a way and it involves parsing the json and creating the xml needed.
You can use the schema reference link to see json <-> xml, snippet, equivalent.
In other words, make it yourself. Should be fairly easy given that all the details are already documented by Microsoft.
Next day edit:
Take a look at this gif I made . It replicates partially replicates the vscode snippet inside visual studio.
Also, the snippet xml code:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>varsetget</Title>
<Shortcut>varsetget</Shortcut>
<Description>Code snippet testing</Description>
<Author>Dorian</Author>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>the var type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>VARNM</ID>
<ToolTip>the var name</ToolTip>
<Default>VARNM</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[
$selected$$type$$end$ $VARNM$;
$type$ $VARNM$(){return $VARNM$;}
void $VARNM$($type$ val){$VARNM$ = val;}
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
To be able to use it, create a *.snippet file wherever you want on your machine with the code above, then:
Navigate and open the *.snippet file you created
You can now test out the snippet
NOTE: In Visual Studio 2019 the default of inserting a code snippet or moving to the next Declaration Literal is pressing Tab twice as opposed to Visual Studio Code, where only one Tab is needed.
Everything I wrote is from the msdocs or deducted from the examples there.
My last edit:
It looks like you're not out of luck. But I do not have the time to investigate/test further, sadly. https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.package.expansionfunction?view=visualstudiosdk-2019
Also, according to this SO post you basically would have to create your own language, which I personally doubt.
PS: How come the guys at MS q&a didn't suggest this I do not understand...

Redirect to my own website when press "Update" button in Visual Studio - Tools - Extensions and Updates

colleagues.
I created simple VS2015 Extension: myExtension.vsix
Then I created .msi installer (used WIX and this article)
It's OK! I installed my Extension and it works.
I created local private MyLocalGallery.xml and registered myExtension.vsix in it
As a result I see installed myExtension in Tools - Extensions and Updates - Online - MyLocalGallery
I increase version for myExtension in MyLocalGallery.xml => I saw my update and the button UPDATE here: Tools - Extensions and Updates - Updates
QUESTION:
I press update, VS takes
<content type="application/octet-stream" src="Extensions\myExtension.vsix" />
from MyLocalGallery.xml and makes update. But... I want VS to make redirect to my own website where users can download .msi (not .vsix)
How can I ask Visual Studio to go to my URL???
If I remove this element
<content type="application/octet-stream" src="Extensions\myExtension.vsix" />
button UPDATE is present, I click it but nothing happens.
If I set .msi file, I get error ("The file is not a valid VSIX package")
<content type="application/octet-stream" src="Extensions\myExtension.msi" />
May be it's very trivial issue, but I spent a lot of time trying to do it.
I can't find answer and hope you help me. Thank you
I found the answer accidentally!
This question helps me
So we should add element to our entry in MyLocalGallery.xml:
<entry>
...
<title type="text">my extension</title>
...
<link rel="update" type="text" href="http://example.com/install.msi"/>
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
...
</Vsix>
And when we click Download or Update then VS redirect us to http://example.com/install.msi
Also we should remove this element from the feed xml (because it has higher priority)
<content type="application/octet-stream" src="Extensions\myExtension.msi" />

Update Private Gallery atom such that VS shows that an extension update is available

I'm using a Visual Studio Private Gallery to publish a VSIX internal to my company. My VSIX shows up in the "Online" section of "Extensions and Updates" in Visual Studio 2012 and I can install it from there:
However, once it's installed, I can't figure out how to update my extension in a way that makes it show up in the "Updates" section of that same dialog box, nor can I figure out how to make Visual Studio notify me that an update is available.
I've tried various combinations of the following:
Increasing the version number in the VSIX itself and in the atom.xml
Changing the updated tag inside of the entry tag to the current date and time
Changing the updated tag inside of the feed tag to the current date and time
Changing the published tag inside of the entry tag to the current date and time
My expectation was that a combination of 1, 2, and 3 should be enough to show that there is an update, but to no avail. This guide seems to confirm my expectation:
Published - The date/time when the extension was added.
Updated - The date/time when the extension was last updated.
I've also tried all 4 at the same time, also to no avail.
I'm serving the gallery from an Apache instance, and I've confirmed that it's setting a correct Last-Modified header for the atom.xml .
Is there some interval at which Visual Studio checks for updates? Does opening the "Updates" section of "Extensions and Updates" not force Visual Studio to check?
Here's the contents of my atom.xml:
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Visual Studio Extension Gallery</title>
<id>uuid:CDC295B0-7885-4B59-9BDF-F059A9F4B338;id=1</id>
<updated>2013-12-11T19:00:00Z</updated>
<entry>
<id>MyVSIX..b242c6de-d0a6-4ba1-9672-b866e36607d3</id>
<title type="text">MyVSIX</title>
<summary type="text">MyVSIX is a nifty extension that does things.</summary>
<published>2013-12-11T19:00:00Z</published>
<updated>2013-12-11T19:00:00Z</updated>
<author>
<name>daxelrod</name>
</author>
<content type="application/octet-stream" src="vsix/MyVSIX.vsix" />
<Vsix
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010"
>
<Id>MyVSIX..b242c6de-d0a6-4ba1-9672-b866e36607d3</Id>
<Version>0.5</Version>
<References />
<Rating xsi:nil="true" />
<RatingCount xsi:nil="true" />
<DownloadCount xsi:nil="true" />
</Vsix>
</entry>
</feed>
I should also note that my extension is not Strong Name Signed, because it uses a third party assembly that is unsigned. Does that make a difference?
I had the same Issue and made some deep investigation. In my case it was odd, that my extension always shown as "Download" in the Private Gallery instead as "Installed" (the Green Hook). So I guessed there is a missing Link between the Gallery item and the installed Item
The answer is as simple as annoying:
The ID has to be "THE ID".
So the Product ID (in the VSIX Configuration) is the reference which has to be in the Atom-File.
In Your case:
<Vsix>
<Id>b242c6de-d0a6-4ba1-9672-b866e36607d3</Id>
</Vsix>
As you see: Withyout your "MyVSIX..".
After that it will recognize your Extension and if installed also hide the "Download" Button within the Gallery
For Update:
It's enough if you increase the < Version > Content.
For The Update Cycle (my experience):
It checks on start of the Visual Studio (once Daily, if in Option enabled)
It checks every time you open the "Extensions and Updates". So reopen after a save of the XML should be enough.
EDIT: (thanks for the Upvote)
Here the Pictures for better understaning (made in VS2013, but almost same for VS2012)
The ID in the VSIX File.
How it should look like in the Atom-Feedfile.
<Vsix>
<Id>d4d50729-a612-4260-9b2e-3a61ad5e2207</Id>
</Vsix>
How it should look if you correctly linked between Gallery and VSIX File.
We tried to use an atom.xml in a private gallery for an automatic update. It did not work at all, even after removing the name from the ID in the VSIX tag. We are using a package developed for VS 2015.
Then, looking more carefully, we realized that the ID of the package class, that is also present in the vsct file, is different from the ID defined in the manifest file: source.extension.vsixmanifest. While the first is a pure GUID the second is a concatenation of the name, producer and another GUID.
Something like:
MyVSIX.MyCompany.GUID (in form of xxxxxxxx-xxxx...)
When we used the second one, everything worked perfectly. We even managed to update packages that were previously installed by double-clicking the vsix file.
I want to thank you as this article was a very good start to solve our problem.
All the best,
Dan Vasilescu
it looks like VS only checks for updates once a day, but I wasn't able to get it to detect an updated extension in an Atom gallery.

Language based installation description

As you all know, once you have installed an extension in the Joomla backend, the description shows. You can either have a plain description from the XML or have a language based one. I have never had problems in the past with language based descriptions however this time I do. The extension is a admin component and has no frontend folder and is for Joomla 2.5.
When I install the component, the description appears as COM_PROJECTS_DESC
The language folder and files are in the correct location and the XML shows as
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5.0" method="upgrade">
<name>Projects</name>
<author>JoomJunk</author>
<creationDate>15th Jul 2012</creationDate>
<copyright>Copyright (C) 2012 JoomJunk</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html</license>
<authorEmail>admin#joomjunk.co.uk</authorEmail>
<authorUrl>http://www.joomjunk.co.uk</authorUrl>
<version>1.0.0</version>
<description>COM_PROJECTS_DESC</description>
<administration>
<menu img="components/com_projects/assets/images/cpanel_16.png">COM_PROJECT_TO_DO</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>controller.php</filename>
<filename>helper.php</filename>
<filename>projects.php</filename>
<folder>views</folder>
<folder>tables</folder>
<folder>models</folder>
<folder>controllers</folder>
<folder>assets</folder>
</files>
<languages folder="admin">
<language tag="en-GB">languages/en-GB/en-GB.com_projects.ini</language>
<language tag="en-GB">languages/en-GB/en-GB.com_projects.sys.ini</language>
</languages>
</administration>
</extension>
The odd thing is, the description doesnt work when installing for the first time, but if I install the coomponent over it (upgrade) then it does work.
I have used the language debug tool the the language file seems to be loading so Im not sure what the problem is. I has only ever happend to me with extensions specifically for the admin backend and that have no frontend referrence.
Any help would be much apreciated.
Regards
You can display the installable description text and if you need to install any sample values through install.joomjunk.php.
I think this link will be helpful for you.
http://docs.joomla.org/Using_the_installer_API_to_support_package_installation

Will Firefox do XSLT on external entities?

What I'm trying to do is take an XML document, let's say http://example.org/data.xml and show it with an XSL stylesheet applied.
(I cannot modify the document itself and add a directive)
So there are a couple of utility XML files like this:
wrapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wrapper [
<!ENTITY content SYSTEM "http://example.org/data.xml">
]>
<?xml-stylesheet type="text/xsl" href="unwrap.xsl" ?>
<wrapper>
&content;
</wrapper>
unwrap.xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="stylesheet.xsl"/>
<xsl:template match="/wrapper/node()[1]">
<xsl:apply-imports/>
</xsl:template>
</xsl:stylesheet>
So to summarize: stylesheet.xsl is written for http://example.org/data.xml, the browser is pointed to wrapper.xml and the user should see the transformed http://example.org/data.xml.
This is one of those rare cases where things work as expected in IE (and Chrome) but not Firefox.
AFAIK Firefox supports external XML entities, but it seems like they are invisible in XSL code. I found this article from 2006, it describes this problem in Firefox 1.5 (I'm using 3.5.3)
Is there any workaround for this?
That XML looks familiar ;)
Currently, FireFox will not load external DTD's and entity references, because of security and Denial of Service concerns. For example: http://en.wikipedia.org/wiki/Billion_laughs
There is an open Mozilla bug describing the reasons why and lengthy debate about whether or not to make it something that is configurable: https://bugzilla.mozilla.org/show_bug.cgi?id=22942
There does appear to be one workaround to loading DTDs, but I'm guessing that probably isn't a viable solution for you.
Firefox will load local DTD files
if you put them in this directory for Windows:
C:\Program Files\Mozilla Firefox\res\dtd\...
The directory for Linux:
/**mileage may vary**/MozillaFirefox/lib/res/dtd/
One idea to get around using the entity reference:
If you can control the content of the wrapper.xml, then you could fetch the contents of http://example.org/data.xml (server side) and echo it out as the full contents of the wrapper file, with the addition of the Stylesheet Processing Instruction(assuming you have some dynamic server-side capabilities).

Resources