‘Serilog’ already has a dependency defined for ‘Microsoft.CSharp’

image001I’ve recently updated to the Visual Studio 2013 update 5 and started receiving the error while installing Serilog.

This what I have tried.

PM> Install-Package Serilog -Version 2.5.0


PM> Install-Package Serilog
Install-Package : 'Serilog' already has a
dependency defined for 'Microsoft.CSharp'. At line:1 char:1
+ Install-Package Serilog -Version 2.5.0
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Resolution Step #1

After googling I found this.


I tired the resolution suggested here to update Nuget using self update command .

You need to browse .nuget folder under your solution folder to execute the command. See below image.

Navigate to .nuget run the following command.

<Solution Path>\.nuget>Nuget.exe Update -self


Resolution Step #2

You need to update “Nuget Package Manager for Visual Studio”, Open Visual Studio Navigate to Tools > Extensions and Updates > Click Updates tab.

Select Nuget plugin and update. Visual Studio will prompt you to restart after installation is complete. Restart Visual Studio it should work fine.


This steps worked fine for Visual Studio 2013 Premium Update 5. I ran the npm command again and it succeeded.


Package Manager Console now updated as Version ‘‘, this was Version ‘2.8.60610.756’ initially, see the first screenshot in this post.


Posted in ASP.NET, c#, nuget, visual studio | Tagged , , , , | Leave a comment

Chrome Error code: ERR_UNSAFE_PORT This webpage is not available


This post about an issue I faced while debugging an asp.net mvc application in Google Chrome. (Version 40.0.2214.111 m). I bulit my website using MVC 4 Template in Visual Studio 2010, designed a top menu and started testing the UI. By default visual studio was opening up the homepage in IE 🙂 , everything was running as expected, so just to see how it works in Chrome, I opened IIS Express url (localhost:6000), and the below error shown up “This webpage is not available“.


Show details link revealed more info Chrome Error code: ERR_UNSAFE_PORT

Alright it looks like not all ports are supported by the chrome browser. This is because of Chrome restricting the local ports.

How To fix the issue

1. Change Website Port setting in Visual Studio (Recommended) OR

2. Add the testing port(here 6000) as an allowed port to Google Chrome Explicitly

How To Change Website Port setting in Visual Studio

1. Right click your website project in the solution, select properties, select “Web” Tab in the Servers Section/Use Visual Studio Development Server, Specific Port give a random port no that is not used by any other application in your machine.


How to allow port in Google Chrome explicitly :

Right click on the chrome shortcut (Desktop/StartMenu/Quick Launch) -> Properties -> Change the target:

“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –explicitly-allowed-ports=81,84,87

New shortcut command should like this , if Chrome is installed on the default installation location.

Continue reading

Posted in ASP.NET, IIS | Tagged , , | Leave a comment

IIS HTTP Error 503. The service is unavailable

Hi, Setting up a new virtual directory/application in IIS, Is it giving this wired error when you try to browse to localhost saying “HTTP Error 503. The service is unavailable.” ? Don’t just give up, you can try the below step to fix the issue.

1. Check if the application pool is not started/enabled for the website in IIS.

2. Check whether the identity assigned to the application pool is not active and uses the correct password. Sometimes Developers use their own LogInId as appPool Id and change password later point. This happened to me 🙂

3. Check whether the identity has access to physical folder the Virtual directory is pointed to.

4. Enable Failed Request Tracing Rules and see log if anything is getting generated.

How to check application pool status ?

Step 1: Start > Run > type “inetmgr”, the command open IIS

Step 2: Locate your application/Virtual directory.Capture-http501.1

Step 3: Look for the application pool of the selected website.Capture-http501 apppool

Step 4: Select the Application Pool and click on the Action Bar on the right side, Edit Application Pool Section Advance Settings Link.

Capture-apppol identity

Step 5: Verify the identity mentioned in Process Model Section Identity Textbox is active and uses the correct password, click on the right side of Identity Textbox in case you want to change the id/password.

Capture-app pool id
Step 6: Now go back to Application pool list window, Right click on the application pool name in the Application Pool list and then select the Start option from the context menu.

Step 7: Also check the identity has access the physical path to which the the virtual directory. If the error wouldn’t get resolved after performing steps  1 to 6.

Thanks for reading, Happy Coding!

Posted in ASP.NET, IIS | Tagged , | Leave a comment

SSIS: How to pass variables to ADO.NET Source

Hey,  Trouble in mapping parameter or vaiable? This should be fairly a simple thing to do, why the SSIS Designer is showing so many issues ?. If you are one among those asking that question, hope this post will help you.

