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

Activate only selected features while deploying a solution package in Visual Studio 2010

In Visual Studio 2010 SharePoint Developer Tools is what we use to develop quick solutions to SharePoint. With these tools we can quickly deploy into SharePoint environment as well. But, the only issue we see here is, if we are trying to deploy a package which contains a set of 5 features then all of them will be activated by default. But, this might not be a valid behavior for us. We need to activate only 3 features while deploying the package and the other 2 features need to be installed into SharePoint but should not be activated. So, this is not available by default in the SharePoint Development Tools in Visual Studio 2010.

Recently when I was browsing in internet for this, how to deploy only selected features into SharePoint, but not all and found a great Visual Studio 2010 Extension. Which is a great tool to use and works perfect.

Download the extension here.

Once you get his extension, directly run it by double clicking on it. Before you see the changes, close any existing Visual Studio instances and reopen them. The extension will be added to Visual Studio 2010 and ready to use. But, to use it in your SharePoint project, you need to do one more exercise.

  1. When you right click on your SharePoint project you will see a new entry in the menu item as shown below.
    image
  2. Before you start using it, right click on the project and select "Properties".
  3. From the "SharePoint" tab, click on the New button to add "Active Deployment Configuration" as shown in figure.
    image
    image
  4. From the "Active Deployment Configuration" drop down, select the new configuration we just created.
  5. The configuration is same as others but the only extra action here is "Activate selected features" custom extension.
  6. Now, we are ready to use this feature. Right click on project, select "Select Features to activate…" and you will be open up with a window as shown below.
    image
  7. Now, you can build and deploy, you will see only the selected features will be activated only.
What a nice feature, I really need it in almost all the times. Thanks to Mavention for the great VS extension.
Read More...

Error occurred in deployment step ‘Recycle IIS Application Pool’: The communication object, System.ServiceModel.InstanceContext, cannot be used for communication because it has been Aborted

When we are developing custom code through Visual Studio 2010 for SharePoint 2010 sites and when we try to deploy the solution then we might see below error.

"Error occurred in deployment step ‘Recycle IIS Application Pool’: The communication object, System.ServiceModel.InstanceContext, cannot be used for communication because it has been Aborted."

When I see this very first time and did not get any clue of what it is looking for and why it is not able to communicate to SharePoint sites. After some time, I though of doing some combinations and all failed in deploying the custom piece to SharePoint.

Solution:
  1. Sometimes when I do rebuild the project and didn't hit "Package" and deploy directly from Visual Studio it successful. 
  2. If it is not successful then the only way is RESTART your visual studio. 
Frustrated? Yes, me too. But there is no way I found.

Read More...

More SharePoint 2010 templates in Visual Studio 2010

I am working on SharePoint 2010 these days and all the development is on Visual Studio 2010. The IDE is very cool and great features. Really very helpful for developers and administrators as everything is builtin like deploy, configure and easy development. I really love it. There are plenty of SharePoint 2010 templates are available by default in Visual Studio. Here are some from Microsoft with extra templates. Install them and use them for time saving and learn more...
http://code.msdn.microsoft.com/vsixforsp Read More...

SharePoint 2010 ECMAScript Intellisense in Visual Studio 2010

This post is a very big help to the SharePoint 2010 developers. We need the intellisense help to write code fast in our SharePoint applications. But, in SP2010 BETA I faced so many problems to find what methods a java script object has. After written a long post on how to get the java script intellisense working in Visual Studio 2008 this is now an easy for me to do the same on Visual Studio 2010. I just tried the same implementation in VS 2010 and that worked great. So, there I started and started using it in ECMAScript development. When I first see the intellisense working in VS 2010 felt very very happy and jumped into the air. Because, before to find the same methods in the ECMAScript object, I had wasted hours and hours. One of the example is this post "How to know all methods in SP object".

Solution:
By using reference tag everything possible.

  1. Create a js file in VS2010.
  2. Add the below script as the first line. /// <reference name="MicrosoftAjax.js" />
  3. The MicrosoftAjax.js reference should be in the first line. What is it? why it is needed? I know the question are always in mind... This is the default js files which comes with visual studio. It has all the default methods for Sys.* available. More details here. "Make sure any dependencies are taken into account in the order of declarations. Most of the time, you will want "MicrosoftAjax.js" to be on the top." Some of the SP objects depends on this file.
  4. Now, it's time to link SharePoint ECMAScript java script files linking. We need to add only debug.js files to the reference files to get intellisense working.
  5. /// <reference path="file://C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/SP.core.debug.js" />
    /// <reference path="file://C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/SP.debug.js" />
  6. SP.Core.Debug.Js and SP.Debug.Js files are the primary files needed to develop the ECMAscript. So, these two are the main and should be added to the js file after MicrosoftAjax.js reference.
  7. Like this, you can add whatever debug.js files available in the SharePoint 14 hive layouts folder. For example, if you are developing on Ribbon then the reference will be 
/// <reference path="file://C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/SP.Ribbon.debug.js" />

All at once:
/// <reference name="MicrosoftAjax.js" />
/// <reference path="file://C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/SP.core.debug.js" />
/// <reference path="file://C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/SP.debug.js" />
Note: Add all other debug.js files depends on your requirements right after the 3 reference tags.

Once add the reference tags, write something and see the intellisense loads all the methods in the specific SP object as shown below.

Hope this helps you a ton and make your development on ECMAScript more faster and faster than ever. Read More...

