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

It should be possible to explicitly set sqlproj DACVersion field instead of relying on search for dacpac files #1944

Closed
POFerro opened this issue Jul 30, 2024 · 12 comments · Fixed by #2038 or #2052

Comments

@POFerro
Copy link

POFerro commented Jul 30, 2024

Azure DevOps Extensions

VersionDacpac

Is your feature request related to a problem? Please describe.

I'm trying to update a dacpac version through the pre-build option of VersionDacPac, I have an sqlproj file and that's what I'm trying to update.
With the current implementation the task is searching for tools in path ( visual studio/sqlpackage ), taking tremendous time, and failing if these aren't available on the agent, is searching for dacpac files ( which in fact might exist if there's any "garbage" from previous builds ) and only if it finds none it will update the sqlproj ( which is what I wanted the first place ) which is blazing fast and doesn't require any extra tools installed on the agent.

Describe the solution you'd like

If I had some parameter or different task to call in my case I would specifically say I wanted to update sqlproj file instead of any dacpac that might exist

Describe alternatives you've considered

I Considered using the task to version .net core project file but it requires the project to be from specific SDKs, even if I specified the Microsoft.Build.Sql sdk ( my project is already using the recent sdk style sqlproj ) it fails saying it's not a valid sdk style project

Additional context

No response

@rfennell
Copy link
Owner

rfennell commented Oct 9, 2024

Sorry, not sure how I missed this being logged month ago.

This is a duplicate ##1594 - that issue contains a workaround, would that work for you @POFerro

@POFerro
Copy link
Author

POFerro commented Nov 6, 2024

Hi @rfennell ,

Thanks for the answer, I had seen that issue yes, but my case is slightly different in since that I don't want to version any dacpac file, even if by accident they exist on the folders, what I want is just to version the sqlproj itself, before I build it.
For what I see in your code what would work for me would be a way to enter the else block directly, here:
image
Using a boolean input, or pointing directly to the sqlproj file, to direct the task directly to the else block would be the best.
The problem that I have now is that, besides taking too long to complete ( and I'm not even sure if my build agents have SqlPackage installed so I couldn't be sure about the toolsPath to provide ), if the task finds any dacpac on the file structure (ex: a dacpac reference) it will version that file and forget my sqlproj, that is a no go for me.

The workaround I used was version a Directory.build.props file that I added aside sqlproj just for the purpose of containing the Version property, which works but is very ugly :).

Thanks, best regards and congrats on the great tooling you provide, your tasks rock :)
POFerro

Copy link

github-actions bot commented Dec 7, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Dec 7, 2024
@POFerro
Copy link
Author

POFerro commented Dec 9, 2024

Hi @rfennell ,

Any news on this issue? Have you seen my comment? This is NOT exactly a duplicate of #1594 .

Thanks and best regards
POFerro

@rfennell
Copy link
Owner

rfennell commented Dec 9, 2024

Sorry I had missed your comment.

if you are trying to update the .SQLPROJ I think the DACPAC task is the wrong one to use. The issue as I see it is that there is no standard location in the .SQLPROJ (unlike a .CSPROJ file) for the version information. So anything you come up with will be 'home grown'

Maybe an update of the file could be done using generic XML file updater in my file tasks extension

@POFerro
Copy link
Author

POFerro commented Dec 9, 2024

Hi @rfennell,

Thanks for the quick reply, your task works fine if there are no dacpac files to update, here:
image

it falls back to updating sqlproj files and everything has worked perfectly in every project I have, the only drawback is the time it takes before proceeding to update sqlproj in my case ( since I don't have any tools installed nor dacpacs to update ).
My point and what works for me is to have a way to go straight to your "else", without searching for dacpacs or tools or anything.

From my understanding in sqlproj the version field is DACVersion and that is already implemented in your Update-SqlProjVersion function.

As a workaround, for now I'm doing something like you said but since your task is so close to achieving the goal I figured it would be interesting to have do it all ;).

Thanks and best regards
POFerro

@rfennell
Copy link
Owner

rfennell commented Dec 9, 2024

Sorry for being so slow to understand, yes of course I can add a parameter that skips the DACPPAC process and just does the SQLPROJ. I will look to get that written ASAP, hopefully this week

@POFerro
Copy link
Author

POFerro commented Dec 9, 2024

Thanks @rfennell , be looking forward for your update. ;)

@rfennell
Copy link
Owner

rfennell commented Dec 9, 2024

The new option will be in 3.11.7 which is running through the CI/CD pipeline now and will be published this evening

@POFerro
Copy link
Author

POFerro commented Dec 19, 2024

Hi @rfennell ,

Can you check the correction? I passed the parameter as True yet it is still searching for the tools path and thus taking a loooonnng time just to figure out it has to update sqlproj.

Thanks and best regards
POFerro

@rfennell
Copy link
Owner

Good catch, I am altering the logic flow so that the search for the tools is only done if processing DACPAC files.

It should be published as 3.13.x this morning (UTC)

@POFerro
Copy link
Author

POFerro commented Dec 26, 2024

Works like a charm.
Thanks @rfennell :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants