Referenced assemblies (DLLs) suddenly not being copied on publish
Asked Answered
K

1

9

I'm facing a weird problem with the deployment of a referenced library (ServiceStack.OrmLite) during Web project publishing. It was working fine until last week or so, and now suddenly some ServiceStack DLLs are not being copied when the project is published to local file system, FTP or Web Deploy, from Visual Studio or msbuild.

OrmLite reference is added to a class lib project via nuget. The class lib project reference is added to the main Web App project. When I publish the Web App project, it compiles and copies all the files except three of the five ServiceStack.OrmLite DLLs (namely ServiceStack.Common, ServiceStack.Interfaces and ServiceStack.Text are not copied). I've checked (and even reset) the 'Copy Local' property to 'true' for all DLL references, but the problem persists. I've also checked that OrmLite is not registered in GAC.

Any tips or suggestions are appreciated.

Update 1:

I came across a bunch of posts related to the same issue (but not with ServiceStack in particular). It seems like Visual Studio and msbuild [rightfully] ignore any indirect references in a project during publish.

Here are some solutions I came across:

  1. Reference the assemblies in the main project as well.

  2. Use a build script to copy the DLLs as a post-build event.

  3. Add a dummy (mock) method to the class lib, and instantiate any class from the assembly or namespace that doesn't get copied during publish. I chose this option and it partially resolved the issue. Now, ServiceStack.Common and ServiceStack.Text get copied, but ServiceStack.Interfaces still doesn't get copied even though I've created a mock instance of 'ServiceStack.Logging.LogManager' which is part of ServiceStack.Interfaces. So, basically I'm still stuck.

Kowtow answered 9/10, 2013 at 0:12 Comment(2)
Are you certain the assemblies aren't in any of the GACs? https://mcmap.net/q/99584/-net-4-0-has-a-new-gac-whyDrought
Do you find out any new solution for this problem? My problem is to identify the lacking DLLs as well, since everything works fine in local machine, but doesn't work in the integration server... Even if we have to manually add reference, how can we know which DLL to add?Storms
C
0

You can try this answer.

Basically, add a corresponding <dependentAssembly> into your {web|app}.config:

<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="ServiceStack.Common" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.9.70.0" newVersion="3.9.70.0" />
          </dependentAssembly>
       </assemblyBinding>
    </runtime>
</configuration>
Conflagrant answered 6/5, 2015 at 0:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.