RSS

Visual Studio 2010 RC Now Available for Download

Wed, Feb 10, 2010

0 Comments

Microsoft has just released the Release Candidate version of Visual Studio 2010 for public download. You can now download and try out Visual Studio 2010 RC and .NET Framework 4 RC before the final version which is due to hit retail in this first quarter of 2010. It was released for MSDN Subscribers on 8th February and released for the public just few minutes ago (11th February 2010).

Visual studio 2010 RC

It is a much  awaited version of visual studio and it is available in following SKU’s:

  • Visual Studio 2010 Ultimate
  • Visual Studio 2010 Premium
  • Visual Studio 2010 Professional

Those who wish to try it, go get your copy here.

According to the reviews so far VS 2010 RC seems to be much faster in  Compiling, Building  and Intellisense. Read Scott Guthrie’s announcement on this release here.

Popularity: 1% [?]

Continue reading...

SCRUM- Quick Guide

Wed, Nov 11, 2009

0 Comments

I just thought to share this two videos i found in youtube, which is very useful for those who want to learn about SCRUM methodology, wikipedia: Scrum is an iterative incremental framework for managing complex work (such as new product development) commonly used with agile software development. for more info read here.

SCRUM Basics by Orjan Hillbom

SCRUM in Under 10 Minutes (HD) by @hamids

hope it helps.

Popularity: 3% [?]

Continue reading...

FCKEDitor – FIXED Image Upload dialog hang for .net

Fri, Sep 25, 2009

1 Comment

Well This issue has been bugging alot of people around the net it seems. I’m one of the victim too *sigh*.. anways bianchi007, a member in the CKSource Site forums had posted a solution. thought it would be worth to share.

Here is the solution which was posted in this thread.

This is for the .net assembly 2_6_3. I based it on the help file http://dev.fckeditor.net/attachment/tic … 2115.patch

Steps:

Open the FredCK.FCKeditorV2.vs2005.csproj in Visual Studio 2005

Open the file FileBrowser > FileWorkerBase.cs

Go to line 119

Replace:

Response.Write( @"(function(){var d=document.domain;while (true){try{var A=window.top.opener.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();" );

Replace with:

Response.Write(@"(function(){var d=document.domain;while (true){try{var A=window.parent.OnUploadCompleted;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();");

Compile the project and then reference the new dll file in your project.

I hope it helps :) .

Popularity: 3% [?]

Continue reading...

Scott Guthrie Announces the WebsiteSpark Program

Thu, Sep 24, 2009

0 Comments

Scott guthrie just did a great announcement about the WebsiteSpark Program.

what is WebsiteSpark?

WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the open source applications built on top of them.

What does the program provide?

WebSiteSpark provides software licenses that you can use for three years at no cost.  Once enrolled, you can download and immediately use the following software from Microsoft:

  • 3 licenses of Visual Studio 2008 Professional Edition
  • 1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)
  • 2 licenses of Expression Web 3
  • 4 processor licenses of Windows Web Server 2008 R2
  • 4 processor licenses of SQL Server 2008 Web Edition
  • DotNetPanel control panel (enabling easy remote/hosted management of your servers)

The Windows Server and SQL Server licenses can be used for both development and production deployment.  You can either self-host the servers on your own, or use the licenses with a hoster.  WebsiteSpark makes it easy to find hosters who are also enrolled in the program, and who can use your licenses to provide you with either dedicated or virtual dedicated servers to host your sites on.

In addition to software, WebsiteSpark provides partner opportunities to grow and build your business (including customer referrals through our partner programs).  It also includes product support (including 2 professional support incidents) and free online training for the products.

for further information on this visit Scotts blog here.

Thanks Scott for the great information :) .

Popularity: 2% [?]

Continue reading...

ClickOnce Application,Expired Certificates & Public Key Token PART III – Pushing .net Framework 3.5

Thu, Jul 9, 2009

0 Comments

