Sunday, November 25, 2018

Visuals Studio - update nuget client

Navigate to your project repository in Dev Command Prompt. 
cd "repository path\.nuget" 
Run this command:
nuget update -self 

Wednesday, October 17, 2018

How to make SlowCheetah work with class libraries and services, apart from executables

Add a App.Base.Config which is the base for all configs and the below lines would ensure on build the specific environment gets copied to the App.config.

Just add the below lines to end of .csProj file where you need SlowCheetah support:

<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />
  <Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.0.61\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets" />
  <Target Name="BeforeBuild">
    <TransformXml Source="App.Base.config" Transform="App.$(Configuration).config" Destination="App.config" />
  </Target>

Wednesday, October 10, 2018

Git: Add new files and directories using GitBash

Reference link: 
https://linuxprograms.wordpress.com/2012/01/30/git-add-new-files-directories/
Git: How to add new files and directories?

If you are working with Git and want to add a new file or directory, follow the following steps
Go to the directory where your file is located.
$ cd directory
$ git add filename
Now you must commit these changes (You can give necessary comments)
$ git commit -m "Adding a new file"
If you want to add a directory, Go to the directory where the directory you want to add is located.
$ cd directory
$ git add directoryname
Now you must commit these changes (You can give necessary comments)
$ git commit -m "Adding a new directory"
Note that the above step will also commit the subdirectories and files present in the directory.

Friday, September 14, 2018

All about port usage

 which port is being used by which application, which application uses which port and everything related to this can be found here:
https://dzone.com/articles/how-to-check-which-process-is-using-port-8080-or-a

Wednesday, August 29, 2018

Multiple instances of same windows service on one server

Its possible to host multiple windows service on same server but different name. Here's the link to do it.

Just a small tweak in the code:

        public override void Install(System.Collections.IDictionary stateSaver)
        {
            RetrieveServiceName();
            base.Install(stateSaver);
        }

        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            RetrieveServiceName();
            base.Uninstall(savedState);
        }

        private void RetrieveServiceName()
        {
            var serviceName = Context.Parameters["servicename"];
            if (!string.IsNullOrEmpty(serviceName))
            {
                this._serviceInstaller.ServiceName = serviceName;
                this._serviceInstaller.DisplayName = serviceName;
            }
        }

We can now use this like this:
installutil /servicename=”My Service [SysTest]” d:\pathToMyService\Service.exe
and for uninstall:
installutil /u /servicename=”My Service [SysTest]” d:\pathToMyService\Service.exe
Note for the uninstall you need to supply the servicename so windows how to resolve the service to uninstall

Tuesday, August 28, 2018

Full copy SQL server database from source to destination


1. Copy  databases from source
----------------------------

USE master;
GO 
ALTER DATABASE [DatabaseName]
SET RECOVERY FULL; 

BACKUP DATABASE [DatabaseName]
    TO DISK = 'Backup Location\xyz.bak'  
    WITH FORMAT 
GO  

Copy the back-up file to your destination folder

2. Restore databases at destination
---------------------------------

RESTORE DATABASE [DatabaseName] 
   FROM DISK = 'Backup Location\xyz.bak'  
    WITH RECOVERY,
      MOVE 'xyz' TO  
         'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Data\xyz.mdf',  
      MOVE 'xyz_log' TO 
         'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Data\xyz_log.ldf'; 
GO

Restore backed up database with different name at destination
RESTORE DATABASE [DPE-OPL] FROM DISK='D:\DB-Backup\4th Sept 2018\SQL\DPE-OPL-INT.bak'
WITH
MOVE 'DPE-OPL-INT' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Data\DATA\DPE-OPL.mdf',
MOVE 'DPE-OPL-INT_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Data\DPE-OPL_log.ldf'

3. Rename the DB in Management Studio

Monday, August 6, 2018

Password protect folder using notepad

Just follow the steps in this link
Line no 21: just give a space after password and before goto FAIL.
In the link they are joined.