Click on this icon to open the XML page.Tom Van Gaever - Blog
Search:   

Adding SharePoint SafeControl Element using Visual Studio 2010 and replaceable parameters 
Wednesday, March 31, 2010, 10:48 - SharePoint
Posted by Administrator
Problem
While trying to use my custom layouts page, I received an exception that indicated that my custom class was not registered as a safecontrol in the web.config.

Process information:
Process ID: 5272
Process name: w3wp.exe
Account name: DEV\spAppPool

Exception information:
Exception type: HttpParseException
Exception message: Could not load type 'Capgemini.SharePoint.Pex.Example.Layouts.Capgemini.SharePoint.Pex.Example.@default'.

Cause
I was confused, didn't visual studio created the SafeControls elements for me? WSPBuilder did it for me in the past so why won't visual studio do it for me?

Solution
Actually it can but it doesn't by default, Microsoft provided a nice and easy visual studio interface for us. So here it goes...

1. Open package.package in your visual studio project
2. Notice the 3 tabs (Design,Advanced and Manifest), Click on the manifest tab
3. You’ll see that your SafeControl element is not listed in the manifest, if it does, than you don’t have to complete this tutorial because everything is already in place
4. Click on the Manifest tab
5. Provide the following code inside the Assembly Element

        


This results in

  
    
      
        
      
    
  
  
    
  



You'll notice that I’ve used 2 special elements in the xml

$SharePoint.Project.AssemblyFullName$ and
$SharePoint.Project.AssemblyFileNameWithoutExtension$.

These 2 parameters are new in visual studio 2010 SharePoint development. Replaceable parameters, or tokens, can be used inside project files to provide values for SharePoint solution items whose actual values are not known at design time. They are similar in function to the standard Visual Studio template tokens

Check the related link at the bottom of this post for the MSDN website.

More information regarding replaceable parameters

Name

Description

$SharePoint.Project.FileName$

The name of the containing project file, such as, "NewProj.csproj".

$SharePoint.Project.FileNameWithoutExtension$

The name of the containing project file without the file name extension. For example, "NewProj".

$SharePoint.Project.AssemblyFullName$

The display name (strong name) of the containing project’s output assembly.

$SharePoint.Project.AssemblyFileName$

The name of the containing project’s output assembly.

$SharePoint.Project.AssemblyFileNameWithoutExtension$

The name of the containing project’s output assembly, without the file name extension.

$SharePoint.Project.AssemblyPublicKeyToken$

The public key token of the containing project’s output assembly, converted to a string. (16-characters in "x2" hexadecimal format.)

$SharePoint.Package.Name$

The name of the containing package.

$SharePoint.Package.FileName$

The name of the containing package's definition file.

$SharePoint.Package.FileNameWithoutExtension$

The name (without extension) of the containing package's definition file.

$SharePoint.Package.Id$

The SharePoint ID for the containing package. If a feature is used in more than one package, then this value will change.

$SharePoint.Feature.FileName$

The name of the definition file of the containing feature, such as Feature1.feature.

$SharePoint.Feature.FileNameWithoutExtension$

The name of the feature definition file, without the file name extension.

$SharePoint.Feature.DeploymentPath$

The name of the folder that contains the feature in the package. This token equates to the "Deployment Path" property in the Feature Designer. An example value is, "Project1_Feature1".

$SharePoint.Feature.Id$

The SharePoint ID of the containing feature. This token, as with all feature-level tokens, can be used only by files included in a package via a feature, not added directly to a package outside of a feature.

$SharePoint.ProjectItem.Name$

The name of the project item (not its file name), as obtained from ISharePointProjectItem.Name.

$SharePoint.Type..AssemblyQualifiedName$

The assembly qualified name of the type matching the GUID of the token. The format of the GUID is lowercase and corresponds to the Guid.ToString(“D”) format (that is, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

$SharePoint.Type..FullName$

The full name of the type matching the GUID in the token. The format of the GUID is lowercase and corresponds to the Guid.ToString(“D”) format (that is, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).



Package interface



Good Luck!


add comment ( 8 views )   |  permalink   |  related link   |   ( 3 / 893 )
Unit testing SharePoint 2010 using Pex and Moles: templates unavailable 
Tuesday, March 30, 2010, 15:37 - SharePoint
Posted by Administrator
A few months ago I attented a VISUG session about pex and moles (Peli De Halleux) at Microsoft Belgium. I was very curious because this technology made it possibe to unit test SharePoint solutions without 3th party tools...

So here it goes:
I downloaded the installer to my development environment and launched the setup



Everyting works fine except the part where I want to prepare my Stubs and Moles. You need to create a new .moles file based upon a new template called Moles and Stubs for Testing. the only issue was, this template was nowhere to be found !

the solution was quite simple, open command prompt and enter


It takes a while but after a few moments it is completed, now open Visual Studio 2010 again and select your Moles and Stubs for Testing template.


add comment ( 12 views )   |  permalink   |  related link   |   ( 2.9 / 829 )
SharePoint running on Amazon Elastic Compute Cloud (Amazon EC2) 
Monday, March 29, 2010, 22:41 - SharePoint
Posted by Administrator
Today I had the chance to configure a stand-alone sharepoint server on the Amazone EC2 (Amazon Elastic Compute Cloud) environment.

It takes a while to learn all the documentation and different options but if you are familiar with Hyper-V or any other technology, you will discover that the user interface of EC2 is very easy to understand.

]

These are the links I used to configure the EC2 server:
http://docs.amazonwebservices.com/AWSEC ... rtedGuide/

This firefox add-in elasticfox is a real timesaver:
http://developer.amazonwebservices.com/ ... nalID=1797

Setting the credentials in elasticfox:
https://www.amazon.com/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Faws-portal.amazon.com%2Fgp%2Faws%2Fdeveloper%2Faccount%2Findex.html%2F?action=access-key&tag=bucket-20

Problem 1: after each reboot the server receives a new servername, this is not so interesting because SharePoint and SQL server are not so happy with this. Resulting in "cannot connect to the configuration database". It seems like 1 little checkbox is the solving answer!
]
After I disabled this setting, renamed my server and rebooted... the whole SharePoint server worked like a charm!
add comment ( 4 views )   |  permalink   |  related link   |   ( 3 / 659 )
50 jQuery Snippets 
Tuesday, March 9, 2010, 19:00 - SharePoint
Posted by Administrator

Artemis Oliver posted 50 very interesting jQuery scripts.
http://addyosmani.com/blog/50-jquery-sn ... evelopers/
Nice post!




add comment ( 4 views )   |  permalink   |   ( 3 / 644 )
JQuery plugin of the moment : Ribbon control 
Sunday, February 14, 2010, 10:40
Posted by Administrator
Recently I found this awesome JQuery plugin on codeplex, the plugin called jQuery Ribbon. Low learning curve, easy to use and working just fine, just how I like them! Nice job Mikael Söderström.

I used this plugin to create an asynchronous shell around my blog.You can see the result in action at
http://tomvangaever.be/blog/ribbon/



JQuery plugin on codeplex
add comment ( 6 views )   |  permalink   |  related link   |   ( 3 / 799 )

<<First <Back | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Next> Last>>