Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Wednesday, July 17, 2013

Error occurred in deployment step Recycle IIS Application Pool

This is the most annoying error in deploying a solution to SharePoint via Visual Studio. There are many reasons behind this error. It could be permissions, server configuration. So, I am planning to write all solutions here. :)

Complete Error Details:
Error occurred in deployment step 'Recycle IIS Application Pool': 0x80070005Access denied.

Solutions:

  1. Visual Studio should be running as Administrator. (As the solution is deploying to the server and which requires the admin privileges we must run as Administrator)
  2. User must be a local administrator on the server and should be a member of WSS_Admin_WPG. (Should need access to control IIS and App pool recycling operations)
  3. User must have owner (db_owner) access to the SharePoint Content database. (To deploy the package and activate feature at site collection level) 
  4. User must be a part of Farm Administrators group. (Adding solution package to FARM)
  5. Finally, check the current user is a site collection administrator on the site which the solution is deploying to. (This is very important!)
Hope you are good to go after following all the above instructions. Happy deploying!

Sunday, December 4, 2011

ASP.NET 4.5 new features

The new version of ASP.NET 4.5 has many features integrated and there are many additions to the Visual Studio as well. I am really excited to see all of these features in hand.... These functionality improvements makes applications more easier and faster. The features are added in both Web forms and MVC.

ScottGu's blog has all these features explained in detail as series of posts. Readers, please read all of these and know the new and great features coming for better productivity.

ASP.NET 4.5 New Features

Thursday, October 13, 2011

Get TaskID in SharePoint custom Visual Studio workflows

When you are working with custom workflows implementing in Visual studio, you might be sending the emails when a task is created. By default SharePoint sends an email when a task is assigned to a user. But, if you want to customize the email body and subject, then you will use send mail activity and will give link to the user. Here the problem starts.
In CreateTask activity in Visual Studio you cannot get the taskID as the task is not yet created. What to do??? So, to get the task identifier we have to implement the below approach.
  1. CreateTask Activity
  2. TaskCreated Activity 
  3. SendMail Activity
  4. OnTaskChanged Activity
  5. TaskComplete Activity
Remember, until unless the Activity TaskCreated is executed the TaskID will not be available in workflow context. The main reason behind is, the task created information is not caught by SharePoint workflow anywhere until we run this activity. So, in the TaskCreated activity you can get the AfterProperties of the task and in those properties you will get the recent created task identifier which is integer.

So, note that in custom workflows which are implementing through Visual Studio the only way you can get the TaskID is AfterProperties of the TaskCreated activity. I have wasted hours when I was learning these. Hope you liked it.

Saturday, October 8, 2011

Exception of type 'System.Workflow.ComponentModel.WorkflowTerminatedException' was thrown

This is the error you see when you use the TerminateActivity in Windows workflow foundation/Visual Studio workflow development for SharePoint applications. The main reason behind why this exception is "We are terminating the current running workflow in middle and framework rises the exception that the workflow is terminated".

The main use of this TerminateActivity is for terminating workflow only. But, I do not recommend to use this activity in your workflows as this is a kind of exception which is throwing by WWF framework. Instead we could try

  • Filter the logic by if, else and end the workflow.
  • By throwing the exception from your code and by using the FaultHandler catch the exception and write it to logs.
  • If we want to stop the workflow, we may write the code to stop the workflow by using CancelWorkflow(workflow).
  • Even if you use the activity if you do not want to  see the above exception in the workflow logs then you might do this. From the "Properties" window the attribute "Error" – fill this field with some text like "Workflow terminated as the reviewers not found for the current item" etc. So that user can understand the error clearly instead of the exception details.

Hope it helps.

Saturday, July 2, 2011

Upgrade SharePoint 2007 Visual Studio projects to 2010

This will be very helpful for the scenarios where we have custom solutions developed in Visual Studio 2008 for SharePoint 2007 environment and upgraded 2007 site to SharePoint 2010 and now in SharePoint 2010 we like to do some changes to that custom solution files. Simply, we have a SharePoint 2007 site upgraded to SharePoint 2010 and then it has some custom solutions developed like web parts, solution packages, features etc. Now, we are in SharePoint 2010 environment and like to extend the custom web parts, features from the earlier version of SharePoint. So, we need some sort of support to migrate our SharePoint Visual Studio projects from Visual Studio 2008 to Visual Studio 2010 to deploy to SharePoint 2010. I believe you all are clear till this point.

