Windows Azure team recently released Azure SDK (June 2010) to support .Net 4.0.  The default framework used by this sdk is .Net 3.5 so any azure role compile in .Net 4 will not work by default.

For example, when I tried to create dev fabric package of a .Net 4 role, I got error that entry point assembly is not valid.

Below is workaround to get it working :

Sample scenario. Let say you want to deploy WCF service TestWCF as web role. The name of role is TestWCFWebRole.

1. Copy all files into single directory. This directory should include configuration files, azure role files and definition files. Note: it is not mandatory step but it make it easy to avoid troubleshooting path related issues. 

2.  Use cspack.exe with /rolefiles and /rolepropertiesfiles options.

2.a . create a new text file with name rolefiles.txt with below content

   TestWCFWebRole.dll;wcfroleoutput

2.b. create one more text file with name rolepropertiesfiles.txt and give below content:

TargetFrameWorkVersion=v4.0
EntryPoint=TestWCFRole.dll

3. create local only package using below command

cspack /copyonly ServiceDefinition.csdef /rolefiles:TestWCFWebRole;rolefiles.txt /rolepropertiesfile:TestWCFWebRole;rolepropertiesfiles.txt  /out:mypackage

4. finally deploy them

csrun mypackage ServiceConfiguration.cscfg

Links which helped me to troubleshoot above:

http://msdn.microsoft.com/en-us/library/dd179470.aspx

http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/045827e7-8873-41d3-a899-5689c94c8a85