Han,
The code for this is in the ModuleActions property of the EditModuleDefinition control. This is the code that produces the Create Private Assembly menu item. We'll need to look through this to figure out when the menu item is or isn't added.
1: Public ReadOnly Property ModuleActions() As ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
2: Get
3: Dim objDesktopModules As New DesktopModuleController
4: Dim mid As Integer
5: If Not (Request.QueryString("desktopmoduleid") Is Nothing) Then
6: mid = Int32.Parse(Request.QueryString("desktopmoduleid"))
7: Else
8: mid = Null.NullInteger
9: End If
10: Dim objDesktopModule As DesktopModuleInfo = objDesktopModules.GetDesktopModule(mid)
11: Dim Actions As New ModuleActionCollection
12: If (Not objDesktopModule Is Nothing) AndAlso Request.IsLocal Then
13: If Not objDesktopModule.IsAdmin Then
14: 'Create the DirectoryInfo object for the folder
15: Dim folder As New DirectoryInfo(Common.Globals.ApplicationMapPath & "\DesktopModules\" & objDesktopModule.FolderName)
16: If folder.Exists Then
17: lblModuleCreateMessage.Visible = False
18: Actions.Add(GetNextActionID, Services.Localization.Localization.GetString("PrivateAssemblyCreate.Action", LocalResourceFile), _
ModuleActionType.AddContent, "", "", EditUrl("desktopmoduleid", mid.ToString, "package"), False, _
SecurityAccessLevel.Host, True, False)
19: Else
...
40: End If
41: End If
42: End If
43: Return Actions
44: End Get
45: End Property
So, if you can follow what's going on here, there are two main checks that are going to affect if you get that menu item. Your request has to be local, and the module directory that you've specified has to exist.
Hope it helps,
*EDIT: added clarification after the fact*