#VS2015 – Publish in Visual Studio Gallery the installer for the Delete all comments in a file with #Roslyn sample extension #VSGallery

Hola!

Final post for the series

Delete all comments in a file with #Roslyn

Create a VSIX installer for the Delete all comments in a file with #Roslyn sample extension

Publish in Visual Studio Gallery the installer

In my last post I described how to create a VSIX package for our delete comments solution. In today post I’ll describe the steps to publish this installer in Visual Studio Gallery.

We need to login into Visual Studio Gallery, https://visualstudiogallery.msdn.microsoft.com/. I’ll use the same account I use in MSDN forums. Let’s start with the [UPLOAD] option

A 3 steps wizard will help us in this process. For this sample I’ll chose the TOOL type

Next step is to define the download type>

– An external Url

– Upload the VSIX file

I’ll choose the 2nd option and I’ll find the next exception:

You can only upload template VSIX files for the Visual Studio Express SKUs.

This error is raised because the default VSIX project template includes a couple of install targets which are not valid for Visual Studio Gallery.

So we leave only VSPro as Install Target.

We need to rebuild and upload again the VSIX file. If we found some build errors, maybe we need to upgrade the version number of our VSIX package.

And we get to the Step 3 of the Publish process. In this step we need to complete the information related to the product, like the source code repository Url of the cost category.

And that’s it! Our extension is available to download from https://visualstudiogallery.msdn.microsoft.com/fe657c84-2077-4092-8063-2cc9587ad0d1

The source code is available in GitHub https://github.com/elbruno/Blog/tree/master/ElBruno.RemoveComments%20V02

Saludos @ Madrid

/El Bruno

References

– Delete all comments in a file with #Roslyn https://elbruno.com/2015/08/17/vs2015-delete-all-comments-in-a-file-with-roslyn/

– Create a #Vsix installer for the Delete all comments in a file with #Roslyn sample extension https://elbruno.com/2015/08/29/vs2015-create-a-vsix-installer-for-the-delete-all-comments-in-a-file-with-roslyn-sample-extension/

– MSDN VSIX Manifest Designer https://msdn.microsoft.com/en-us/library/ee943167.aspx

– MSDN Shipping Visual Studio Extensions https://msdn.microsoft.com/en-us/library/ff363239.aspx

– MSDN Walkthrough: Publishing a Visual Studio Extension https://msdn.microsoft.com/en-us/library/ff728613.aspx

– Creative Commons CC BY http://creativecommons.org/examples#by

– SyncFusion Metro Studio 3 http://www.syncfusion.com/downloads/metrostudio

Advertisements

#VS2015 – Create a #Vsix installer for the Delete all comments in a file with #Roslyn sample extension

Hola!

Some people asked about how hard is to create an Installer for the simple in the post “#VS2015 – Delete all comments in a file with #Roslyn”. Is very easy, so I´ll write a couple of posts with the answer to the question and also later, on how to publish this one to the Visual Studio Gallery.

Let’s start from last post, we go back to the source code and we found 2 projects:

ElBruno.RemoveComments, Roslyn source code to delete all comments

ElBruno.RemoveComments.Vsix, this project is our main one, is the one in charge to create the VSIX package

We need to edit the manifest to define the properties of our extension. The main fields I’ll complete are these ones:

Product Name, Product Id, Author, Version, Description, Language, Preview Image: easy very easy

License: I’ve created one in Creative Commons official page. I copied the generated license in a text file and added into the solution.

Icon: thanks SyncFusion Metro Studio 3 !!!

Getting Started Guide, More Info URL: Easy again, a couple of links to my blog

Important: If you need more information about these fields, please go to MSDN [VSIX Manifest Designer] in the references section.

Let-s go to generate our VSIX package, let´s build the Project in RELEASE mode, and we can get the installer in the output folder

When we run the Vsix Installer, we’ll see the information defined in previous steps.

And a couple of seconds later, we get this extension up and running in our IDE !!!

I’ll describe the steps on how to publish to Visual Studio Gallery, in a future post

As always, source code available in GitHub https://github.com/elbruno/Blog/tree/master/ElBruno.RemoveComments%20V02

Saludos @ Madrid

/El Bruno

References

– Delete all comments in a file with #Roslyn https://elbruno.com/2015/08/17/vs2015-delete-all-comments-in-a-file-with-roslyn/

– MSDN VSIX Manifest Designer https://msdn.microsoft.com/en-us/library/ee943167.aspx

– Creative Commons CC BY http://creativecommons.org/examples#by

– SyncFusion Metro Studio 3 http://www.syncfusion.com/downloads/metrostudio

#VS2015 – Crear un instalador para la extensión que borra todos los comentarios utilizando #Roslyn

Hola!

