Ignore Dacpac Snapshot options during publish - dac

Is it possible to ignore the snapshot options set in a given database project's project settings, when deploying its dacpac (either through sqlpackage.exe, DacFx or Visual Studio)?

You can ignore all database properties during a dacpac publish... you can't specify which properties to ignore but they can all be ignored using /p:ScriptDatabaseOptions=False with sqlpackage.exe, for example

Related

Azure Web Job App.Config Transformation not working in TFS Release pipeline

I have an azure web job that I am deploying onto a test environment using TFS Release pipeline. Most of my configuration settings are in the Config settings of App Service Web app except the WCF end point section which is in the app.config.
Here are the settings I have on both the solution as well as build/release pipelines -
Kept the config files (app.config, app.release.config, app..config) of "Content" build action.
Removed the <DependentUpon>.
Verified the config transform files are in the drop file in the same
directory
".....\Local\Package\PackageTmp\app_data\jobs\continuous\JobName"
On the build pipeline I have disabled the config transformation using
/p:TransformWebConfigEnabled=false
On the release pipeline I am using "Azure App Service deploy" version
4.* with XML Transformation enabled.
But somehow, the deployed JobName.exe.config doesn't get transformed with neither app.release.config nor app.environment.config.
Could someone help me on what I am missing here? Thanks in advance.
But somehow, the deployed JobName.exe.config doesn't get transformed
with neither app.release.config nor app.environment.config.
Please check Configuration transform file naming conventions:
XML transformation will be run on the *.config file for transformation configuration files named *.Release.config or *..config and will be executed in the following order:
*.Release.config (for example, fabrikam.Release.config)
*.<stage>.config (for example, fabrikam.Production.config)
For example, if your package contains the following files:
Web.config,
Web.Debug.config,
Web.Release.config,
Web.Production.config
and your stage name is Production, the transformation is applied for Web.config with Web.Release.config followed by Web.Production.config.
To sum up:
It's expected behavior that your JobName.exe.config doesn't get transformed. Cause the XML Transformation options is used to transform your app.config file with app.release.config. (You can check content of your app.config file, it should be changed.)
To get a more powerful transform task, consider using File Transform task.

Is there any way to do selective deployment in azure devops?