Fix for Not able to connect to SharePoint 2010 server web sites through Visual Studio 2010

Today, I started working on SharePoint 2010 server side object model to delete all the files from the document library using batch command. I have written all the code but, I failed to connect to the web site using SPSite class. I tried all combination like with server name, ip address and many more. Always I am getting the exception that "not able to connect to SharePoint site".
This is the actual exception :
"The Web application at http://nb16 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."

Below figure gives you complete details.
Below is the code [Console application] I have used to communicate with the sharepoint server.
class Program
{
static void Main(string[] args)
{
DeleteAllItemsUsingBatch();
}
private static void DeleteAllItemsUsingBatch()
{
using (SPSite site = new SPSite("http://nb16"))
{
SPWeb web = site.OpenWeb("/");
SPList list = web.Lists["Documents"];
StringBuilder sb = new StringBuilder();
sb.Append("");
string batchCommand = "<method><setlist scope=\"Request\">" + list.ID + "</setlist><setvar name=\"ID\">{0}</setvar><setvar name=\"Cmd\">DELETE</setvar><setvar name=\"owsfileref\">{1}</setvar></method>";
foreach (SPListItem item in list.Items)
{
sb.AppendFormat(batchCommand, item.ID.ToString(), item.File.ServerRelativeUrl);
}
sb.Append("
");

web.AllowUnsafeUpdates = true;
site.RootWeb.ProcessBatchData(sb.ToString());
web.AllowUnsafeUpdates = false;
web.Close();
}
}
}

Did you find any problem with the code? Not really. There are no problems with the code at all.. Then what's wrong?
When I researched on the net for the solutions I found below information.
1. Is SharePoint site running?
2. Did you develop code on the same SharePoint server?

But, everything fine. There are no issues. Then what was the problem? I was frustrated for 3 hours to find the solution.
Solution:
It's simple that the platform target in build options was set to the x86 format by default. It should be set to x64 to work correct.
So, sometimes the simple problems will take more time to fix. Enjoy the nice series of posts on SharePoint 2010. Read More...

Visual Studio 2010 BETA 2, Download now

Visual Studio 2010 BETA 2 is released. Get it and start researching on new things added in this version. We know it has more features and explorers in it and lot of options to simplify and faster development and .NET 4.0. So, why to wait. Get some time and download it now.

http://msdn.microsoft.com/en-us/vstudio/default.aspx

Read More...

Microsoft Visual Studio 2010 – The great IDE in the IT world

Visual Studio 2010. wow!!! Lot of features. What a product from Microsoft. It has almost everything integrated for developing all technologies related to ASP.NET like Silverlight, ASP.NET, SharePoint, WPF and QA related. The version of ASP.NET supporting is framework 4.0. This is again a big change.

We will take a look at the features available in the Visual Studio 2010.

First I am a SharePoint guy, so I will start from SharePoint tools available in Visual Studio 2010.

  • Till now, we have an option to add a new item for ASPX, ASCX, CSS, JS, Cs etc… Now we have an option to add a new web part project item and the Visual web part designer which loads a user control as a web part for SharePoint. Wow, how cool it is! Pretty much good.
  • We have another fantastic facility for adding an event receiver for SharePoint List/Library/Site and using the wizard to choose the event receiver type. From this, it will create a source file with that event receiver. [Again no need of creating a special project and write everything manually.]
  • A special explorer window which will pull information from the SharePoint sites like Lists, Libraries and other artifacts in SharePoint directly inside of Visual Studio when connected to a SharePoint site. It just like what we are seeing the team explorer in Visual Studio 2005/2008 when connected to Team Foundation server.
  • We have a package explorer to configure WSP files, feature files and other package related files in SharePoint. This is good thinking by the team to keep track of all the solution we are using in a SharePoint site at one place. The key F5 will compile, build, debug and deploy the solution to the specific site or farm depending on the configuration.
  • Till now if you want to create a SharePoint custom workflow we used to create a C# SharePoint workflow project and configure manually to implement it. But now, in this version they have added an ASPX workflow initiation form to a workflow project.
  • We already know about the WSP builder. From which we can create the solution file easily without doing any extra configurations etc, etc. Visual Studio 2010 includes the WSP file import to create a new solution automatically.

Second, I like Silverlight technology and development. I will explain the Silverlight features available in Visual Studio 2010.

  • While creating a Silverlight project you have an option to select the Silverlight version like 2.0 or 3.0
  • A good and great news for Silverlight developers that Visual Studio 2010 supports for both Silverlight development and editable design surface. WOW!!! this is the best and great feature. Isn’t it? [Thanks to Microsoft. When i am developing Silverlight application I am always having a thought that why MS VS team didn't give option to edit the Silverlight objects in editor inside Visual Studio. If I need to edit any thing I always need to go to Microsoft Expression Blend. But now editor is available inside it.]
  • More features available with Silverlight 3.0 in Visual Studio 2010. We will discuss this in upcoming blog posts.

Another feature that Visual Studio 2010 is integrated a great module for testing [QA].  You can take a look at it here.

The final feature is very cool feature that the new look for Visual Studio 2010. Very good rich and cool UI and very good user experience. I will come with another post that will give you good information about it with nice screen shots.

I think this information will help you to understand the features about Visual Studio in different scenarios. Keep an eye on the blog for more updates.

Read More...
Related Posts with Thumbnails
GiF Pictures, Images and Photos