This post is about mapping a variable in any SSIS data elements, i.e ADO.NET Data Source, SQL tasks ,OLE DB source etc.

To use expressions for an ADO.NET source in a data flow, here are a few simple steps:

Step 1 – Go to the Data Flow Task Properties window

On the Control Flow tab (not the Data Flow tab), right-click the Data Flow Task you are working on and select Properties.


Step 2 – Open the Property Expression Editor

In the Properties window, find a property called Expression and a small button next to it. Click the button to open the Expression Editor.


Step 3 – Open the Expression Builder for SQL Command

In the Property list, select [ADO NET Source].[SqlComamnd] and click the button next to the Expression column to open Expression Builder.

Step 4 – Write query with variables

Start to write your query with variable names and click the Evaluate Expression button to test the expression.

Example : “Select col1,col2,col3 from Table Where id=” +  @[User::ParamId]


You may get an error “the data types dt_wstr and dt_i4 are incompatible for binary operator +” , if an incompatibledata type used for concatenation.

Either cast the variable a string or convert variable type to String for concatenation operation.

“Select col1,col2,col3 from Table Where id=” + (DT_WSTR,10) @[User::ParamId]

By default variable will be created as Boolean, to convert check variable type expand the variable explorer window. Visual Studio. Menu SSIS >> Variables


Note: You can change the DelayValidation property to true, so you do not need to provide an initial value to the variable holding the parameter value, otherwise the package could fail validation.


How to: Map Query Parameters to Variables in an Execute SQL Task


Difference when using an expression Vs Parameters:


Thanks for reading. Hope this help

Posted in SSIS | Tagged , , | Leave a comment

Difference between var and let variable declaration is the “scope”

Main difference between var and let variable declaration is the “scope”.
var is scoped to the nearest function block
let is scoped to the nearest enclosing block, this scope can be smaller than a function block

Both types will have global scope if defined outside a function block, no difference work exactly same way

Scope: {Global} Example

let letValue = 'Value for let variable'; //globally scoped
var varValve = 'Value for var variable'; //globally scoped
function FirstFunction()
//letValue & varValve are visible here
function secondFunction()
//letValue & varValve are visible here
//letValue & varValve are visible here

Also, just like var, variables declared with let are visible before they are declared in their enclosing block.
Scope: {function} Example
They are identical when used like this in a function block.

function getValueFunction() {
let letValue = 'Value for let variable'; //function block scoped
var varValve = 'Value for var variable'; //function block scoped

//letValue & varValve are visible here

};//--> nearest enclosing block, let scope ends here**

//letValue & varValve are NOT visible here

Scope: {Block} Example
Here is the difference. let is only visible in the for() loop and var is visible to the whole function.

