1
Vote

TypeLoadException for Import-Module in Create-SharePointClientContext

description

Hi there,
i'm getting the a TypeLoadException for Type 'Microsoft.SharePoint.Administration.SiteHealth.SiteHealthStatusType' from assembly 'Microsoft.SharePoint.Client, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
and i don't know how to fix this.

I'm using the current PS-Version:
Major Minor Build Revision
3 0 -1 -1

SharePoint is running whitout any further Problems (wihtout domain) as on premisis.
Direct App Deployment via VS2012 is working. Does anyone know how to fix this?

Here the Complete Call (maybe this is helpful):
PS C:\TFS_WS\ShaPoiTP1\DeployScripts> C:\TFS_WS\ShaPoiTP1\DeployScripts\SharePointApp\SharePointAppDeploy.ps1
cmdlet SharePointAppDeploy.ps1 at command pipeline position 1
Supply values for the following parameters:
dropLocation: C:\Builds\drops\B5_OfficeTemplate3CodeplexInstructionsShPoHosted\B5_OfficeTemplate3CodeplexInstructionsShPoHosted_20140219.4
Connecting to http://win-n3kb5gvfiat/sites/DevelopmentSite1/...
Write-Error : A positional parameter cannot be found that accepts argument 'System.TypeLoadException: Could not load type
'Microsoft.SharePoint.Administration.SiteHealth.SiteHealthStatusType' from assembly 'Microsoft.SharePoint.Client,
Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name)
at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name,
PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Boolean isModuleLoad, Dictionary2& cmdlets, Dictionary2& providers,
String& helpFile)
at System.Management.Automation.Runspaces.InitialSessionState.ImportCmdletsFromAssembly(Assembly assembly, PSModuleInfo
module)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, Boolean trySnapInName, String
moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, ImportModuleOptions options,
ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found, String
shortModuleName, Boolean disableFormatUpdates)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase,
String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags
manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo parentModule, ModuleSpecification
moduleSpecification, String moduleBase, Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options,
ManifestProcessingFlags manifestProcessingFlags, Boolean loadTypesFiles, Boolean loadFormatFiles, Object privateData, Boolean&
found, String shortModuleName)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo
scriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version version, Version
requiredVersion, ImportModuleOptions& options, Boolean& containedErrors)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags
manifestProcessingFlags, Version version, Version requiredVersion, ImportModuleOptions& options)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase,
String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags
manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingExtensions(PSModuleInfo parentModule, String moduleName, String
fileBaseName, String extension, String moduleBase, String prefix, SessionState ss, ImportModuleOptions options,
ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, Boolean found,
IEnumerable`1 modulePath, String name, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags
manifestProcessingFlags, PSModuleInfo& module)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions,
String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()'.
At C:\TFS_WS\ShaPoiTP1\DeployScripts\SharePointApp\SharePointAppDeploy.ps1:52 char:5
  • Write-Error "Error occurred: " $_.Exception.ToString()
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Write-Error], ParameterBindingException
    • FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.WriteErrorCommand

file attachments

comments

XiaoyingGuo wrote Feb 25, 2014 at 9:01 PM

Hi,

Is the target SharePoint site a Developer Site (the site that uses Developer Site template)? Does it repro with you for all the apps you created (e.g. a new empty SharePoint app) or for a particular app?

Thanks,
Xiaoying

ironhaert wrote Feb 26, 2014 at 8:14 AM

Hi,
Yes the target site uses the Developer Site template and the issue can be reproduced for all apps (I actually only have empty and new SharePoint Apps).
It's my personal test environment for testing a Staging System für SharePoint.
So it's run in local vm without a domain controller.

Do you have any suggestions?

XiaoyingGuo wrote Feb 26, 2014 at 5:43 PM

I need more information in order to repro the issue, then we'd be able to further investigate. Could you please share with me detailed repro steps when you run into this issue? What I'm looking for include the following:
  • Your machine environment, including where the SharePoint site is running. Is it an on-prem SharePoint server or Office 365? Is the TFS you use on-prem or online? Which version do you use?
  • Each step before you run into the issue, from creating an app (which hosting type do you select for the app?) to how you make the TFS deploy your app.
Because I was not able to repro your issue on my configuration (as described in the document of this CodePlex project, with TFS online and Office 365 for an autohosted SharePoint app). The more details you can share, the more chances I can get to repro the issue before I can decide what action I can take.

Thanks!

Xiaoying

ironhaert wrote Mar 10, 2014 at 12:22 PM

Hi again,
Sorry for my late response but I've been on vacation.

To get to your questions:
  • My machine environment is a local virtual machine using Hyper-V, therefore i'm using on-prem SharePoint and also an on-prem TFS, both installed on the same machine. I'm using Sharepoint 2013 (BuildVersion 15.0.4551.1007) and TFS 2012U4 (Product Version 11.0.61030.0)
    *For creating the app i'm using the standard procedure and use as hosting type 'SharePoint-hosted'. For debugging i add an already created Developmentsite (http://win-n3kb5gvfiat/sites/DevelopmentSite1/) which can be reached from Visual Studio). The App project can successfully be created and immediately deployed via Visual Studio App Deployment (Build-->Deploy 'AppName1'
    I'm trying within the next days to get more detailed informatoin about the installation process and the system.
Nice Regards,
Marcel

XiaoyingGuo wrote Mar 10, 2014 at 9:12 PM

Thanks, Marcel. It helps. While we are setting up the same environment with yours to repro the issue, could you also let me know what else you installed mentioned in the Prerequisites section of the DOCUMENTATION page? E.g. did you install the SharePoint Online Management Shell?

Thanks,
Xiaoying