MSBuild LightSwitch project "PublishSchemaToScript" task failed unexpectedly

Ian Hannah 21 Reputation points
2020-10-05T09:26:06.06+00:00

Hi,

I have converted a VS2012 LightSwitch project to VS2015 and I have one remaining issue.

The project builds correctly in VS2015 but it doesn't compile using msbuild. The error that I am getting is:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\LightSwitch\v5.0\Publish\Microsoft.LightSwitch.Publish.targets (634,9): errorMSB4018: The "PublishSchemaToScript" task failed unexpectedly. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Dac.Extensions, Version=13.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.SqlServer.Dac.Extensions, Version=13.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at

So it looks like it is in the publish of the SQL script. However the server has the file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\Microsoft.SqlServer.Dac.Extensions.dll available.

For some reason it seems like MSBuild cannot find this file.

I can publish from Visual Studio without any issues at all so msbuild is missing something to make the publish work form the command line.

I have also tried this:

D:\CCNetSrc\Licensing\Licensing\PP.Licensing.PPLicenseManager>"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" PP.Licensing.PPLicense.lsxtproj /p:AssemblySearchPaths="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130" /p:AdditionalLibPaths="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130" /t:Publish

To try and force msbuild to have the ability to locate these dlls as well but this does not work.

Any ideas?

Thanks

Ian

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,547 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,416 Reputation points
    2020-10-06T06:06:16.693+00:00

    Hi IanHannah-5056,

    Thanks for taking time to report this problem with us. The LightSwitch project is not recommended to run with msbuild tool. Generally, you may need to configure a build server for that. And you could refer to the related thread we have discussed here: https://social.msdn.microsoft.com/Forums/en-US/cddfdc66-8568-4cc5-aa9a-f5d846e8e3a1/problem-with-building-lightswitch-project-for-release?forum=lightswitchgeneral

    Best Regards,
    Dylan

    0 comments No comments

  2. Ian Hannah 21 Reputation points
    2020-10-06T15:06:29.983+00:00

    Hi Dylan,

    We are using CruiseControl to build the project. This code builds the solution:

    <msbuild>
        <executable>C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe</executable>
        <workingDirectory>D:\CCNetSrc\Licensing\Licensing</workingDirectory>
        <projectFile>PPLicense.sln</projectFile>
        <buildArgs>/p:Configuration=Release /p:Platform="Any CPU" /verbosity:minimal</buildArgs>
        <targets>Build</targets>
        <timeout>600</timeout>
    </msbuild>
    

    Do you know what steps I need to do to actually carry out the publish?

    Thanks
    Ian


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.