Custom Build Action for sqlproj - visual-studio-2012

I came across this article which will add a custom "Build Action" option to the properties window for csproj. However, I would like to have a custom Build Action for the objects in a database project. Is there something I can add to the .sqlproj file that can do something similar? Can I add a custom Build Action at all for SQL?

You can edit sqlproj file and add your own msbuild target to it. It'll be equal to post\pre-build action.
Edited:
.SQLProj file is actually MSBuild script file (if we are both talking about SSDT SQL Database project one :)). So you can open it in any text editor and add something like this:
<Target Name="PreBuildEvent" AfterTargets="PrepareForBuild">
<Exec WorkingDirectory="$(OutDir)" Command="calc.exe" />
</Target>
It'll be very close to the way how PreBuild command being executed to build process.
Check that PrepareForBuild target is being called during your build process or change it to any other you want. You can go further and extend your build process with any msbuild tasks you want.

Related

How to run an action / script after files all files are copied to target install dir?

Due to the buggy nature of InstallShield, it is incorrectly modifying my app.config files replacing <clear /> with <clear></clear>
After my app.config file is copied to install path, I want to run a custom action that can scan for all config files and do a standard find and replace.
I don't need code for the find and replace, what I want to know is how / where to put this custom action using Installshield?
Your best bet would be creating a deferred execution custom action and place it near the end of the execution sequence. This will guarantee it would run after the files have been installed.
In the 'Custom Actions and Sequences', Create a new custom action of the appropriate type (depending on your implementation of this replacement action). Set it's In-Script Execution to 'Deferred' and in the Sequence section have add it to the Install Exec Sequence, After ScheduleReboot.
The easiest way to modify config/ini files after deployment of files is the option of INI File Changes or Text File Changes under the System Configuration tab. You can mention the config file location and the replacement changes that you want to perform. Please refer this link.

How to set Wix OutputName programmatically

We have a Wix bundle project and now need to produce an OEM-branded version of our product. I'd like to use the same bundle project to produce both the base product and branded bundles rather than creating a second bundle project.
I'm familiar the Wix localization functionality (WXL files), and it looks like I could use it for this, but I'm stuck on the OutputName of the bundle EXE which is defined in the WIXPROJ; it needs to have a different name for the branded version. That is, the same bundle project should produce both BrandedBundle.exe and BaseProductBundle.exe.
Is there a way to use the localization functionality to set the OutputName programmatically?
I don't know how to do it with the localization functionality, but there is a nother way to do this.
You can pass in a build parameter to the msbuild...
msbuild WiXInstaller.wixproj /t:Rebuild /p:DesiredName="OEMName"
If your Output name (in the wixproj) is defined as the following:
Application-$(DesiredName)
Then your output will actually be: Application-OEMName.msi
You can then have your build configured to run for a bunch of different OEM's if you need...
msbuild WiXInstaller.wixproj /t:Rebuild /p:DesiredName="OEMOne"
msbuild WiXInstaller.wixproj /t:Rebuild /p:DesiredName="OEMTwo"
msbuild WiXInstaller.wixproj /t:Rebuild /p:DesiredName="OEMThree"
It will run the build three times, and each will have its own output name:
Application-OEMOne.msi
Application-OEMTwo.msi
Application-OEMThree.msi
Best of luck.
Upon further review, I see that the "Cultures to build" field in the bundle's project properties page is disabled, so it appears that localization is not supported for bundles.
I did find some suggestions here: Creating localized WIX 3.6 bootstrappers., but it does not appear that it is possible to do what I wanted to do (change the OutputName) the way I wanted to do it (using localization).

Integrate mogenerator within Xcode 4

In my application I'm using Core Data stuff to enable persistent data saving. Since I've seen that mogenerator provides a good approach to create and maintain NSManagedObject subclasses (also with additional functionalities), I'm looking for some tips for integrating monogenerator within Xcode 4?
P.S. The question has been submitted based on share your knowledge, Q&A-style.
For Xcode 4.5+, the easiest way is to setup a "Pre-action" in your scheme:
Edit the scheme you want to build
Open the "Build" item and select "Pre-actions"
Click on the "+" and add a "New Run Script Action"
In the "Provide build settings from" popup, use the target
Paste this in the text area:
# Update the mogenerator files
cd ${SOURCE_ROOT}/${PROJECT_NAME}
/usr/bin/mogenerator --template-var arc=true -m ${PROJECT_NAME}.xcdatamodeld -M CoreData/Machine -H CoreData/Human`
Hit "OK" and build
A directory named "CoreData" will be created in your source file area along with the subdirectories "Human" and "Machine". You should now add the "CoreData" folder to your project.
Using mogenerator within Xcode 4 is quite simple.
First of all, download it at mogenerator.
Once done, switch to your Xcode project and, within the Project navigator, select your project (e.g. ProjectName).
Select ProjectName under TARGETS section.
Hold Add Build Phase. A menu appears. Select Add Run Script. A new run script will appear.
Within the text area (under shell field), add some text like the following.
cd ProjectName mogenerator --template-var arc=true --model DataModel.xcdatamodeld/DataModel.xcdatamodel
Et voilĂ . When you build the project you should be able to see generated classes.
For other info and options you should refer to mogenerator wiki.
Hope it helps.
P.S. Feel free to comment or modify the answer if something is wrong.

Is there a way to reference the last build label of a project in CruiseControl.NET?

Is there a way to reference the last build label of a particular project in CC.NET? I have a project set to execute a task that needs to run only when Force Build is clicked, but the path of the working directory changes based on the build number of our main trunk.
Currently I have a workaround where we set an environment variable to the value of %ccnetlabel%, but this seems like a dirty way to do it, and I am curious to know if there is a way to refernce the build label of a project directly.
We are running CC.NET 1.4.4.49.
I found out that with 1.4.4.49 there is not a way to reference another project's build label. I got around this by adding the following XML to the project configuration:
<labeller type="stateFileLabeller">
<project>Other-Project-To-Take-Build-Number-From</project>
</labeller>
What had happened was that once I figured out that %ccNetLabel% was actually the correct way to go about this, I tried just using it in this new project (we use %ccNetLabel% elsewhere which works fine). However, without specifying the labeller tag, %ccNetLabel% causes CC.NET to throw an exception saying that '%' was not expected.

CruiseControl.NET parameter passing

I have a CruiseControl.NET ccnet.config file, which monitors two different projects in the same project scope. If one of them changes, it has to trigger a build. But I wanted to know which project has been changed among the two. I have to pass them as a commandline parameter. Is there any built-in property?
Splitting the project to two projects seems like the right thing to do.
Specifically, split to to projects and add a Project trigger for the DML project.
This way if the table scripts are to be changed, both projects will be triggered and if only some DML statement changes, only the second project will be triggered.
In case both projects have common trigger then i recommend using a synchronization queue.
<queue name="Q_Synchronizer" duplicates="UseFirst" />
<project name="project1_name" queue="Q_Synchronizer" queuePriority="1">project stuff...</project>
<project name="project2_name" queue="Q_Synchronizer" queuePriority="2">project stuff...</project>
HTH

Resources