Como algunas personas me preguntaron qué tan complicado era crear un paquete de instalación para el ejemplo “#VS2015 – Borrar todos los comentarios en un Click con #Roslyn”, hoy mostraré los pasos a seguir para crear el paquete de instalación y publicar el mismo en Visual Studio Gallery.

Comenzamos desde el punto anterior, donde podíamos ver que la solución contiene 2 proyectos:

ElBruno.RemoveComments, con el código específico de para eliminar los comentarios

ElBruno.RemoveComments.Vsix, este proyecto es el que se encarga de crear el paquete de instalación VSIX

En el proyecto de VSIX editaremos el manifiesto para completar la información del mismo . Los campos principales que completaremos son los siguientes:

Product Name, Product Id, Author, Version, Description, Language, Preview Image: son auto descriptivos

License: he generado una de tipo Creative Commons en la página oficial. Luego he creado un archivo de texto con la misma, y la he agregado a la solución.

Icon: generado con SyncFusion Metro Studio 3

Getting Started Guide, More Info URL: estas son fáciles, las he tomado de los posts que he escrito en mi blog

Importante: Una descripción completa se puede encontrar en el link de MSDN [VSIX Manifest Designer] en la sección de referencias.

El siguiente paso es generar nuestro paquete de instalación, para esto compilamos el proyecto VSIX en RELEASE, y en la carpeta de compilación podremos encontrar el instalador

Si lanzamos el instalador, veremos los detalles que definimos en los pasos anteriores

Y en pocos segundos, ya tenemos el instalador como parte de nuestro IDE

En el próximo post de la serie mostraré como publicar el paquete en Visual Studio Gallery

El código del ejemplo se puede descargar desde GitHub en https://github.com/elbruno/Blog/tree/master/ElBruno.RemoveComments%20V02

Saludos @ Madrid

/El Bruno

References

– Borrar todos los comentarios en un Click con #Roslyn https://elbruno.com/2015/08/17/vs2015-borrar-todos-los-comentarios-en-un-click-con-roslyn/

– MSDN VSIX Manifest Designer https://msdn.microsoft.com/en-us/library/ee943167.aspx

– Creative Commons CC BY http://creativecommons.org/examples#by

– SyncFusion Metro Studio 3 http://www.syncfusion.com/downloads/metrostudio

#VS2015 – Delete all comments in a file with #Roslyn

Hola!

Today is time for some Roslyn code, one more time to delete all the comments in a C# source code file. The step by step on how to create a project of Roslyn, is in the references section in [Roslyn – Creating an enter and initialize field refactoring]. For this sample, we will seek comments elements in a C# source code file. To do this, in the entry point [ComputeRefactorUsing], we’ll look for items with the type SyntaxTrivia. This will run from the current cursor position with the DescentantTrivia() function (line 18)

SyntaxTrivia type elements identify everything that is “not important for the compiler” like jumps of line, comments, etc. (yes, I know you must kill me after the previous statement) In this sample, we will validate that there are elements of the type comments to show the option in the IDE (line 24). Then we will call the command [Remove comments] and associate it with a RemoveAllComents() operation. In this operation, we will again get all elements of type SyntaxTrivia and process them at the level of the document root with the ReplaceTrivia() operation. In one of its overloads, this operation uses 2 parameters to process the replacement.

For this example, we will just replace the line if the Trivia is of the type SingleComment or MultipleComment (line 40). Replace this line by a jump of truck and we can give for closed operation.

In the following video we can see 2 animations, where the 1st one executes the code in the sample, and the 2nd shows a Preview of a replacement eliminated all elements of type SyntaxTrivia.

The sample code can be downloaded from GitHub at https://github.com/elbruno/Blog/tree/master/ElBruno.RemoveComments

Saludos @ Madrid

/El Bruno

References

– Roslyn https://github.com/dotnet/roslyn/wiki/Roslyn%20Overview#syntax-trivia

– Roslyn – Creating an introduce and initialize field refactoring http://trydis.github.io/2015/01/03/roslyn-code-refactoring/

– Roslyn SyntaxTrivia https://github.com/dotnet/roslyn/wiki/Roslyn%20Overview#syntax-trivia

– Roslyn ReplaceTrivia()http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/CSharpExtensions.cs,b3247464908d9e7a

– Roslyn SyntaxFactory http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/Syntax/SyntaxFactory.cs

#VS2015 – Borrar todos los comentarios en un Click con #Roslyn

Hola!

Hoy toca ver un poco de Roslyn para eliminar los comentarios de un archivo. El paso a paso sobre cómo crear un proyecto de Roslyn, está en la sección referencias [Roslyn – Creating an introduce and initialize field refactoring]. Para este ejemplo, lo que buscaremos serán elementos del tipo comentarios en C#, así que en el punto de entrada [ComputeRefactorUsing], buscaremos elementos del tipo SyntaxTrivia, a partir de la posición del cursor con la función DescentantTrivia() (línea 18)