Get the tool here. http://archive.msdn.microsoft.com/VSeWSSImport/Release/ProjectReleases.aspx?ReleaseId=4183

It is simple project and when you build it, you will get executable and installs template to Visual Studio. But, the only preliminary requirement here is, you have to install Visual Studio 2010 SDK to open project.

Once everything is ready, you will see a new template named "Import VSeVSS project" under new project category. Here you go.....

Sunday, January 9, 2011

Visual Studio get pubic key token through external tools

This is very needful post. Most of the times in general development we work on class library projects which outputs DLL at the end. To use them we may need to know the Public Key Token of the DLL and use it wherever needed. We can know the Public key token either through the command prompt SN.EXE or by deploy it to GAC. But, what if you have some tool available and displays the Public key token within Visual Studio?

  1. In Visual Studio, go to Tools, and chose External Tools option as shown.'image
  2. You will be open up with a new window and enter the details as shown below.
    1. Title as “Get Public Key Token”
    2. Command as “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\sn.exe”. Remember, if you installed Windows SDK then the above location works, otherwise please chose the location where SN.EXE presents.
    3. Arguments as “-Tp "$(TargetPath)"”
    4. And uncheck all checkboxes at bottom and check only the option “Use Output Window”.
  3. At the end the settings should look as shown below.
    image
  4. Now, click OK button and go to tools, you will see there is a new menu item added in the list as shown below.image
  5. So, we are all set to use the tool now. Once you build the class library project, then just click on this “Get Public Key Token” option.  From the output window, you will see the BLOB of the DLL and public key token as shown below.image

That’s it. This is very helping one to me. Hope you also like it. Reference

Friday, November 26, 2010

Add web reference to a console application in visual studio

This is somewhat confusion to many people. We can add a service reference to console application, but when you right click on project, you didn't see a direct "Add Web Reference" option. But, there are so many requirements we have to add a web reference. So, I thought of posting it in my blog.
Solution:
  1. Create a console application using visual studio.
  2. Right click on the project and click on "Add Service Reference...".
  3. On the window, you will find the "Advanced" button at the bottom. 
  4. Click on the button and it will open service reference settings window. It has a button at bottom called "Add Web Reference".
  5. Click on it and add web reference as shown below.
That's it. We are done!!!

Saturday, September 11, 2010

The assembly from form template conflicts with a same named assembly in form template

This is the exception which was coming when I tried to deploy the infopath forms to SharePoint environment.

This is the background of the problem. I have infopath project created in visual studio and infopath has 3 views. According to my requirement I have to publish each view as a single infopath form. So totally 3 infopath forms as output. The infopath form has form code in c#. So, we have to deploy dll as well. But, as one version of infopath is already in production, I have to move the new version to production. But, according to some dependency problems, I have to keep the dll of the infopath project as same version as production. So, what I did was opening the AssemblyInfo.cs and changed the assembly version to hard coded like 1.0.3098.12321. There it started the problem. When I tried to deploy the infopath forms below is the exception it was coming.

The assembly infopathproject.dll from form template someform.xsn conflicts with a same named assembly in form template another.xsn

So, after research around 1-2 hours, I found that the three xsn forms are pointing the same dll [I mean along with version]. So, infopath forms are having same dll reference and leads the conflict.

The resolution for this problem is, reverting back the assembly information back to 1.0.* solved the problem. Now infopath forms are pointing to same dll but with different versions. So, problem resolved.

So, if you have the same requirement like same dll using for different infopath forms then, please don't forget to make auto generate versioning for the assembly like 1.0.*.

Hope this helps to solve the problem.

Thursday, August 26, 2010

Infopath form cannot save the following form - Form is Read Only

I have created the infopath project in Visual Studio and deploying into SharePoint environment. After some days, I got to change the infopath form to match the new requirement and redeploy to the SharePoint environment. I have opened the Visual Studio and spent half an hour to edit all the changes and tried to save the form. But, while saving it was started giving me the alert message that "The infopath form cannot save the following form: Template Name is ready only." I did not understand and check all file properties of the manifest.xsf and unchecked the checkbox read only. Still it was giving me the same error message. The error message was completely confused me and no any other clue. So, started searching in internet for the solution and after searched about an hour, found the information. If you have opened the infopath form, then close it. [No other way, you will lose all changes you have made.]