I have a release pipeline which i use to deploy my resources to other environments. All works fine but the problem is that every time i deploy, all the resources even if no modification is made, are deployed. Is there a way through which i can do selective deployment; i.e. I deploy only those resources which have been modified. Any help would do. Thanks.
That`s a broad question. There is no out-of-box feature to select units to deploy. But you can use variables in the release pipeline:
Define a variable for each resource/unit and set some default value and "Settable at release time" property.
For each resource, define a separate task to deploy and define the custom condition, like: and(succeeded(), eq(variables['Custom.DeployUnit1'], 'YES'))
You can update these variables at the release creation time:
Is there any way to do selective deployment in azure devops?
There is no such out of box way to selective deployment in azure devops.
That because Azure devops release does not support release only changed files since only release changed files not always meaningful and could not archive what the project intend to release (such as the config file only changed in a commit).
But you could create a PowerShell script to compare timestamp for all files:
Create XML file that stores the last upload/publish information of
each files (e.g. file name, date time, changeset/commit version).
Create a PowerShell script file that included the logical to compare
files (get files metadata and compare with that XML file) and copy
updated files to specific folder
Publish the files in that folder
Check the similar thread for some more details.
Besides, if deploying via the deploy.cmd or MSDeploy.exe, you could also use the the -useChecksum WebDeploy flag:
WebDeploy/MSDeploy Quick Tip: Only Deploy Changed Files
Hope this helps.

WebJobs publishing to Azure doesn't create App_Data directory structure

I am trying to setup the CI for Azure Web Jobs using local TFS 2013. The build server itself is fully patched and has Build Tools 2017 installed. I have tried a standalone Web Jobs project in a solution as well as a solution with a Web project and Web Jobs project. From VS2017 the publish (in case of Web project and Web Jobs project) and Publish as WebJobs (in case of standalone Web Jobs project) work just fine and everything gets deployed. NuGet package Microsoft.Web.WebJobs.Publish is included. In both scenarios, the local build/publish publish properly website as well as jobs in app_data/... folder but TFS builds don't even create app_data folders. It seems the final collection of files for publishing is trying to pick the files from WebJobs/bin/** folder which isn't even created in TFS build. The TFS builds add additional argument /p:OutDir="C:\Builds\2\iPayment.Core\Dev-iPayment.ServiceBus.Agents\Binaries\\ and the assembly files for WebJobs are not collected and thus not dropped into app_data/... The build parameters are passed as
/p:PublishProfile=ReleaseWebDeploy
/p:_DestinationType=AzureWebSite
/p:DeployOnBuild=True
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
The symptoms are similar to what are described in http://chamindac.blogspot.com/2015/08/package-azure-web-job-with-tfs-build-to.html but my version of XAML build is slightly different than in the blog post and there is nothing to override the OutDir without probably modifying the build template itself.
In a standalone WebJobs project, if I use the MSBuild command line without the OutDir, the bin/** are created and packaged properly and get deployed to Azure but that option doesn't work for the solution where both WebProject and WebJobs are in a single solution and need to be deployed together. Also, I could not find any way to empty the OutDir outside of XAML definition.
I have confirmed the presence of webjob-publish-settings.json (in both cases) and webjobs-list.json (in case of where solution has WebProject as well as WebJobs), which is actually needed and works fine from VS2017 deployment. The publish profile is also correct and it is used by the VS2017 deployment. The TFS build is configured to build the solution in both cases. Microsoft.Web.WebJobs.Publish.1.1.0 is used which is the latest version.
It turns out that the OutputPath property was not being set in our template. There is no "Output Location" to be set as "As Configured". I ended up passing MSBuild Arguments and modifying the template to do the replacement for $(OutDir) in two places
MSBuildArguments.Replace("$(OutDir)", [BinariesDirectory]))] and MSBuildArguments.Replace("$(OutDir)", [outputDirectory]))] respectively for <mtbwa:MSBuild ...> under "Try to Compile the Project" and "For Each Configuration in BuildSettings.PlatformConfigurations"

Create separate assembly for each page in TFS Build 2012 defination

I am working on creating build from TFS 2012. I am able to generate build from TFS build templates but problem is that my website(ASPX pages), I am using after generating build is not creating separate dll for individual page.
But If I generate build from VS2012 I can generate build with separate assembly for individual pages.I can see this option when I click on publish and configure.
But how to have same option in Tfs Build templates ?? I have searched for MSbuild arguments and didn't find anything related to that
The best thing for us was... change to Jenkins and use make.
But seriously -> you can watch what changes in csproj/sln. Then most of options in this file are switches in MsBuild.
Check:
http://www.kunal-chowdhury.com/2013/05/how-to-auto-deploy-after-build-in-tfs.html
http://www.asp.net/web-forms/overview/deployment/configuring-team-foundation-server-for-web-deployment/configuring-team-foundation-server-for-web-deployment
The settings for "Create a separate assembly for each page and control" is saved in the publish profile with following format:
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<WDPMergeOption>CreateSeparateAssembly</WDPMergeOption>
So you can create a publish profile with this setting and specify the publish profile in TFS Build Definition.

TFS copy build output to source control

I have been working with a TFS project that supports copying build output to source control. If I open the build definition, this is under "Build Defaults". There is an option to copy build output to a source control folder.
I have just installed TFS Server 2013 (with update 2) and I want to use this feature with a new Team Project. However, if I create new build in VS 2012 or VS 2013 on the new server, I am not given the option to copy build output to source control. What gives?
I am not looking for a workaround, I want to know what to change so that my server acts like the first one I described. Thanks!
Screenshots of what I'm talking about: http://imgur.com/a/mhDNQ
This was a feature that was temporarily present in TFS, but I believe has since been removed. If I recall it was put in there specifically to support the cloud-hosted elastic build servers which didn't have access to network shares to drop the builds in.
Most people recommend against putting your build outputs into TFS. The best approach is to publish them to a NuGet feed.
In any case if you want to put your build outputs into TFS (or a NuGet feed) you'll have to modify the build workflow to do that yourself.
Open a new build definition > process.
Under template select new and you should be able to choose project and folder. Find your original template and link it. Your option should appear.
In TFS 2013 this has changed to be "store drops in TFS". When you select this option the drop I'd stored in a new inversioned store that you can access.
While you can easily get the files out as indecision or zips the built in tools like release management do not support it yet. I would recommend that you use this option but publish your assets to a nugget repository.
If your TFS is available online (VSO or https) then you can use MyGet to dynamically load the nugget packages that you are publish and make them available on a feed.
http://docs.myget.org/docs/how-to/use-tfs-online-git-with-myget-build-services

Resources