Generating Visual Studio solution( or project) references

A Visual Studio pacakge is a plugin of Visual Studio that can do (almost) anything inside Visual Studio

I have made a small project that generates a list of all solution ( or project) references from VS:

 

            foreach (var project in dte.Solution.Projects)
            {
                var p = project as Project;
                if (p == null)
                {
                    continue;
                }

                var vsproject = p.Object as VSLangProj.VSProject;
                if (vsproject == null)
                    continue;

                string nameProject = p.Name;
                foreach (var reference in vsproject.References)
                {
                    var r = reference as Reference;
                    if (r == null)
                        continue;

                    var pathRef = r.Path;

                    //this is a package                    
                    var pa = new PackageAdd();
                  
                    pa.ProjectName = p.Name;
                    pa.IdentifierPackage = r.Identity;
                    pa.VersionPackage = r.Version;
                    pa.NamePackage = r.Name;

                  



                    if (r.SourceProject != null)
                    {
                        
                        pa.NamePackage = r.SourceProject.Name;
                    }
                    sb.AppendLine(pa.ToString());
                }
            }

You can find the solution at https://github.com/ignatandrei/ToolsAndUtilities/tree/master/VS2015/FindReferencesVS

Also the video is at https://youtu.be/a3YHVjJ9fm4

Enjoy!

Thank you for all the API

In our days it is simpler to make an application by putting together some API . I wanted to make a list of all my 5 Minutes .NET playlist videos . First, I have tried to find an application(nothing). Then I have read  You Tube API from https://console.developers.google.com/apis/library . With 2 http requests( one for retrieving all videos from a playlist, the other to find video details) and a NuGet package to export to Excel/Word/PDF/HTML it was simple. You can find the whole project at https://github.com/ignatandrei/YouTube . A video demo at https://www.youtube.com/watch?v=wNHDsHtLBq4 . And the whole list at https://github.com/ignatandrei/ToolsAndUtilities/tree/gh-pages

Powerpoint macro to reveal

I think that everyone knows PowerPoint. However, reveal.js is a simple js+css + html to make presentation. I like it – and it is easy to put on any presentation.

Remembering my VB roots , I have created a simple PowerPoint macro to save presentation as reveal. It takes advantage that PowerPoint could save the slides as JPG.

Some sample code is here:

 

Sub ToReveal()
‘where to save the reveal
Dim rootFolder As String
rootFolder = "D:\"

Dim sld As slide, shp As Shape
Dim textSlide As String
Dim p As Presentation
Set p = ActivePresentation
Dim name As String
name = p.name
If (InStr(1, p.name, ".") > 1) Then
name = Mid(name, 1, InStr(1, p.name, ".") – 1)
End If
Dim NameFolder As String
NameFolder = rootFolder + name + "_reveal"

ActivePresentation.SaveCopyAs NameFolder, ppSaveAsJPG
Dim Sections As String, i As Integer, max As Integer
max = p.Slides.Count

For i = 1 To max
Sections = Sections + vbCrLf
Sections = Sections + "<section>"
Sections = Sections + "<img src=’Slide" & i & ".jpg’>"
Sections = Sections + "</section>"

Next i
Dim str As String
str = OriginalReveal()
str = Replace(str, "#PPTName#", p.name)
str = Replace(str, "#section#", Sections)

Dim fileName As String, textRow As String, fileNo As Integer
fileName = NameFolder + "\index.html"
fileNo = FreeFile ‘Get first free file number

Open fileName For Output As #fileNo
Print #fileNo, str
Close #fileNo

End Sub

The full source code is on https://github.com/ignatandrei/ppt2reveal/tree/master

Press ALT+F11 , paste code and enjoy!

YouTube playlist exporter

 

The point here is about how simple is in our days to make a simple script as a programmer.

I wanted to export my playlists ( 5 minutes .NET , Export Word Exce l PDF  , EF 6 , Traceability ) videos into a simple HTML file that I could put into my website.

I searched first on internet – however, I found just you tube google api .

So I read the documentation (e.g. https://developers.google.com/youtube/v3/docs/videos/list)  , grab a developer key from https://console.developers.google.com/ and made a simple project.

Used also a NuGet package for JSON( Newtonsoft.Json) and one for export in Excel /Word /HTML / PDF /ODS (ExporterWordExcelPDF).

Total time : 2 hours. You can find the project here https://github.com/ignatandrei/YouTube . It has only console application  – but it will have soon a GUI .

The point is that in our days it is easy to use third party application – and , for a programmer, easy as pie( eating, not making ; – ) )

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.