Resolution:
  1. Open the manifest.xsf in notepad.
  2. PublishUrl: Search for "publishurl". I believe, this pointed to the old location other than what actual the form is submitted to. Make it empty [No problem].
  3. runtimeCompatibilityURL: in the notepad, search again for "runtimeCompatibilityURL". Now change its value to "http://sharepointserver/_vti_bin/FormsServices.asmx". 
  4. If you are using the source control like VSS, Source vault, TFS or whatever then you have to do below things.
  • Open Visual Studio and checkout all the files in the Infopath Form Template folder.
  • Once all checked out, then close the Visual Studio and reopen.
    Note: replace sharepointserver in above url with your sharepoint server name.

    Check for more information here. MSDN
    That's it. Now, you have to reopen the file and do whatever changes you have to do. Enjoy.

    Tuesday, August 10, 2010

    Visual Studio intellisense for HTML 5

    It's the time to use the new technologies like HTML 5. Everyone of us knew about what this is and how easy now to generate some nice and rich UI without put much efforts. No complex javascript, no silverlight or flash is required most of the time and many more advantages. There are plenty of changes in CSS too. So, I believe we should start using HTML 5 in our applications. Because almost all browsers are supporting it.
    After I have written some posts on Visual Studio intellisense on Jquery and SharePoint 2010 ECMAscript Client OM, I want to write similar on the intellisense for HTML 5.

    This is very simple process than any other we have followed.

    Friday, February 12, 2010

    Team Explorer 2008 and TFS 2010

    Can we connect to TFS 2010 from Team explorer 2008? This is the question to most of the people who want to use TFS 2010, but, they don't have VS 2010 installed by chance. So, no need to bother. Visual studio 2008, Team explorer 2008 supports it and you can connect to 2010 TFS server. But, you need to install one package for the forward compatibility for VSTS 2008 version. You can download it here.
    Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010 (Installer)

    But, before you install it, make sure you have installed the VS SP1 and Team Explorer SP1.
    Visual Studio SP1 and Team Explorer SP1

    Before you install anything, please read the article to avoid problems.
    Installation order of packages

    That's it!!!

    Friday, January 15, 2010

    Report project template in Visual Studio

    This is the question most of the people asking. So, just thought of posting it for my readers.

    Report project template is associated with the reporting services in the Sql server. This template is  not an addin to visual studio or a specific download won't be available. You will see the template if and only if you install client tools while installing the Sql Server. So, to get that template, open the sql server setup file and select the client tools option from the list of features available. That's it!!! Let me know, if you have any issues to questions.

    Friday, December 11, 2009

    Could not load type Microsoft.TeamFoundation.WorkItemTracking.Client.workItemTypeDeniedOrNotExistException

    This is the exception we are getting when we try to view the workitems from the Team explorer in visual studio. The problem is, you installed the team explorer after you installed the Visual studio 2008 SP1. Because of this, all the workitem related dll’s are not referenced correctly. And result is below exception message.image

    Resolution:

    To fix this issue, we just need to reinstall the visual studio sp1. So, the order should be

    • Visual Studio
    • Team Explorer
    • Visual Studio SP1

    Hope this helps to the people who are facing the same issue.

    Wednesday, September 23, 2009

    Jquery intellisense in Visual Studio 2008

    This is a small tip I want to tell to my readers. I know, most of the dev's think like if Jquery intellisense is available in visual studio then that will be good :). So, this post will help you to solve that problem.
    Below are the steps we need to follow to get the intellisense working in Visual studio 2008. Before start with the steps I will tell you how it helps us.
    • Learn more and implement more: Because of having this intellisense support in vs 2008, we can solve so many problems and can implement so much in JQuery. It will be very difficult for everyone to remember all the functions and members for the Jquery objects. So, This will give more support to learn more and implement more.
    • Fast and rapid development of the client side scripting. Until you don't know what methods and properties it has you can't write program fast and efficient.
    • Time saving: Complete documentation for all Jquery objects, methods and properties. The inline description is more than enough to understand it well. Till these days, every time need to go to Jquery documentation site and need to search for what we need and read about them. But, now everything is in visual studio. Big time saving here.
    • Load time: I know, at this point you may think how it will effect load time by adding the Jquery documentation file to page. By adding the vsdoc file [~188Kb] to the page won't increase the page size or won't effect the load time at all. We will refer the documentation file while coding or at development time only but it won't render on the client side. How? I will explain it later in this post.
    Requirements:
    • Install Visual Studio SP1.
    • We need to download the vsdoc file from here.
    • Install the hotfix for visual studio before proceed.
    Steps to refer the documentation file(vsdoc):

    • Refer the documentation file to js file: If you need jquery intellisense on the js file then you need to write the below declaration as the first line of your js file.
    /// <reference path="jquery-1.3.2-vsdoc.js" />
    Note: the path value is the actual path of the vsdoc file.
    • Refer documentation file in ASPX page: This is what we need most of the times for writing inline scripting on the page. So, add below code to the <head> tag of the page for JQuery intellisense.
    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>
    <% if (false) { %>
    <script src="jquery-1.3.2.min-vsdoc.js" type="text/javascript"></script>
    <% } %>

    Note: The Jquery file reference should always be the top of the Jquery documentation file reference. And if you install Visual studio SP1 and the hot fix then there is no need to place the complete IF block from the above code. And the vsdoc file should be in the same folder where the jquery file is.
    Note: The short cut for the update intellisense in Visual Studio is Ctrl + Shift + J. So, once reference added please done it once to update the intellisense.

    How, Jquery intellisense work in Visual Studio?
    It's simple. What JQuery –vsdoc.js file contains? Nothing but the description text for all the defined methods and properties. So, when you refer the vsdoc file in js file, it will load that file into memory and set the meta data for the Jquery methods and properties. If you refer the vsdoc file in ASPX pages, then it will set the metadata as follows.
    First, Visual studio will look for the JQuery file, example jquery-1.3.2.js. And then it will look for the file which has the format jquery-1.3.2-vsdoc.js. If it matches then only visual studio loads the meta data and intellisense will work, otherwise not. So, your jquery file and documentation file should be having the same name with –vsdoc at end of the documentation file name.
    Note: Jquery file: jquery-1.3.2.js and Jquery visual studio documentation file name: jquery-1.3.2-vsdoc.js
    Lastly, I want to explain about the load time from above mentioned bullet. If you observe the code I have given, it has some server-side code integrated in it. I wrote if condition which always fails to execute the code inside the if block because I am passing false always to it. So, it never runs the code inside the if block and nothing loads on the client side related to vsdoc file. At the time of development, server-side code won't run but all the meta data will load because there is a script tag on the page. So, at development time, the vsdoc file will load, but when you browse the page, vsdoc file won’t render.
    That's it!!! I hope this will give nice idea of how Jquery documentation work in visual studio and how to add the reference to your files. Isn’t it? Please give your valuable feedback or comments on this post.

    Wednesday, June 24, 2009

    SQL Server 2008 Developer Training Kit

    The SQL Server 2008 Developer Training Kit will help you understand how to build web applications which deeply exploit the rich data types, programming models and new development paradigms in SQL Server 2008. Which has plenty of demos like

    • Spatial Types Demo
    • Intro to Filestream Demo
    • SQL CLR Nullable Types Demo
    • Programming with Filestream Demo
    • Reporting Services Web Application Integration Demo
    • Date and Time Support in SQL Server 2008 Demo

    and many more…. It is really very cool one. It will give you lot of features or options to implement more to add your own stuff. You can download it here.

    Windows 7 RC training kit on Visual Studio 2008

    Hi,

    Again I came up with Windows 7 blog post. I am waiting for Windows 7 release and here is a post which is for letting you know that we can customize Windows 7 system depending on our choice. We can get the toolkit and with the help of Visual Studio 2008 we will develop the modules and deploy it to Windows 7. This is easy to customize. For this you need to install the Windows 7 RC training kit. You can download it here.

    What it contains? It has the demos on how to do and examples for different modules and plenty of presentations, which explains the developers how to proceed. This is the one of the easiest way to understand things in little time. You can customize lot of areas of Windows 7 and below are the main modules.

    • Taskbar
    • Libraries
    • Multi Touch
    • Sensors and Location
    • Ribbon
    • Trigger Start Services,
    • Instrumentation and ETW
    • Application Compatibility

    You need to install Windows 7 SDK before start working on it. So what are you waiting for? Common download and rock on it!!!

    Monday, May 4, 2009

    Debug SQL Server stored procedures in Visual Studio

    We have a beautiful feature in Visual studio, where we can debug the stored procedures.
    Follow steps below to debug SPROCS.

    1. Go to Server Explorer (Visual Studio -- View menu -- Server Explorer),
    2. Right click on Data Connections -- select Add Connection,
    3. Here type sql server name and select authentication type(windows or sqlserver), and then type your database. Click ok. Now you are connected to sql server.
    4. Select a SPROC and Right click on stored procedure -- select Step Into Stored Procedure.
    5. Give the default values to debug. Now it starts Debugging.
    That's it!!! How simple it is...
    Let me know your feedback on it,