In the last few weeks I wrote 2 articles on how to resolve ClickOnce certificate expiration issues. you can find those articles here :

  1. ClickOnce Application,Expired Certificates & Public Key Token PART I
  2. ClickOnce Application,Expired Certificates & Public Key Token PART II
    During my work on this ClickOnce update, we decided to upgrade the application to target .net framework 3.5 sp1.
    so I just set the target framework to 3.5 and set the required prerequisites (.net 3.5 SP1, and Windows Installer 3.1). and built the project and published it. and when I tried on a client machine which had .net framework 2.0, application got updated, prompted the uninstall message, and tried to launch the new ClickOnce application from the new URL, and BANG!. we get an error :
    image001
    The Error Message Says :

Unable to install or run the application. The application

requires that assembly WindowsBase Version 3.0.0.0 be

installed in the Global Assembly Cache (GAC) first.

Why is this ?, its because when we try to launch the new application URL we do this :

DeploymentUtils.AutoInstall("<Path toNewApplication.application>");
 

we request for the application manifest. and it fails to launch the application because it doesn’t have the prerequisites. and now to force the new prerequisites the application should call the setup.exe in the Web Server instead of the manifest. now the question is, what if the user already have  the .net Framework 3.5 SP1?, we don’t have to prompt the client to install them again by launching setup.exe, we just have to launch the manifest. To Serve both the above scenario we need to check if the client machine has .net framework 3.5 SP1, and depending on its availability we need to launch the manifest or the setup.exe. The existence of .net Framework can be obtained from the following registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP image you can find out all the .net Frameworks installed and their service pack versions in this registry entry. Following are the locations of the main Net Frameworks:

Framework 1.1 Software\\Microsoft\\NET Framework Setup\\NDP\\v1.1.4322
Framework 2.0 Software\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727
Framework 3.0 Software\\Microsoft\\NET Framework Setup\\NDP\\v3.0\\Setup
Framework 3.5 Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5

 

Now we can check if the required .net Framework is available in the client machine, and launch the application setup.exe or the manifest. to do this we need to programmatically check these registries. for this I used the attached code ( I Couldn’t find the original author, Credits goes to him/her) which I found from web and modified to avoid few bugs. you can add this code to your project and do the below check in your application to decide which file to be launched :

 
string FileToLaunch=@"/setup.exe";
if (FrameworkUtils.IsInstalled(FrameworkVersion.Fx35)

 && FrameworkUtils.GetServicePackLevel(FrameworkVersion.Fx35) == 1)
          {
            FileToLaunch = @"/<application manifest.application>";
          }
            MessageBox.Show("Your message here");
            string updateURL = DeploymentUtils.getUpdateURL();
            DeploymentUtils.UninstallMe();
            DeploymentUtils.AutoInstall("https://" + updateURL + FileToLaunch);
            Application.Exit();
 

And that’s all, now the application will launch the setup.exe if the client doesn’t have the .net Framework 3.5 and prompt for its installation, or launch the application manifest if client has the framework installed.

Now you can solve your ClickOnce issue as well as upgrade .net Framework in client machine at the same time without problem.

Download FrameworkUtils.cs

Popularity: 5% [?]

Continue reading...

Request UAC Elevation for .net Application (Managed Code)

Mon, Jun 29, 2009

5 Comments

Its about time for us to get ready for Windows 7. and most of us have to develop applications compatible to Windows 7, Vista, and Server 2008. and sometimes we need applications to run with administrative privileges. and that’s not a big deal. but in these new Operating Systems, even an administrator is sometimes locked by the UAC when running some applications.

some applications might throw exceptions in such situation, when we need administrative privileges to do some task, if they don’t request for UAC elevation by the application. only option to make these application is to right click and select “Run as Administrator” to manually trigger UAC.

In this post I’m going to show how to request for UAC Elevation for a .net Application. this explains the use of Application Manifests that request the OS for UAC elevation.

 

Code

