Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for publishing profiles to Fake.Sql.DacPac.deployDb #2321

Closed
kmadof opened this issue May 20, 2019 · 8 comments · Fixed by #2366
Closed

Add support for publishing profiles to Fake.Sql.DacPac.deployDb #2321

kmadof opened this issue May 20, 2019 · 8 comments · Fixed by #2366

Comments

@kmadof
Copy link

kmadof commented May 20, 2019

Description

Fake.Sql.DacPac.deployDb doesn't support Profile parameter of sqlpackage.exe.

Profile parameter specifies the file path to a DAC Publish Profile. The profile defines a collection of properties and variables to use when generating outputs.

Expected behavior

I would expect to override default deployment arguments by those given in profile file.

Actual behavior

I tried to use AdditionalSqlPackageProperties

Target.create "DeployLocalDbWithProfile" (fun _ ->
    let connectionString = "Data Source=.;Initial Catalog=Notitia;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False"
    let dacPacPath = "./build/Notitia.dacpac"
    Fake.Sql.DacPac.deployDb (fun args -> { args with Source = dacPacPath; AdditionalSqlPackageProperties = [ ("Profile","C:/Dev/github/continuo/Profiles/Notitia.publish.xml") ] }) |> ignore)

It generated me such execution:
Starting target 'DeployLocalDbWithProfile' "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\sqlpackage.exe" /Action:Publish /SourceFile:"./build/Notitia.dacpac" /TargetConnectionString:"" /p:BlockOnPossibleDataLoss=true /p:DropObjectsNotInSource=false /p:CommandTimeout=120 /p:CreateNewDatabase=false /p:Profile=C:/Dev/github/continuo/Profiles/Notitia.publish.xml (In: false, Out: true, Err: true)
for which I got:

sqlpackage.exe : *** 'Profile' is not a valid argument for the 'Publish' action.

However if we chagne a bit execution above:

  • replace ** /p:Profile= ** C:/Dev/github/continuo/Profiles/Notitia.publish.xml with /pr:=C:/Dev/github/continuo/Profiles/Notitia.publish.xml
  • remove /TargetConnectionString:"" - we don't need this as profile file has it

it works.

Related information

  • Version of FAKE (4.X, 5.X)
@kmadof
Copy link
Author

kmadof commented Jun 12, 2019

I will take care of this with pleasure.

@matthid
Copy link
Member

matthid commented Jun 13, 2019

@kmadof Yes, a PR is very welcome ;)

@kmadof
Copy link
Author

kmadof commented Jul 5, 2019

Can someone help me with testing?

I followed testing modules steps: http://fake.build/contributing.html but paket takes nuget server package instead of local source pakage.

Before I run fake build I removed .fake folder and cleaned nuget cache (dotnet nuget locals all --clear)

And this is how my nuget import section looks like

#r "paket:
source ../FAKE/src/app/Fake.Sql.DacPac/bin/Debug
source https://api.nuget.org/v3/index.json
nuget Fake.IO.FileSystem
nuget Fake.Dotnet.MSBuild
nuget Fake.BuildServer.TeamCity
nuget Fake.Core.Target 
nuget Fake.Sql.DacPac == 1.0.0 //"

When I check folder ../FAKE/src/app/Fake.Sql.DacPac/bin/Debug from build.fsx I see that I have there nuget package

image

What am I doing wrong?

@matthid
Copy link
Member

matthid commented Jul 5, 2019

What am I doing wrong?

Have you deleted <script>.fsx.lock after adding == 1.0.0 and the local source?
Cou can actually inspect the lockfile and there should be a section like this:


  remote: ..\..\../FAKE/src/app/Fake.Sql.DacPac/bin/Debug
    Fake.Sql.DacPac (1.0.0)
      Fake.Core.Environment (>= 1.0)
      Fake.Core.Process (>= 1.0)
      Fake.IO.FileSystem (>= 1.0)
      FSharp.Core (>= 4.3.4)

@kmadof
Copy link
Author

kmadof commented Jul 7, 2019

You're right, After removing .fsx.lock file I got proper nuget package.

@github-actions
Copy link
Contributor

There has not been any activity in this issue for the last 3 months so it will be closed in 14 days if there is no activity.

@github-actions github-actions bot added the stale label Nov 30, 2019
@kmadof
Copy link
Author

kmadof commented Dec 11, 2019

@matthid can we remove stale label fromt this issue. Right now I'm testing changes moved to a new module. I will commit them today or tomorrow.

@matthid matthid removed the stale label Dec 11, 2019
@matthid
Copy link
Member

matthid commented Dec 11, 2019

I thought the bot would take care of this automatically as long as there is activity

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants