cake-contrib / Cake.SqlServer

Cake Build aliases for working with SQL Server
https://cakebuild.net/extensions/cake-sqlserver/
MIT License
30 stars 17 forks source link

Missing Microsoft.SqlServer.TransactSql, Version=13.0.0.0 #18

Closed LittleColin closed 5 years ago

LittleColin commented 7 years ago

Since 1.6 we are getting the following warning shown: build\tools\Addins\Cake.SqlServer\lib\net45\Microsoft.Data.Tools.Schema.Sql.dll (missing Microsoft.SqlServer.TransactSql, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91)

Is there an additional dependency that needs to be added?

Thanks for the plugin! Simon

trailmax commented 7 years ago

Yes, I've seen this warning too. This comes from bacpac functionality and DLLs that are dependency. Is this warning causing trouble?

jnm2 commented 7 years ago

I just saw this too. If I had a choice, I'd rather this warning wasn't shown.

trailmax commented 7 years ago

Fair enough. This is actually a sub-dependency missing from a nuget package Cake.SqlServer depends on. I'll what I can do.

trailmax commented 7 years ago

Can you guys check what you have in folder c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.TransactSql\?

I only have Microsoft.SqlServer.TransactSql.dll of v12.0 but the warning says it requires v13 and I can't find out if this v13 actually exists and where would I take it from?

trailmax commented 7 years ago

After a bit more digging, I don't think this dll Microsoft.SqlServer.TransactSql.dll actually exists or have been distributed by MS.

I've checked my folder c:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin\ - this is the place where SqlPackage.exe is hiding with dependencies. This is the key file for working with BACPAC files. And checking SqlPackage.exe by CheckAsm I see the same problem - missing Microsoft.SqlServer.TransactSql of v13, but GAC only contains v12.

So SQL Server distribution contains this problem. I don't think I can fix it on my own. Unless you know how to put redirectAssemblyBinding for cake scripts.

trailmax commented 7 years ago

Options here:

trailmax commented 7 years ago

Attempt to ILMerge failed:

Could not load ..\Cake.SqlServer\build-results\Merged.Cake.SqlServer.dll (missing Microsoft.SqlServer.TransactSql, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91) Compiling build script... Error: ../Cake.SqlServer/tests.cake(26,10): error CS0103: The name 'LocalDbCreateInstance' does not exist in the current context

trailmax commented 7 years ago

Right, I'm out of options on this one I'm afraid - see comments above to what's been tried.

I've spent enormous amount of time on this issue and would like to move on. Warning can't be fixed, unless Microsoft can fix it. So if you know people in MS on Data Tools team - please let me know how can I talk to them, or at least point them to this issue.

Here are the options I have: 1) Leave it like this and ignore the warning 2) Leave it like this, but pester MS to fix this 3) Split Cake.SqlServer into 2 packages - move all functionality related to BACPAC and DACPAC into new Cake.SqlServer.DacFx package. And when you don't need DacFx stuff, just don't load it.

Please have your say on how best would be to proceed. I'm inclinded to leave it and ignore the warning. But will do option 3 if enough people are keen to see it, but there will be breaking change and I'll have to come up with a migration plan.

pascalberger commented 7 years ago

@trailmax Have you tried using Costura.Fody instead of ILMerge? It allows to embed dependent assemblies as resources in your Cake addin, which is not as performant as ILMerge but way easier to get to work. It's also already used on a couple of other Cake addins.

trailmax commented 7 years ago

@pascalberger I don't think Cosutra.Fody will fix anything here - it still loads assemblies, only from resources and there still will be missing assembly. I'll give it a quick try, but I doubt it will change much.

trailmax commented 7 years ago

I think one of the good possibilities is to depricate DacFx from this project and redirect people into Cake.SqlPackage once it is a bit more stable. Also removing DacFx dependency from this repository will allow migrating to dotnet core 👍

trailmax commented 7 years ago

One more possibility - load the dacfx dlls dynamically only when needed - see this approach https://github.com/cake-contrib/Cake.Recipe/blob/develop/build.cake#L78-L92

jnm2 commented 7 years ago

I like that approach.

ehuggz commented 6 years ago

Any progress on this issue. I am trying to integrate with Microsoft Visual Studio Team Services and Cake is exiting with exit code 1 - which kills the build.

trailmax commented 6 years ago

@ehuggz Sorry, I run out of options and time for this issue -(

Though strange this issue only gives a warning and should not stop the whole build. I use Cake with this addon on VSTS and indeed it shows an error, but does not stop the build.

jnm2 commented 6 years ago

It doesn't kill the build for me. It's only a warning, so I'm pretty sure the exit code has to be caused by something else.

nawfalhasan commented 5 years ago

Could you update the Microsoft.SqlServer. dependencies to latest? That might solve this. As of now in version 1.13 of Cake.SqlSerer, Microsoft.SqlServer. DLLs are on 13.0.3485.1, whereas latest is 14.0.3811.1.

trailmax commented 5 years ago

@nawfalhasan tried it, same problem, only other issues down the line - see this branch https://github.com/AMVSoftware/Cake.SqlServer/tree/feature/140

trailmax commented 5 years ago

Looks like this is fixed in the lateset release of Cake.SqlServer v2.0.1. I've updated DacFx to v15 and that have fixed this issue.