Search code examples
dllssasclr.net-assemblycube

Missing <Files> tag in xmla to deploy assembly


I am trying to deploy a custom .NET assembly to my SSAS database. While doing so, I am facing Clr Assembly must have main file specified error and changing the target framework as given in the marked answer didn't solve it.

I also checked whether the dll was blocked as given here but as it has been compiled by the same system I am working on, it doesn't need to be unblocked and so the option doesn't even come up in properties of the assembly file.

I tried deploying with both SQL Server Data Tools 2012 as well as SQL Server Management Studio 2012, I get the same error. I checked the XMLA script that SSMS was using to deploy it and as it turns out the <Files> tag (which usually has the binary data of the assembly file) is missing. This might mean that SSMS and VS are unable to read the binary contents of the assembly.

Although the dll is not on network but local machine, I tried the workaround given here but it didn't work either as I am not able to deploy a dll in the first place that I can ALTER later.

Is there something I am missing out?


Solution

  • I managed to find a workaround for this. I used the following C# code to obtain the binary data for my assembly file.

    Convert.ToBase64String(File.ReadAllBytes(@"Path\To\Assembly.dll"))
    

    I then added a <Files> tag manually to the XMLA script along with the binary data that the above function returns. The assembly now successfully gets deployed after executing the modified XMLA script.

    This is how my <Files> tag looks like.

    <Files>
        <File>
           <Name>Assembly.dll</Name>
           <Type>Main</Type>
           <Data>
              <Block>
                   <!-- Binary Data Obtained After Base64 Encoding -->
              </Block>
           </Data>
        </File>
    </Files>