.net – How to change assembly version of a dll without rebuilding in c#? – Stack Overflow

0down voteacceptedI think you have two options;do not sign the assembly and set specific version to false in the project where you have referenced it.create a Publisher Policy for the assembly and add bindingRedirect element to your configuration.

Source: .net – How to change assembly version of a dll without rebuilding in c#? – Stack Overflow


How to: Enable and Disable Automatic Binding Redirection | Microsoft Docs

How to: Enable and Disable Automatic Binding Redirection2017-3-30 2 min to read Contributors Starting with Visual Studio 2013, when you compile apps that target the .NET Framework 4.5.1, binding redirects may be automatically added to the app configuration file to override assembly unification. Binding redirects are added if your app or its components reference more than one version of the same assembly, even if you manually specify binding redirects in the configuration file for your app. The automatic binding redirection feature affects traditional desktop apps and web apps that target the .NET Framework 4.5.1, although the behavior is slightly different for a web app. You can enable automatic binding redirection if you have existing apps that target previous versions of the .NET Framework, or you can disable this feature if you want to keep manually authored binding redirects.Disabling automatic binding redirects in desktop appsAutomatic binding redirects are enabled by default for traditional desktop apps that target the .NET Framework 4.5.1 and later versions. The binding redirects are added to the output configuration (app.config) file when the app is compiled and overrides the assembly unification that might otherwise take place. The source app.config file is not modified. You can disable this feature by modifying the project file for the app.To disable automatic binding redirectsIn Visual Studio, select the project in Solution Explorer, and then choose Open Folder in File Explorer from the shortcut menu.In File Explorer, find the project (.csproj or .vbproj) file, and open it in Notepad.In the project file, find the following property entry:trueChange true to false:falseEnabling automatic binding redirects manuallyYou can enable automatic binding redirects in existing apps that target older versions of the .NET Framework, or in cases where you are not automatically prompted to add a redirect. If you are targeting a newer version of the framework but do not get automatically prompted to add a redirect, you will likely get build output that suggests you remap assemblies.To manually add an automatic binding redirect propertyIn Visual Studio, select the project in Solution Explorer, and then choose Open Folder in File Explorer from the shortcut menu.In File Explorer, find the project (.csproj or .vbproj) file, and open it in Notepad.Add the following element to the first configuration property group (under the tag):trueThe following shows an example project file with the element inserted.XMLCopy Debug AnyCPU {123334} … true … Compile your app.Enabling automatic binding redirects in web appsAutomatic binding redirects are implemented differently for web apps. Because the source configuration (web.config) file must be modified for web apps, binding redirects are not automatically added to the configuration file. However, Visual Studio notifies you of binding conflicts, and you can add binding redirects to resolve the conflicts. Because you are always prompted to add binding redirects, you do not need to explicitly disable this feature for a web app.To add binding redirects to a web.config fileIn Visual Studio, compile the app, and check for build warnings.If there are assembly binding conflicts, a warning appears. Double-click the warning. (Keyboard: Select the warning and press Enter.)A dialog box that enables you to automatically add the necessary binding redirects to the source web.config file appears.

Source: How to: Enable and Disable Automatic Binding Redirection | Microsoft Docs

Show Settings Alert

    public void showSettingsAlert(){
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);

        // Setting Dialog Title
        alertDialog.setTitle("GPS is settings");

        // Setting Dialog Message
        alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");

        // On pressing Settings button
        alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog,int which) {
                Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);

        // on pressing cancel button
        alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

        // Showing Alert Message

Detect Tap Count in Android

