MVP again–Developer Technologies
So I am MVP again. I can say that I am happy about.
You can find my profile at https://mvp.microsoft.com/en-us/PublicProfile/4025203 .
So I am MVP again. I can say that I am happy about.
You can find my profile at https://mvp.microsoft.com/en-us/PublicProfile/4025203 .
I was invited at http://apexvox.net/#schedule to present ] Angular + .NET Core => Applications for Mobile, Web and Desktop
It was very exciting to find so many people interested in .NET . And it was good to re-see old friends, like http://vunvulearadu.blogspot.com/2019/03/post-event-apexvox-cluj-napoca-2019.html , Daniel Costea, Ciprian Jichici and to make new ones
You can find the code and the presentation at https://github.com/ignatandrei/angNetCoreDemo/ .
If you need help, please contact me directly
Part1 : Introduction and Concepts
Part 2: Obtaining BackEnd Components Version
Part 3: Obtaining FrontEnd Component Version and Final Library
NPM component
Copy paste NET code
Identifying the version of Angular components that we are using is a bit tricky. The package.json is having, by default, components using version “greater than”. More than that , after AOT compiling it remains no evidence of the original software used. However, there is a helper npm-shrinkwrap : this will generate a npm-shrinkwrap.json file that fixes the versioning.
So the second part is to request the .NET version and the npm-shrinkwrap.json file content with Angular front-end
For this we have a class that takes , by Dependency Injection, the HTTP Client and request versions from .NET Core and Angular:
export class VersionsNetcoreAngularService { constructor(private http: HttpClient) { const self = this; } public FVS(): Observable<FileVersionInfo[]> { console.log('get fvs'); return this.http.get<FileVersionInfo[]>('api/Utils/GetVersions'); } public FVSAngular(): Observable<FVSAng[]> { console.log('get fvs angular'); return this.http.get('npm-shrinkwrap.json').pipe ( switchMap(data => { const ret = data as PackageJSONVersion ; const d = ret.dependencies; const arr = new Array<FVSAng>(); let f = new FVSAng(); f.name = ret.name; f.fileVersion = ret.version; arr.push(f); for (const key of Array.from( Object.keys(d)) ) { const dep = d[key] as Dependency; if (dep.dev) { continue; } f = new FVSAng(); f.fileVersion = dep.version; f.name = key; arr.push(f); } return of(arr); }) ); }
The rest is history – just display the version in a HTML GUI.
Part1 : Introduction and Concepts
Part 2: Obtaining BackEnd Components Version
Part 3: Obtaining FrontEnd Component Version and Final Library
NPM component
Copy paste NET code
Identifying the version of the dll’s used on the backend is fairly simple. All we need is to iterate into the current directory and find the version of the dlls. It is just a simple controller that receives via Dependency Injection the path to the current directory. It is no harder than that code:
[HttpGet] public FileVersionInfo[] GetVersions([FromServices] IHostingEnvironment hosting) { var dirPath = hosting.ContentRootPath; var ret = new List<FileVersionInfo>(); var files = Directory.EnumerateFiles(dirPath, "*.dll", SearchOption.AllDirectories).Union(Directory.EnumerateFiles(dirPath, "*.exe", SearchOption.AllDirectories)); foreach (string item in files) { try { var info = FileVersionInfo.GetVersionInfo(item); ret.Add(info); } catch (Exception) { //TODO: log } } return ret.ToArray(); } }
Part1 : Introduction and Concepts
Part 2: Obtaining BackEnd Components Version
Part 3: Obtaining FrontEnd Component Version and Final Library
NPM component
Copy paste NET code
In our days recognizing fast the version of the software you deploy it is important ( very important , if you do not have a continuum upgrade strategy – like Chrome does or in my days , using Click Once ). More, you should be able to recognize what components you are using in the software.
This was very interesting for me ( see http://msprogrammer.serviciipeweb.ro/2014/10/13/tt-add-more-informations-net-version-build/ and http://msprogrammer.serviciipeweb.ro/2019/01/14/opensource-library-versioning/ ). However, this is not about how to version the application – but how to display the version for BackEnd and FrontEnd components.
So – we need a front-end HTML page ( or WPF, or WinForm or other front-end ) and 2 informations : 1 for the components for the backend and one for the components for the front end .
I have made such a component – it is made for Angular and .NET Core. It can be adapted very easy for all others , by transforming the Angular library to a WebComponent library and the WEB API .NET Core into node.js HTTP Rest.
If you want to see the final product , please check the https://www.npmjs.com/package/versions-netcore-angular and the live demo at https://azurestankins.azurewebsites.net/about
You will see the version of .NET Components and Angular Components that we are using.
We have Tuesday, 12 february, a new meeting in Bucharest: https://www.meetup.com/Bucharest-A-D-C-E-S-Meetup/events/258206455/
I will present the Angular litbrary for identifying versions of components for both backend and frontend – however, the presentation is towards how to organize Angular into projects/ library , how to compile and how to deploy into npm repository.
Also, Andrei Nitescu will finish his presentation about Xamarin Forms with the following content:
What’s Xamarin Forms exactly? How’s it different than Xamarin?
– Framework capabilities
– A quick example of creating a simple mobile app with Xamarin Forms
– Great apps need great libraries/frameworks: Prism for Xamarin Forms, Xamarin Essentials.
We expect you on Tuesday at Bucharest Tower Center, Bulevardul Ion Mihalache 18, București