Los elementos de tipo SyntaxTrivia identifican todo aquello que no es importante para el compilador, como saltos de línea, comentarios, etc. En este ejemplo, validaremos que existan elementos del tipo comentarios para mostrar la acción disponible (línea 24). A continuación creamos el comando [Remove comments] y lo asociamos a una operación RemoveAllComents(). Dentro de esta operación, obtendremos nuevamente todos los elementos de tipo SyntaxTrivia y procesaremos los mismos a nivel del documento root con la operación ReplaceTrivia(). En una de sus sobrecargas, esta operación utiliza 2 parámetros para procesar el reemplazo. Para este ejemplo, solo reemplazaremos la línea si el Trivia es del tipo SingleComment o MultipleComment (línea 40). Reemplazamos esta línea por un salto de carro y podemos dar por cerrada la operación.

En el siguiente video podemos ver 2 animaciones, donde la 1ra ejecuta el código del ejemplo, y en la 2da se muestra un Preview de un reemplazo eliminado todos los elementos de tipo SyntaxTrivia.

El código del ejemplo se puede descargar desde GitHub en https://github.com/elbruno/Blog/tree/master/ElBruno.RemoveComments

Saludos @ Madrid

/El Bruno

References

– Roslyn https://github.com/dotnet/roslyn/wiki/Roslyn%20Overview#syntax-trivia

– Roslyn – Creating an introduce and initialize field refactoring http://trydis.github.io/2015/01/03/roslyn-code-refactoring/

– Roslyn SyntaxTrivia https://github.com/dotnet/roslyn/wiki/Roslyn%20Overview#syntax-trivia

– Roslyn ReplaceTrivia()http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/CSharpExtensions.cs,b3247464908d9e7a

– Roslyn SyntaxFactory http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/Syntax/SyntaxFactory.cs