private int count = 0;
    private long startMillis=0;

    public boolean onTouchEvent(MotionEvent event) {

        int eventaction = event.getAction();
        if (eventaction == MotionEvent.ACTION_UP) {

            //get system current milliseconds
            long time= System.currentTimeMillis();

            //if it is the first time, or if it has been more than 3 seconds since the first tap ( so it is like a new try), we reset everything
            if (startMillis==0 || (time-startMillis> 3000) ) {
            //it is not the first, and it has been  less than 3 seconds since the first
            else{ //  time-startMillis< 3000

            if (count==5) {
                 BrId = myPrefs.getInt("BrId", 0); // return 0 if someValue doesn't exist
                if(BrId != 0){
            return true;
        return false;

Show notification in android status bar

    private void ShowStatusBarNotification(String contentTitle,String contentText)
        Notification notification = new Notification.Builder(getApplicationContext())

        NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        // notificationID allows you to update the notification later on.
        mNotificationManager.notify("BR Tracker",(int)(Math.random() * 101) ,notification);

Google Map Polyline

<script type="text/javascript">
var map;
var markers = [];
var path = [];

$(function () {

    var opts = {
        zoom: 10,
        center: { lat: 23.564587, lng: 90.569874 },
        mapTypeId: google.maps.MapTypeId.ROADMAP
    map = new google.maps.Map(document.getElementById('map_canvas'), opts);

    $('#AttendanceSearch').click(function (e) {

        var newMarker = {};
        newMarker.Latitude = 24.8594959;
        newMarker.Longitude = 89.3631192;
        newMarker.Accuracy = 20.0;
        newMarker.MarkerName = 'hi';
        path.push(new google.maps.LatLng(24.8594959, 89.3631192));

        var markerTwo = {};
        markerTwo.Latitude = 23.9246227;
        markerTwo.Longitude = 90.7130343;
        markerTwo.Accuracy = 20.0;
        markerTwo.MarkerName = 'hello';

        path.push(new google.maps.LatLng(23.9246227, 90.7130343));

        setArrows = new ArrowHandler();

        //Looping markers array--->
        markers.forEach(function (markerInfo, index) {
            //marker object --->
            var marker = new google.maps.Marker({
                name: markerInfo.MarkerName,
                position: { lat: markerInfo.Latitude, lng: markerInfo.Longitude },
                map: map,
                title: markerInfo.MarkerName
            //marker object ---<

            marker.addListener('click', function () {
                var contentString = "Hello Bro";

                var infowindow = new google.maps.InfoWindow({
                    content: contentString

                infowindow.open(map, marker);

        //Looping markers array ----<

        createPoly(path, "midline");

<script type="text/javascript">

     * Based on code provided by Mike Williams
     * http://econym.org.uk/gmap/arrows.htm
     * Improved and transformed to v3

    var setArrows;

    function ArrowHandler() {
        // Markers with 'head' arrows must be stored
        this.arrowheads = [];
    // Extends OverlayView from the Maps API
    ArrowHandler.prototype = new google.maps.OverlayView();

    // Draw is inter alia called on zoom change events.
    // So we can use the draw method as zoom change listener
    ArrowHandler.prototype.draw = function () {

        if (this.arrowheads.length > 0) {
            for (var i = 0, m; m = this.arrowheads[i]; i++) {
                m.setOptions({ position: this.usePixelOffset(m.p1, m.p2) });

    // Computes the length of a polyline in pixels
    // to adjust the position of the 'head' arrow
    ArrowHandler.prototype.usePixelOffset = function (p1, p2) {

        var proj = this.getProjection();
        var g = google.maps;
        var dist = 12; // Half size of triangle icon

        var pix1 = proj.fromLatLngToContainerPixel(p1);
        var pix2 = proj.fromLatLngToContainerPixel(p2);
        var vector = new g.Point(pix2.x - pix1.x, pix2.y - pix1.y);
        var length = Math.sqrt(vector.x * vector.x + vector.y * vector.y);
        var normal = new g.Point(vector.x / length, vector.y / length);
        var offset = new g.Point(pix2.x - dist * normal.x, pix2.y - dist * normal.y);

        return proj.fromContainerPixelToLatLng(offset);

    // Returns the triangle icon object
    ArrowHandler.prototype.addIcon = function (file) {
        var g = google.maps;
        var icon = {
            url: "http://www.google.com/mapfiles/" + file,
            size: new g.Size(24, 24), anchor: new g.Point(12, 12)
        return icon;

    // Creates markers with corresponding triangle icons
    ArrowHandler.prototype.create = function (p1, p2, mode) {
        var markerpos;
        var g = google.maps;
        if (mode == "onset") markerpos = p1;
        else if (mode == "head") markerpos = this.usePixelOffset(p1, p2);
        else if (mode == "midline") markerpos = g.geometry.spherical.interpolate(p1, p2, .5);

        // Compute the bearing of the line in degrees
        var dir = g.geometry.spherical.computeHeading(p1, p2).toFixed(1);
        // round it to a multiple of 3 and correct unusable numbers
        dir = Math.round(dir / 3) * 3;
        if (dir < 0) dir += 240;
        if (dir > 117) dir -= 120;
        // use the corresponding icon
        var icon = this.addIcon("dir_" + dir + ".png");
        var marker = new g.Marker({
            position: markerpos,
            map: map, icon: icon, clickable: false
        if (mode == "head") {
            // Store markers with 'head' arrows to adjust their offset position on zoom change
            marker.p1 = p1;
            marker.p2 = p2;
            // marker.setValues({ p1: p1, p2: p2 });

    ArrowHandler.prototype.load = function (points, mode) {
        for (var i = 0; i < points.length - 1; i++) {
            var p1 = points[i],
            p2 = points[i + 1];
            this.create(p1, p2, mode);

    // Draws a polyline with accordant arrow heads
    function createPoly(path, mode) {
        var poly = new google.maps.Polyline({
            strokeColor: "#0000ff",
            strokeOpacity: 0.8,
            strokeWeight: 3,
            map: map,
            path: path

        setArrows.load(path, mode);
        return poly;

Google map polyline

//API v2
var polyline = new GPolyline([
  new GLatLng(37.4419, -122.1419),
  new GLatLng(37.4519, -122.1519)],
  "#ff0000", 10);

//API v3
var line = new google.maps.Polyline({
    path: [new google.maps.LatLng(37.4419, -122.1419), new google.maps.LatLng(37.4519, -122.1519)],
    strokeColor: "#FF0000",
    strokeOpacity: 1.0,
    strokeWeight: 10,
    geodesic: true, //This line is optional
    map: map

C# dynamic ExpandoObject()

using System;
using System.Dynamic;
public class HomeController : Controller
       public ActionResult SingleObject()
           dynamic contact = new ExpandoObject(); //Declaring new dynamic object

           contact.Name = "ABC"; // manually adding property & value
           string propertyName = "Age";  int propertyValue = 5; 
           AddProperty(contact, propertyName, propertyValue); //dynamically adding   
                                                                prop & value

           return View(contact);

       @model dynamic

       public ActionResult ObjectList()
          // declaring a list of dynamic object
          dynamic contacts = new List<dynamic>(); 

          // Adding 1st object to the list
          contacts.Add(new ExpandoObject());
          contacts[0].Name = "ABC";
          contacts[0].Phone = "123";

          // Adding 2nd object to the list
          contacts.Add(new ExpandoObject());
          contacts[1].Name = "XYZ";
          contacts[1].Phone = "456";

          return View(contacts);

        @model dynamic
        @foreach (var item in Model)

        //Helper method to add property in run-time.
        public void AddProperty(ExpandoObject expando, string propertyName, object propertyValue)
            // ExpandoObject supports IDictionary so we can extend it like this
            var expandoDict = expando as IDictionary<string, object>;
            if (expandoDict.ContainsKey(propertyName))
                expandoDict[propertyName] = propertyValue;
                expandoDict.Add(propertyName, propertyValue);