Comments (10)
Seems like sqlproj way of building is automagically inserting GOs between files?
from msbuild.sdk.sqlproj.
@molszews That's interesting. You don't get this error when building the .dacpac
using .sqlproj
?
As for some log verbosity, have a look at the output from the Build. It should show you the files being added to the model and will probably give a clue about which file is causing this error.
from msbuild.sdk.sqlproj.
I think this is related to PostDeployment scripts, I have many sql files that are not table models but migrations scripts, there is one marked as entry file in sqlproj:
<PostDeploy Include="PostDeployment\runMigrations.sql" />
which then uses sqlcmd syntax to include other files :r .\disableTriggers.sql
btw. these are set in sqlproj as <None Include="PostDeployment\disableTriggers.sql" />
when I remove PostDeployment dir with all migration scripts then dacpac builds just fine
from msbuild.sdk.sqlproj.
Yes, by default we include all .sql
files into the compilation, except for those in the folders Post-Deployment
and Pre-Deployment
(see the ItemGroup here). I believe those are the names of folders that you get when you create a new .sqlproj
project.
You could try to rename the PostDeployment
folder to Post-Deployment
, or you can edit the .csproj
and add this to it:
<ItemGroup>
<Content Exclude="PostDeployment\**\*.sql" />
</ItemGroup>
That will probably fix building the .dacpac
, but will probably not include the post deployment scripts you currently have. For that to work we'll probably need to add support for the PostDeploy
and PreDeploy
build actions somehow.
from msbuild.sdk.sqlproj.
I dont think those folders are created by default - just the Postdeploy/Predeploy Build action on the related scripts (and they can also refer to some scripts with build action None)
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
from msbuild.sdk.sqlproj.
;) Maybe that's just how we've setup our projects. Perhaps we shouldn't exclude those by default anymore, although that would be a breaking change. Either way we'll probably want to add support for post deployment scripts. I'm just not sure how those can be added to the model and if they resolve those references by default or that we need to add some logic to make that happen. That does sound like a different feature than what is being requested here though, so maybe we should open a separate issue.
from msbuild.sdk.sqlproj.
Agree, proper support for pre and post is a separate issue.
from msbuild.sdk.sqlproj.
ok, seems to me this issue can be closed now
from msbuild.sdk.sqlproj.
btw @jmezach any hints re local setup to play with MSBuild.Sdk.Sqlproj locally? I mean, other way than publishing nuget package
from msbuild.sdk.sqlproj.
Have a look at the test projects. They mostly just include the Sdk.props and Sdk.targets files directly which should work if you want to try out changes locally.
from msbuild.sdk.sqlproj.
Related Issues (20)
- Remove support for .NET Core 3.1 builds
- The current SDK bundles target framework '8.0' which is not supported by MSBuild.Sdk.SqlProj HOT 3
- Changes from one project are not reflected in other projects after build HOT 1
- Referencing MSSQL master dacpacs no longer accurate HOT 7
- Issue downloading from nuget... HOT 4
- Defining SQLCMD variables in the project prevents them from being set via environment variables
- [Question] Is there any plan to add unit testing capabilities to this project? HOT 1
- Escaping SQLCMD values that contain complex strings HOT 6
- Build warnings in latest VS HOT 3
- How to reference sql scripts from nuget in Post Deployment Script HOT 2
- Store procedure is not added as part of DACPAC HOT 1
- Dacpac Version HOT 1
- How can you include a script file with external references that aren't referencable? HOT 5
- EXEC warning SQL73162 --> Option TrustServerCertificate is missing HOT 2
- Support for linked servers HOT 5
- Referencing Microsoft.SqlServer.Dacpacs.Master fails HOT 5
- Referencing projects through `.sqlproj` files HOT 2
- Unable to drop tables, functions and procedures HOT 3
- Unrecognized command or argument '-p:UseSharedCompilation=false' when running on Github build HOT 9
- The SDK 'MSBuild.Sdk.SqlProj/2.6.1' specified could not be found HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msbuild.sdk.sqlproj.