I have my sample windows form C# Project with a single form that shows a message box on form load,showing whether you are an administrator or not.

 

  private void Form1_Load(object sender, EventArgs e)
        {
         bool isAdmin = new WindowsPrincipal(WindowsIdentity.GetCurrent())
                   .IsInRole(WindowsBuiltInRole.Administrator) ? true : false;

            if(isAdmin)
            {
                MessageBox.Show("you are an administrator");
            }
            else
            {
                MessageBox.Show("You are not an administrator");
            }
        }

 

in the above code we use WindowsPrincipal class, which allows us to check the Windows group membership of a Windows user. to use this classes un need to use the following namespace in the code:

using System.Security.Principal;
 

when you compile this application and run , you would expect that it will show the message saying “you are an administrator” if you are logged in as an administrator account. well this is what you get if you have UAC enabled, not something you expected right ?

image

ok now we need to make our application to request for UAC elevation.  first we need to create a manifest file with the application name.

Create Manifest File

First add a new item to the project with the name with following format, <applicationname>.exe.manifest . in our case (ElevationTest.exe.manifest). and add the following XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
   <assemblyIdentity version="1.0.0.0"  name="ElevationTest" type="win32"/>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator"/>
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly>

 

and the next step is to add the manifest in to the built executables Win32Resources by embedding it.  to do this we need to use the MT.exe in the .Net SDK.  by default it can be found in “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\”.

we can use the following command to embed the manifest through visual studio command line:

mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe;1

or

mt.exe –manifest MyLibrary.dll.manifest -outputresource:MyLibrary.dll;2

(1 for an EXE, 2 for a DLL.)

to make things easier we can add this command to the postbuild event of the project :

image

below is the full  post build command:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\mt.exe" -manifest "$(ProjectDir)$(TargetName).exe.manifest"  –outputresource:"$(TargetDir)$(TargetFileName)";#1

once you have built the application successfully if you see the output directory you will see the icons will have a shield on them indicating that the application requires UAC elevation.

image

And now if you run your built application it will prompt for UAC : and when you click on allow the application will show you the following Message :

 

image

That’s it you have your application ready to request UAC Elevation in the new operating systems.

 

hope it helps.

kick it on DotNetKicks.com




Popularity: 17% [?]

Continue reading...

ClickOnce Application,Expired Certificates & Public Key Token PART II

Thu, Jun 11, 2009

5 Comments

