Closed bheemvennapureddy closed 1 month ago
here is the log for the internal dacpac
Starting: Copy InternalAuditDatabase Files to: D:\a\1\a/InternalAuditDatabase
==============================================================================
Task : Copy files
Description : Copy files from a source folder to a target folder using patterns matching file paths (not folder paths)
Version : 2.238.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/copy-files
==============================================================================
found 2 files
Cleaning target folder: D:\a\1\a/InternalAuditDatabase
Copying D:\a\1\s\src\InternalAuditDatabase\bin\Any CPU\SqlConvert\InternalAuditDatabase.dacpac to D:\a\1\a\InternalAuditDatabase\InternalAuditDatabase.dacpac
Copying D:\a\1\s\src\InternalAuditDatabase\shared.publish.xml to D:\a\1\a\InternalAuditDatabase\shared.publish.xml
Finishing: Copy InternalAuditDatabase Files to: D:\a\1\a/InternalAuditDatabase
Starting: NuGet pack
==============================================================================
Task : PowerShell
Description : Run a PowerShell script on Linux, macOS, or Windows
Version : 2.239.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\f09aa4e4-c9d8-4518-9411-71657752fe9f.ps1'"
Attempting to build package from 'package.nuspec'.
Successfully created package 'D:\a\1\a/Packages/InternalAuditDatabase\Database.InternalAudit.2428.0.3.nupkg'.
Finishing: NuGet pack
Need a runnable minimal repro as always if you want free support.
@ErikEJ How can i share the internal nuget packages if they are referred in the csproj ?
Happy to create a test repo - still very new to dotnet and still learning - Any help is appreciated
Just share the .dacpacs in your repro, and I can point nuget to the folder they live in
is this good enough https://github.com/CuroFinTechCorp/TestWinChk
@bheemvennapureddy Probably. What are the instructions to get the error to appear?
Why does it say ".sqlproj" - this SDK is NOT for .sqlproj !?
src\WinchkDatabase\WinchkDatabase.sqlproj
Where do you see that - that could be a typo. If you build the csproj pointed to local packages you should see that error
@bheemvennapureddy I see it in your first message, the log part.
thats a CI thing - ignore that - if you build the csproj you should see that error.
Yoy do not follow the guidelines for creating a .dacpac NuGet package:
Adding D:\a\.nuget\restore\Tiger\6.2.1\database.internalaudit\2313.0.3\contentFiles\any\any\databases\InternalAuditDatabase.dacpac to the model
The .dacpac file should be in the tools folder only in the .nupkg file
@ErikEJ you are not even giving me time to respond on the issue and you are closing it. Nuget package gets added to both folder
something like this
All the nuget packages added to the test repo has the dacpac in the tools folder as well.
It should not be present in the contentfiles folder.
Can we keep the ticket open until the issue is resolved ?
This is not a "ticket" and you are being offered free support!
Appreciate your help @ErikEJ
It should not be present in the contentfiles folder.
is there a way we can just look at tools folder @ErikEJ - we have so many cascading issues with removing contentFiles internally - i was looking around the code and couldn't find a place where the tools folder is considered vs others. i would like to hear your inputs and if there is a way we can have dacpacs in both places
I honestly do not see us making any changes because of this. Also unsure if that is actually the root cause, but in order to help I really need a much smaller targeted repro.
When ever you get a chance can you check this repo ? https://github.com/CuroFinTechCorp/TestWinChk
I did, and that is not a simple repro
Were you not able to see the same error on the dotnet build on that repo ?
@ErikEJ check this https://github.com/CuroFinTechCorp/TestWinChk/pull/1 i was able to reproduce this on Github Actions as well.
Yes, and manually removing the contentFiles folder with NuGet explorer unbreaks the build (I get some unresolved reference errors that seem unrelated to this issue)
Is there a way we can make it look only at tools folder and ignore contentFiles ?
@bheemvennapureddy No idea, but your .nupkg files does not follow the standard format that this SDK supports. Maybe @jmezach has advice / an opinion?
The SDK you developed is incredible, and we truly appreciate the excellent support and knowledge you share. We're currently migrating from existing SSDT-style projects to this SDK. However, we're facing challenges with internal packages referenced from ContentFiles. As we're in the midst of this migration process, we cannot remove ContentFiles references immediately. While we plan to eventually eliminate them, we need some assistance to navigate this transition.
Thank you once again for creating such an outstanding SDK and for the continuous support.
To be honest I don't know why it would look in the contentFiles
folder at all. That's not any logic in the SDK. We're only ever looking at .dacpac
files in the tools folder.
A binary log of your build could be helpful (dotnet build /bl
I think) as that would give us more insight into why this would be happening. But ultimately I think the problem is that the .dacpac
in the contentFiles
folder contains something that is not valid.
@jmezach it pretty much gives me the same log https://github.com/CuroFinTechCorp/TestWinChk/actions/runs/10027848308/job/27714039658?pr=1
here is the csproj of the refereced dacpac nuget package
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">
<Sdk Name="MSBuild.Sdk.SqlProj" Version="2.7.2" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SqlServerVersion>Sql150</SqlServerVersion>
<SuppressTSqlWarnings>71558,71502</SuppressTSqlWarnings>
<TargetName>InternalAuditDatabase</TargetName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RunScriptsFromReferences>True</RunScriptsFromReferences>
</PropertyGroup>
<ItemGroup>
<None Include="shared.publish.xml" />
<None Include="SchemaComparisons\SchemaComparison.scmp" />
<RefactorLog Include="InternalAuditDatabase.refactorlog" />
</ItemGroup>
<ItemGroup>
<PreDeploy Include="Scripts\Script.PreDeployment.sql" />
<PostDeploy Include="Scripts\Script.PostDeployment.sql" />
<None Include="package.nuspec">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Remove="Scripts\Script.PostDeployment.sql" />
<Content Remove="Scripts\Script.PreDeployment.sql" />
<Content Remove="Scripts\Post-Deployment\2429.0-PostDeployment.sql" />
<Content Remove="Scripts\Pre-Deployment\2429.0-PreDeployment.sql" />
</ItemGroup>
</Project>
Nuspec for reference
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Database.InternalAudit</id>
<version>$version$</version>
<authors>CURO</authors>
<owners>CURO</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>InternalAudit Database schema.</description>
<tags>internal audit database</tags>
<contentFiles>
<files include="any/any/databases/InternalAuditDatabase.dacpac" buildAction="Content" copyToOutput="true" />
<files include="tools/InternalAuditDatabase.dacpac" buildAction="Content" copyToOutput="true" />
</contentFiles>
</metadata>
<files>
<file src="InternalAuditDatabase.dacpac" target="contentFiles/any/any/databases" />
<file src="InternalAuditDatabase.dacpac" target="tools" />
</files>
</package>
@bheemvennapureddy If you run dotnet build /bl
locally you should get a msbuild.binlog in the folder where you ran it.
@jmezach here is the artifact on github actions https://github.com/CuroFinTechCorp/TestWinChk/actions/runs/10028087629?pr=1
Can we keep the ticket open ?
It not locked - yet.
@jmezach @bheemvennapureddy I looked at obj\debug\TestWinChk.InputFiles.txt, and it is evident that the .dacpac file is treated as if it was a .sql script:
C:\Users\xxx\.nuget\packages\database.hotelcardifornia\1.0.2\contentFiles\any\any\databases\HotelCardifornia.Database.dacpac
dbo\Functions\DatabaseSelect.sql
dbo\Functions\FN_AACbExport_CleanCity.sql
dbo\Functions\FN_AACbExport_CleanCustFields.sql
dbo\Functions\FN_AACbExport_GetGenerationCode.sql
dbo\Functions\FN_AACbExport_StripGenerationCode.sql
dbo\Functions\FN_ADDRESS_CSZ.sql
dbo\Functions\FN_ADDRESS_LINE.sql
dbo\Functions\FN_ADDRESS_LINE_1.sql
...
Updating the .nuspec in a package with contentFiles (change the buildAction) to this also unbreaks the build:
<files include="any/any/databases/HotelCardifornia.Database.dacpac" buildAction="None" copyToOutput="true" />
So like this:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Database.HotelCardifornia</id>
<version>1.0.2</version>
<authors>CURO</authors>
<owners>CURO</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectUrl>https://github.com/CuroFinTechCorp/HotelCardifornia.git</projectUrl>
<description>HotelCardifornia Database schema.</description>
<tags>HotelCardifornia database</tags>
<contentFiles>
<files include="any/any/databases/HotelCardifornia.Database.dacpac" buildAction="None" copyToOutput="true" />
<files include="tools/HotelCardifornia.Database.dacpac" buildAction="Content" copyToOutput="true" />
</contentFiles>
</metadata>
</package>
What does a buildAction none means ?
@jmezach @ErikEJ Thanks a ton for the support and help and that recommendation helped us a lot during this migration.
Here is my current csproj file which fails with Error SQL46010: Incorrect syntax near ].
it fails while adding an internaldacpac to the model