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

Sunday, September 25, 2011

Disable automatic activation of SharePoint features in Visual Studio 2010.

When we write our custom solutions for SharePoint 2010, we must know that all our features will be activated automatically on every time we deploy the solution over the SharePoint site selected at project creation time.



This is the default configuration that we have inside SharePoint 2010 tools for Visual Studio 2010. When you are doing development of a custom event receiver that manage activation or deactivation events of a SharePoint feature. In this specific sample, we cannot debug our code.

To solve this problem, you can modify this configuration and select to don't activate your features every time you have to deploy your solution. To do this, simply you have to open the project properties page through the "Solution explorer" toolbox, select the "SharePoint" tab and choose the configuration named "No Activation".
 

As we can disable the automatic activation of our features, we also have the possibility to create custom configurations in which we can insert deploy and retract operations, app-pool recycles, features activation and command execution of pre/post deploy actions.

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters.


If you receive the following error in Visual Studio while packaging WSP:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters

then simply move all your projects from

C:\Users\YOUR_USERNAME\Documents\Visual Studio 2010\Projects\

to root drive

C:\Projects

Visual studio does not allow absolute path that exceeds 260 characters. so use short filenames when you create any WSP package and create your project on root directory to avoid long absolute paths.

Friday, March 11, 2011

The Web application at ... could not be found. Verify that you have typed the URL correctly.

Yesterday my colleague showed me this error. He was trying to open a SPSite object using a URL and hitting the following error: 

The Web application at ... 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.

This is common, and can have several causes.

1. The obvious: The URL does not exist on the farm.  

Solution: Change the URL you are loading to the correct one.  

2. The not so obvious: the code is in a console or windows application which you are now running with an account that does not have permissions to connect to the SQL server. 

Solution: either run the application as a different user or grant the user permissions on the SQL database.

3. The last but most important: the code is in a console or windows application that is compiled with platform target x86, while your SharePoint server is x64. 

Solution: set the platform target to "Any CPU".