In the first part of this series I wrote the possible solutions available for the ClicOnce certificate issue. if you have missed it please read it before continuing.

        This post is not going to be a long one, I  just want to point out a very important issue, when updating the ClickOnce using the method specified in PART I .
        When using Jim Harte’s Method to update a ClickOnce with a new certificate, it checks for the public token key of the current application to find its uninstall string, and then execute runDLL32 to trigger the uninstall. below is the code which gets the uninstall string:
          /// <summary>
          /// Gets the uninstall string for the current ClickOnce app from the Windows 
          /// Registry.
          /// </summary>
          /// <param name="PublicKeyToken">The public key token of the app.</param>
          /// <returns>The command line to execute that will uninstall the app.</returns>
           private static string GetUninstallString(string PublicKeyToken,
                                    out string DisplayName)
          {
           string uninstallString = null;
           string searchString = "PublicKeyToken=" + PublicKeyToken;
           RegistryKey uninstallKey = _
                Registry.CurrentUser.OpenSubKey
                          ("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
           string[] appKeyNames = uninstallKey.GetSubKeyNames();
           DisplayName = null;
           foreach(string appKeyName in appKeyNames)
          {
            RegistryKey appKey = uninstallKey.OpenSubKey(appKeyName);
            uninstallString = (string)appKey.GetValue("UninstallString");
            DisplayName = (string)appKey.GetValue("DisplayName");
            appKey.Close();
          
           if(uninstallString.Contains(searchString))
                              break;
           }
                      uninstallKey.Close();
                      return uninstallString;
                  }
           

           

          In the above code it goes through registry keys of all ClickOnce application to get the uninstall string. and if that uninstall string contains the Public Token key of the current application, it will uninstall the application with that particular uninstall string. this is completely ok if there is only one application with that public token key. the public key of an assembly name identifies the developer (or the organization). Most organizations use only one public key to sign their assemblies with. so what if there is more than 1 application which has the same public token key?

      • The code will uninstall the very first match in the above code and it might uninstall some other application, instead of uninstalling the one we need to uninstall.
      • and it will  also install the new application from new URL, but with a different name sometimes (Eg: application name -1).
      • And if it had uninstalled another application, whenever user launches this application it will prompt the uninstall screen, each time when there are more than 1 application with the same public token key.

    The Image below shows an uninstall string, which contains the application name, and public token key:

    debug

    To avoid this problem of wrong application getting uninstalled, I changed this part of the code from above code to :

    if(uninstallString.Contains(searchString)) break; 

    this:

    if(uninstallString.Contains(searchString)
                   && uninstallString.Contains("yourApp.application"))
                        break;

           

          In the code above, I’m Checking the ClickOnce application name with extension, along with the public token key to find out the correct uninstall string. that’s it!.

          Hope this solves your time in someway.

    Popularity: 9% [?]

    Continue reading...

    ClickOnce Application,Expired Certificates & Public Key Token PART I

    Thu, Jun 11, 2009

    4 Comments

    Well, by this time I’m sure most of the ClickOnce application developers are aware of this problem. if you aren’t here is a basic description of what the problem is:

    Problem description

    ClickOnce allows application updates, only if the updated application manifests are signed with the same certificate (publisher) as was used to originally sign the application manifests. However, most CA’s like Verisign, and many enterprise customers own CA’s generate new certificates with new key pairs and only the same common name (CN).

    The certificate is used for the Authenticode signature element and for the strong name signature element of the manifest file to protect it against tampering, and to provide identity information for the trust manager. If the signing certificate expires and you publish an application update with a renewed certificate which has different keys, then the update will fail with the error message described in the KB article.

     

    There are lots of issues, and threads are being discussed how to resolve this issue. and these are the preferable solutions available on net.

    1. Manually Uninstall and Re install the application with new certificate – which we cannot do when we have a large number of client base who are using our ClickOnce Applicaiton.
    2. Install .net Framework 2.0 SP1 for XP /  .Net Framework 3.5 SP1 for vista or later, in these service pack s for .net Framework, this bug is fixed, and it will seamlessly update the application. – but we cannot force or inform clients to do that. yeah by this time most of the users might have installed .net framework 3.5 sp1 through windows automatic updates. but even if one guy haven’t done that KABOOM!!, clients are going to complain.
    3. Sign the new click once with 2 different keys – a solution by Daniel Margetic , even though developers may like it, when considering Automation, and  Infrastructure of build servers this might not be a favorite solution.
    4. Automatically Uninstalling the old application, and re-install the new application. – a solution by Jim Harte , using this method, we will be releasing an update for the application with expired certificate, which will have scripts for automatically uninstall the applicaiton, and install the application with new certificate, from a new location. the following thread on MSDN explains this process completely:
                VS2008 SP-1 change certificate, user can’t pick up update

      The last one seems to be a favorite of most of the people around the globe. it uses these classes by  Jim Harte  to uninstall and re install the application, using the following code:

    MessageBox.Show("Your Message to Client");
    DeploymentUtils.UninstallMe()
    DeploymentUtils.AutoInstall("<Path toNewApplication.application>");
    Application.Exit();

     

    you can have the new path as a sub folder of current applications update URL. you can get a ClickOnce applicaitons update URL using the line below :

    ApplicationDeployment.CurrentDeployment.UpdateLocation.Host

    That would do the trick. so what is it about Public Token Key ??. I will explain this in the PART 2 of this article.

    Hope it helps,

    Aneef

    I just posted the Part II of this series is here.

    Special Note:

    Thanks to RobinDotNet for his wonderful support through MSDN and through his blog to solve this problem.

    Popularity: 9% [?]

    Continue reading...
    Older Entries
    Follow me