What are the challenges you face when working across database platforms? Take the survey
Options

Could not locate the assembly "Microsoft.SqlServer.TransactSql.ScriptDom"

During the Invoke-DatabaseBuild in ADO, I am getting warning indicating that ..ScriptDom and ..SQLCover libraries are unabled to be located. Although they are warnings, we'd like to resolve these.

We have vanilla build agents so would have to either install these independantly or include them in source control.Do you have any other suggestions, by that I mean is there an alternative way to reference these libraries using some sort of Nuget bearing in mind you can't currently reference nuget packages in .sqlproj?
Tagged:

Best Answer

  • Options
    G4734G4734 Posts: 6 New member

    Hi Eddie,

    Thanks again for looking into this for us, 

    We managed to find a work around, for what we are trying to do which is to use the latest SQLCover within our SqlChangeAutomation database project build without SQLCover.dll being stored in SourceCode. Normally (.Net) you could create a dependency using the NuGet Package Manaer within the project but because SqlChangeAutomation projects in Visual Studio are based on .sqlproj projects and these type of projects don't allow you include NuGet dependancies, we had to look at a different way:

     

    Solution was to include a package.config


    <?xmlversion="1.0" encoding="utf-8"?>
    <packages>
      <package id="GOEddie.SQLCover"version="0.5.0" targetFramework="net461" />
    </packages>

     

    And then to add the following to .sqlproj file

     

    <ItemGroup>
        <PackageReference Include="GOEddie.SQLCover" Version="0.5.0" />
     </ItemGroup>

     

    We then add a NuGet Restore task in the build pipline pointing it at the package.config and this seems to do the required job


Answers

  • Options
    Eddie DEddie D Posts: 1,792 Rose Gold 5
    Hi, thank you for your forum post.

    Are you using LocalDB or specifying a SQL Instance?

    If using LocalDB does your project include features that are not supported by localDB?

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    G4734G4734 Posts: 6 New member
    Hi Eddie, thanks for coming back to me,

    We are using a specific Enterprise SQL instanace specially provisioned for SQL builds, as far as I can see the project builds so I'm not 100% sure why - during the build - this warning is appearing?

    I would assume that this warning would be more appropriate when I'm actually running the tests and code analysis which is the next step in the ADO pipline. It's at this stage that I'm trying to figure out how we get these libraries onto the build machine which does not nativley have them installed? 
  • Options
    Eddie DEddie D Posts: 1,792 Rose Gold 5
    Hi, thank you for your reply.

    I attempted to find further information.

    I believe this problem is in regards to LocalDB supplied in Visual Studio.  In that it could be a reference to an earlier version of LocalDB where a later version is required.

    What version of Visual Studio are you using?

    Are you able to provide the full error message, which hopefully include the version number and other details?

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    G4734G4734 Posts: 6 New member
    Build SQL Change Automation Project CORE

    View raw log

    Starting: Build SQL Change Automation Project CORE
    ==============================================================================
    Task         : Redgate SQL Change Automation: Build
    Description  : Build and test databases with Redgate SQL Change Automation
    Version      : 4.0.2012161408
    Author       : Redgate Software
    Help         : [More Information](https://www.red-gate.com/sca/ps/help)
    ==============================================================================
    Setting ErrorActionPreference to "Stop" because no -ErrorAction argument was provided
    New-DatabaseConnection, SQL Change Automation 4.3.21139.25748, Copyright © Red Gate Software Ltd 2014-2021

    INFORMATION - Use of SQL Change Automation requires licensing in line with the Redgate End User License Agreement.
    See Red-gate.com/EULA for more information.

    Invoke-DatabaseBuild, SQL Change Automation 4.3.21139.25748, Copyright © Red Gate Software Ltd 2014-2021
    Validating SQL Change Automation project Z:\...bla.bla.sqlproj.
    ##[warning] ResolveAssemblyReference: Warning C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): Could not resolve this reference. Could not locate the assembly "Microsoft.SqlServer.TransactSql.ScriptDom". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
    ##[warning] ResolveAssemblyReference: Warning C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): Could not resolve this reference. Could not locate the assembly "SQLCover". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
    Schema validation successful.
    New-DatabaseBuildArtifact, SQL Change Automation 4.3.21139.25748, Copyright © Red Gate Software Ltd 2014-2021
    Export-DatabaseBuildArtifact, SQL Change Automation 4.3.21139.25748, Copyright © Red Gate Software Ltd 2014-2021
    Database build artifact exported to file 'Z:\bla.bla.bla.nupkg'.
    Finishing: Build SQL Change Automation Project CORE
  • Options
    G4734G4734 Posts: 6 New member

    Hi Eddie,

    Thanks again for looking into this for us, 

    We managed to find a work around, for what we are trying to do which is to use the latest SQLCover within our SqlChangeAutomation database project build without SQLCover.dll being stored in SourceCode. Normally (.Net) you could create a dependency using the NuGet Package Manaer within the project but because SqlChangeAutomation projects in Visual Studio are based on .sqlproj projects and these type of projects don't allow you include NuGet dependancies, we had to look at a different way:

     

    Solution was to include a package.config


    <?xmlversion="1.0" encoding="utf-8"?>
    <packages>
      <package id="GOEddie.SQLCover"version="0.5.0" targetFramework="net461" />
    </packages>

     

    And then to add the following to .sqlproj file

     

    <ItemGroup>
        <PackageReference Include="GOEddie.SQLCover" Version="0.5.0" />
     </ItemGroup>

     

    We then add a NuGet Restore task in the build pipline pointing it at the package.config and this seems to do the required job

Sign In or Register to comment.