RSS

Fix: .Net 2.0 or 3.5 Setup Project Requires .Net Framework version 4.0

Mon, May 24, 2010

View Comments

Sorry again folks again I was MIA with loads and loads of work. trust me i have more than 30 drafts which i started and never got time to finish. anyway coming to the point this morning i was trying to deploy a windows service project using the setup project templates in visual studio 2010, and when i tried to install it on client machine i got the following message:

The Setup Requires the .Net Framework version 4.0

But I’m pretty sure that i had the project targeted to .net Framework 3.5 SP1, but still it was  requiring .net 4.0.  as usual i did a Google search and found this article with the trick to resolve it.

actually it was the dependencies in the setup project causing the issue, it was still targetting 4.0 even though my application targets .net 3.5 and by default VS2010 set the dependency to .Net 4.0.

if you have this issue all you have to do is the following :

  1. Double click on the dependencies of the setup project.
  2. Click on the .Net Framework
  3. And you will see the Property window will get enabled.
  4. Change the Version property to your desired .net Framework ( in my case 3.5).
  5. and build your setup again.

That’s it :) .

for the original article that gave me this solution visit here.

Just thought i would share this information which that might be helpful for those developers who are in migration process to VS2010 :) . hope it help guys!!.

Thanks,

Aneef

Popularity: 2% [?]

Continue reading...

Visual Studio 2010 RTM & .Net framework 4.0 Final version released

Mon, Apr 12, 2010

View Comments

Its been a long time i wrote something on my blog, thanks to my busy work schedule i have a large number of drafts saved lolz. this is just a quick post

Anyway today is another big day for .Net developers around the world, yeah the final version of visual studio 2010 is released.  visual studio 2010 is the next major  version of its predecessor with loads of new features.

if you want to see the launch event of visual studio you can see it here.

Scott Guthrie, and other geeks from microsoft tweeted that visual studio will be available for download around 10 am (PST).  and the good news is its available for the websitespark subscribers too :)

here are some of those tweets for you :

@shanselman: Developers: MSDN will be updated with #vs2010 downloads and details at 10am PST *today*! Pls RT! 

@scottgu:MSDN Subscribers & WebsiteSpark/BizSpark members can download VS 2010 Monday morning.

happy developing guys :)

Popularity: 2% [?]

Continue reading...

Visual Studio 2010 RC Now Available for Download

Wed, Feb 10, 2010

View 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: 2% [?]

Continue reading...

SCRUM- Quick Guide

Wed, Nov 11, 2009

View 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

View Comments

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: 5% [?]

Continue reading...

Scott Guthrie Announces the WebsiteSpark Program

Thu, Sep 24, 2009

View 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

View 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

View 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: 27% [?]

Continue reading...
Older Entries
Follow me