none
Trying to call 'ProjectServerServices.dll results in “A strongly-named assembly is required.” error RRS feed

  • Question

  • I am trying to call Microsoft Project Server ProjectServerServices.dll from Microsoft SharePoint Custom Application page which should enable users outside of PWA to get for example a list of their projects, create automatically task on some event etc. I want to use PSI to access PWA information.

    This is my sample code:

    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using PSLibrary = Microsoft.Office.Project.Server.Library;
    using SvcProject;
    using SvcQueueSystem;
    
    namespace PWA.PSI.Test1.Layouts
    {
        public partial class GetProjectList : LayoutsPageBase
        {
            private const string ENDPOINT_PROJECT = "basicHttp_Project";
            private const string ENDPOINT_RESOURCE = "basicHttp_Resource";
    
            private static ProjectClient projectClient;
            private static SvcResource.ResourceClient resourceClient;
    
            protected void Page_Load(object sender, EventArgs e)
            {
                ConfigClientEndpoints(ENDPOINT_PROJECT);
                ConfigClientEndpoints(ENDPOINT_RESOURCE);
    
                Guid myUid = resourceClient.GetCurrentUserUid();
    
                lit.Text = "My GUID: " + myUid.ToString();
    
                // Get list of all projects.
                SvcProject.ProjectDataSet projectDs = projectClient.ReadProjectStatus(
                  Guid.Empty, SvcProject.DataStoreEnum.WorkingStore,
                  string.Empty, (int)PSLibrary.Project.ProjectType.Project);
    
                SvcProject.ProjectDataSet tempProjDs = null;
    
                // Create an empty ProjectDataSet for projects the user owns.
                SvcProject.ProjectDataSet myProjectsDs = (SvcProject.ProjectDataSet)projectDs.Clone();
    
                for (int i = 0; i < projectDs.Project.Count; i++)
                {
                    tempProjDs = projectClient.ReadProject(projectDs.Project[i].PROJ_UID,
                      SvcProject.DataStoreEnum.WorkingStore);
    
                    if (tempProjDs.Project[0].ProjectOwnerID == myUid)
                    {
                        lit.Text +=  "</BR>Project -- " + tempProjDs.Project[0].PROJ_NAME   ;
                        myProjectsDs.Project.ImportRow(
                          (SvcProject.ProjectDataSet.ProjectRow)tempProjDs.Project[0]);
                    }
                }
            }
    
            public static void ConfigClientEndpoints(string endpt)
            {
                if (endpt == ENDPOINT_PROJECT)
                    projectClient = new SvcProject.ProjectClient(endpt);
                else if (endpt == ENDPOINT_RESOURCE)
                    resourceClient = new SvcResource.ResourceClient(endpt);
            }
        }
    }


    When i open this Custom Application Page within SharePoint i get the following error message

    Could not load file or assembly 'ProjectServerServices, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

    Whats wrong here?


    • Edited by BOG's Lab Tuesday, July 5, 2016 10:30 AM
    Tuesday, July 5, 2016 10:28 AM

Answers

  • You have first to create a Strong name key

    sn -k mykey.snk

    then change the following line in GenWCFProxyAssembly.cmd from

    %CSC% /t:library /out:%ASSEMBLY_NAME% %SOURCE%*.cs

    to

    %CSC% /t:library /out:%ASSEMBLY_NAME% %SOURCE%*.cs /keyfile:mykey.snk

    
    

    than the .dll will be compiled with a strong name.

    • Marked as answer by BOG's Lab Wednesday, July 6, 2016 1:17 PM
    Wednesday, July 6, 2016 1:17 PM