<code>function testMethod1() {
//letValue is NOT visible out here</code>

for( let letValue = 0; letValue < 5; letValue++ ) {

//letValue is only visible in here (and in the for() parentheses)

};//--> nearest enclosing block, let scope ends here**

//letValue is NOT visible out here


var is visible in the scope,  that is the nearest function block

function testMethod2() {
//varValve is visible out here</code></pre>

for( var varValve = 0; varValve < 5; varValve++ ) {
//varValve is visible to the whole function

//varValve is visible and is scoped to the nearest function block

};//-->nearest function block ends

And let can also be used to create its own enclosing block.

function testMethod3() {
//letValue is NOT visible out here</code>

let( letValue = 'now' ) {

//letValue is only visible in here

};//-->nearest enclosing block ends

//letValue is *not* visible out here

Hence, let works very much like var. The main difference is that the scope of a var variable is the entire enclosing function. ECMAScript is the standard and let is included in the 6th edition draft and will most likely be in the final specification. IE11 added support for let msdn.microsoft.com/en-us/library/ie/dn342892%28v=vs.85%29.aspx

Posted in javascript | Tagged , | Leave a comment

SharePoint GetListItems using JQuery and $().SPServices

Hello Reader,

This post is about a very useful SharePoint JQuery Library.


Logo is taken from: http://spservices.codeplex.com/

I have used this library to build Custom SharePoint Page to generate a monthly report page that will list a set of approved request for a selected month.

So here the step by step explanation of how I did it.

Components Used

1. SharePoint Custom List

2. SharePoint Custom HTML Page

3. Javascript Libraries : JQuery, SPServices, DateJS

SP List definition is as follows

Column (click to edit) Type Used in
Employee No Single line of text Item
Task Description Single line of text Item
Estimated Work Hours Number Item
Approval Status Choice Item
PM Approval Choice Item
Project Code Single line of text Item
Project Manager Person or Group Item
Cost Centre Single line of text Item
Created By Person or Group
Modified By Person or Group

4. Three Share point Forms to override the default New/Edit/View Page

5. One HTML form for the Site Owner/Approver to edit or approve an entry.

6. Custom Report Page which will show approved entries for the selected month.

Following are the main the client side methods in the Report Page:

$(document).ready() => page load event does the following things

1. Create a dropdown list with current and past 5 months.

I have used Datejs, this is an open source JavaScript Date library for parsing, formatting and processing.


Source: https://code.google.com/p/datejs/


2. Attached an on change event on the Month dropdownlist, which will pull the list data for the selected month from the above Sharepoint List using SPServices library methods


3. A method to query the SharePoint List to get the approved items for the selected month,  $().SPServices made my job easy, thanks a lot Marc D Anderson & Team.


$(document).ready(function() {

function GetApprovedItems(){

var titleField = "<FieldRef Name='Title' />";
var datField = "<FieldRef Name='Date' />";
var statusField = "<FieldRef Name='Status' />";
var createdByField = "<FieldRef Name='Author' />";
var pmField = "<FieldRef Name='Project_x0020_Manager' />";

var viewFields = "<ViewFields>" + titleField + datField + pmField + statusField
+ createdByField + "</ViewFields>";

var ifApproved = "<Eq><FieldRef Name='Status'/><Value Type='Text'>Approved</Value></Eq>";
var GeqSelectedMonth = "<And><Geq><FieldRef Name='Date'/><Value Type='DateTime'>" + selectedMonth + "</Value></Geq>";
var LeSelNextMonth = "<Lt><FieldRef Name='Date'/><Value Type='DateTime'>" + NextMonth + "</Value></Lt></And>";

var queryText = "<Query><Where><And>" + ifApproved + GeqSelectedMonth + LeSelNextMonth + "</And></Where></Query>";
operation: "GetListItems",
async: false,
listName: "CustomRequestList",
CAMLViewFields: viewFields,
CAMLQuery: queryText,
completefunc: populateData

Don’t worry about writing long CAML query and debugging it at client side, you can use Simple CAML Query to write, test and make your query perfect.

Source: http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=8

Be careful while mentioning the List Field names

The column names should be the InternalNames for the columns, which might look like “My_x0020_Column”, as special characters like spaces are encoded. In this case, the space becomes “_x0020_” because a space is ASCII character 20 (hexadecimal). Seehttp://www.asciitable.com/ for more info.

The easiest way to identify the InternalName for a column is to go to the List [or Library] Settings, click on the column name, and look on the end of the URL, which will end with something like this in SharePoint 2007:


or this in SharePoint 2013:


Your column’s InternalName is at the end of the URL after “Field=”.

Note that regardless what you specify in the CAMLViewFields, you will get some additional columns even though you don’t want them, including the item’s ID.

Source: http://sympmarc.com/2013/10/16/single-page-applications-spas-in-sharepoint-using-spservices-part-2-getlistitems/


4. Finally a small piece of java script to format the page,  div containing the list data will be visible, script will hide SharePoint Mater Page and other page elements while printing. This event is attached to a print button on the page onclick = “printContent(‘reportDIV’)”

var isPrinting = false;
function printContent(el){

var container = document.getElementById(el),
origDisplay = [],
origParent = container.parentNode,
body = document.body,
childNodes = body.childNodes,

if (isPrinting ) { return;}// block the button while in printing mode
isPrinting = true;

for (i = 0; i < childNodes.length; i++) {// hide all body content
var node = childNodes[i];
if (node.nodeType === 1){
origDisplay[i] = node.style.display;
node.style.display = "none";

var onPrintFinished=function(printed){ //function triggers when window.print() is finished
origParent.appendChild(container); // put the masterpage and other content back in
for (i = 0; i < childNodes.length; i++) {
var node = childNodes[i];
if (node.nodeType === 1) {
node.style.display = origDisplay[i];
isPrinting = false;
onPrintFinished(window.print());//Execute print command

Hope this will help someone. Thanks for reading 🙂

Posted in $().SPServices, sharepoint | Tagged , , , | Leave a comment

The only source…

The only source of knowledge is experience.

Read more at http://www.brainyquote.com/quotes/topics/topic_experience.html#j8u5OV6OHUUiUX8C.99

Quote | Posted on by | Leave a comment