[#VS2015] String Interpolation vs String.Format (your team will love you)

Hello!

I was trying to use Visual Studio 2015 as my main development IDE for a while. The new versions are more stable, so I use it more and more and I’ve not opened Visual Studio 2013 for a while.

One of the best features in VS2015 is Roslyn as main compiler for .Net. This opens a new world of possibilities for writing code in a more elegant way. One of these options is the ability to use String Interpolation instead of the classic String.Format () .

If anyone would not read the Wikipedia link or study a little, maybe it is best see the following lines of code

Note: if did not know it the ability to use String Interpolation was in the Top 10 of the most requested features to the new version of Visual Studio (link)

As the saying goes for taste colors. To my personally I like this format to work with Strings. And I believe that the recommendation of use is very clear…

Do not use String Interpolation if you are sharing code with a team where there are people who use Visual Studio 2013.

You can also find with wonders like this

Clipboard02

Saludos @ Madrid

/El Bruno

References:

Roslyn, https://github.com/dotnet/roslyn

String Interpolation, http://en.wikipedia.org/wiki/String_interpolation

String Interpolation User Voice, http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2312991-string-interpolations-in-c

[#VS2015] String Interpolation vs String.Format (o como arruinarle el día a tu equipo)

Hola !

Desde hace un tiempo intento utilizar Visual Studio 2015 como mi herramienta principal de desarrollo. A medida que las versiones se van estabilizando, lo utilizo cada vez más y desde hace un tiempo no he vuelto a Visual Studio 2013.

Una de las mejores features que tiene VS2015 es que ahora compila con Roslyn y claro, esto abre un mundo de posibilidades para escribir código de manera más elegante. Una de estas opciones es la capacidad de utilizar String Interpolation en lugar del clásico String.Format().

Si alguno no no quiere leer el link de Wikipedia o estudiar un poco, pues lo mejor es ver las siguientes líneas de código

Nota: por si no lo sabías la capacidad de utilizar String Interpolation estuvo en el Top 10 de las features más pedidas para la nueva versión de Visual Studio (link)

Como dice el dicho para gustos colores. A mi personalmente me gusta el formato este para trabajar con Strings. Y creo que la recomendación de uso es muy clara …

No uses String Interpolation si estas compartiendo código con un equipo donde hay gente que usa Visual Studio 2013. 

Te puedes encontrar con maravillas como esta

Clipboard02

Saludos @ Madrid

/El Bruno

References:

Roslyn, https://github.com/dotnet/roslyn

String Interpolation, http://en.wikipedia.org/wiki/String_interpolation

String Interpolation User Voice, http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2312991-string-interpolations-in-c

[#GITHUB] #Roslyn family will move to #GitHub, one more time thanks #Microsoft!

Hello!

When .Net and Mono “moved” to Open Source, I have to write a post because I think of the type of actions that really demonstrate the commitment of Microsoft to the developers community. Aside from the Open Source stuff, GitHub is the most popular platform used in the developers community, so it makes sense to move all the content. If you want the developers to participate, for sure GitHub will be in a more natural environment. I also wrote about this in this post, where I mentioned as SignalR, Asp.Net and others are on this platform.

Clipboard01

Well, this week is Roslyn which moves to GitHub, and in this case from CodePlex. This news we can see directly from the home of the Roslyn in CodePlex site ! And of course, I have to go to the C# team and Visual Basic team blogs to check if the complete family will move.

Visual Basic Team, We’re moving to GitHub!

C# FAQ, We’re moving to GitHub!

Good news! Now just wait for it to begin to give a chance to more and more relevant to StackOverflow about MSDN forums 😀

Greetings @ Home

/El Bruno

Source: https://roslyn.codeplex.com/

[#GITHUB] Todo #Roslyn se mueve a #GitHub, one more time thanks #Microsoft !!!!

Hola!

Cuando .Net y Mono se “movieron” a Open Source, me sentí obligado a escribir un post porque me parece del tipo de acciones que realmente demuestran el compromiso de Microsoft con la comunidad de developers. Dejando de lado el tema Open Source, GitHub es la plataforma más utilizada por la comunidad de developers, asi que tiene sentido mover los contenidos allí ya que, si los developers comienzan a participar, será en un entorno más natural. También escribí sobre esto en este post, donde comenté como SignalR, Asp.Net y otros ya están en esta plataforma.

Clipboard01

Pues bien, esta semana será Roslyn el que se mueva a GitHub, y en este caso desde CodePlex. Esta noticia la podemos ver directamente desde la home del site de Roslyn en CodePlex !!! Y claro, fue buscar en los blogs de los equipos de C# y Visual Basic para ver que la familia se muda completa.

Visual Basic Team, We’re moving to GitHub!

C# FAQ, We’re moving to GitHub!

Good news !!! Ahora solo queda esperar que se comience a dar una oportunidad mayor y más relevante a StackOverflow sobre lso foros de MSDN 😀

Saludos @ Home

/El Bruno

Fuente: https://roslyn.codeplex.com/

[#VS2015] A little about #Roslyn, #ReSharper 9.0 RTM available and now is part of a very cool suite ;)

Hello!

With the arrival of Roslyn, Visual Studio 2015 as IDE was able to take a big step and incorporate some tools that are in the line of “code / syntax helpers” very similar to the ones we know in ReSharper. For example, the Syntax Tree Visualizer is an interesting one. Also, now that compilers for C# and VB.Net are open source, the creation of these extensions is something that we will certainly see much in the future. (it is only necessary to navigae here once in a while)

For example, the typical action of “remove unnecessary usings” is now much more complete when we deploy it.

RS 01

We can see that in addition to a menu where it offers us the action of removing the unnecessary usings, we also have the option to do it at the level of file, project, or solution. Another scenario where we can change a concatenation of strings horrilble to use a string.format () is also possible, in this case thanks to Refactory.One

rs 04

As I said before, this kind of actions we know them of ReSharper.Y clear, as always in these cases ‘pressure’ passes to extension to see with that is surprising in the new version. In this case in version 9, the first thing that will get us attention is that ReSharper is no longer an isolated product and becomes part of “JetBrains .net Tools“. What personally I seems great. The JetBrains guys typically make very good products and have a same installer R #.dotTrace, dotCover and dotPeek, is already on a great idea.

RS 02

And then he comes to see the new ReSharper 9. The first thing we find is obvious: support for Visual Studio 2015.And of course, in addition to actions “basic” friends of JetBrains give an overview of C# 6.0 with new features and more than interesting scenarios (here there is a full post on the subject).

This is the complete listing of new features, and although I haven’t used it much there are a couple of features that are interesting

-Regular Expression Validator

Needless to say that I belong to 99% of the population to Hate regular expressions. Although they can be something very useful for basic tasks like validate an email, when we started using for replaces strange, since SkyNet begins. There are many tools to validate regular expressions (e.g. RegExBuddy), now well of R # has the touch of JetBrains and is very well integrated within the IDE.

rs 05

-Fix in Scope

As before, I mentioned that the fix of usings supports such actions to level document, project, or solution. Now see as R # improve it a little more and give us these options for the “Fix in Scope”.

rs 06

The best is that the trial is still 30 days, now with the option to “pause” the same. For example in the weeks of Christmas where it will not work neither the tato 😉

rs 07

Greetings @ Madrid

/El Bruno

Bonus Track.

Roslyn’s is amazing. There are projects like Code-Cracker allowing to have all the power of a code Analyzer at time of build (scenarios of CI are spectacular), others as NR6 Pack where we can see that in addition to being a good platform of refactoring actions, are thinking about migrating to MonoDevelop with what the concept “productivity” and “cross-platform” will be ever-expanding.