Trying to call 'ProjectServerServices.dll results in "A strongly-named assembly is required." error

0

I am trying to call Microsoft Project Server ProjectServerServices.dll from Microsoft SharePoint Custom Application page. 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?

c#
dll
sharepoint-2013
strongname
ms-project-server-2013
asked on Stack Overflow Jul 1, 2016 by STORM

1 Answer

0

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.

answered on Stack Overflow Jul 6, 2016 by STORM

User contributions licensed under CC BY-SA 3.0