1

Please help. I have been struggling for awhile with this issue.

I am developing custom application pages and deploying to Sharepoint 2013. The deployment fails.

My solution builds successfully. When deploying my solution from VS it says it cannot find an assembly - which is another project in the solution. I have added the assembly to the package file (add assembly from project output).

I tried the following:

Created an empty Sharepoint project called Test. Added an application page called Test.aspx. Added a label.

Added class libraries to the solution called BusinessLogic and DataAccessLayer and a class in each of these projects - the class names are the same as the project names.

Added references in Test to these 2 projects. Added the BusinessLogic and DataAccessLayer assemblies to the package.

If I call both assemblies from Test.aspx then it works (did this to check if there's an issue with DataAccessLayer). When I call DataAccessLayer from BusinessLogic then it still builds successfully but fails to deploy - says it can't find DataAccessLayer.

Code of Test.aspx: Partial Public Class Test Inherits LayoutsPageBase

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim DAL As New DataAccessLayer.DataAccessLayer
        Dim lstOfGroups As List(Of String) = DAL.GetDefaultDelegateGroups()
        If lstOfGroups.Count > 0 Then
            lbl.Text = lstOfGroups(0)
        End If

        Dim BD As New BusinessLogic.BusinessLogic
        lstOfGroups = BD.GetDefaultDelegateGroups()
        If lstOfGroups.Count > 1 Then
            lbl.Text &= " " & lstOfGroups(1)
        End If
    End Sub

End Class 

DataAccessLayer.vb: Public Class DataAccessLayer Public Function GetDefaultDelegateGroups() As List(Of String) Dim lstOfGroups As New List(Of String) lstOfGroups.Add("Members") lstOfGroups.Add("Visitors") Return lstOfGroups End Function End Class

BusinessLogic.vb: Public Class BusinessLogic Public Function GetDefaultDelegateGroups() As List(Of String) Dim lstOfGroups As New List(Of String) lstOfGroups.Add("Members") lstOfGroups.Add("Visitors") Return lstOfGroups End Function End Class

Above code works. Now change BusinessLogic to the following (BusinessLogic now calls DataAccessLayer so add a reference) then the deployment fails: Public Class BusinessLogic Public Function GetDefaultDelegateGroups() As List(Of String) Dim DAL As New DataAccessLayer.DataAccessLayer Return DAL.GetDefaultDelegateGroups() End Function End Class

0

This is a bug I think in Visual Studio. To fix it is simple though. When referencing the other assembly in your VS Project using the Package Advanced option, don't use the option for "Add Assembly from Project Output". Rather select the "Add Existing Assembly" and browse to where the DLL is. This has been a bug since 2010.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.