Specifying multiple MergeSection values when using LINK task on MSBuild - msbuild

Is there anyway to specify more than one MergeSection value for the MSBuild LINK task? (The MergeSection param is the same as the /merge param for link.exe)
http://msdn.microsoft.com/en-us/library/ee862471.aspx
When calling link.exe you can specify more than one /merge value, but that doesn't seem possible with the MergeSection parameter.
So far the only way I can see to make this work is by using the AddtionalOptions param, but I'm hoping there's a better way to implement this parameter.
Thanks

I think you may have to use AdditionalOptions.
In the Link task the MergeSections property is a string value, not an array, so you can only set one string. Link.exe does not seem to allow you to pass multiple pairs in one command line parameter, you must specify a separate MERGE command line parameter for each pair. The Visual Studio property page only allows a single string for the MergeSections property.

Related

Can I use filters in Intellij structural search to reference variable counts?

I am trying to create a custom inspection in IntelliJ using structural search. The idea is to find all methods that have one or more parameters, of which at least one is not annotated. Bonus: Only hit non-primitive types of parameters.
So far, I have created the following Search Template:
$MethodType$ $Method$(#$ParamAnnotation$ $ParameterType$ $Parameter$);
using these filters and the search target "complete match":
$Parameters$: count[1,∞]
$ParamAnnotation$: count[0,0]
However, this only hits methods without any parameters annotated. I want it to also match methods where only some parameters have an annotation but others don't.
Is it possible to reference the count of one variable in the filter of another, e.g. by using script filters? If so, how?
You can do this by creating a Search Template like this:
$MethodType$ $Method$($TypeBefore$ $before$,
#$ParamAnnotation$ $ParameterType$ $Parameter$,
$TypeAfter$ $after$);
Filters:
$Parameters$: count=[1,1] // i.e. no filter
$ParamAnnotation$: count=[0,0]
$before$: count=[0,∞]
$after$: count=[0,∞]
This will find all method with at least one parameter without annotation.

Is it possible to have database properties outside of any property file in Intellij

I want to ask is it possible to have database properties outside of any property file now I have database properties inside dbconfig.properties but I want to have it be supplied from outside passing as an argument for example.
Is there any suggestion to have this approach.
I would follow the documentation:
24.2 Accessing command line properties:
By default SpringApplication will convert any command line option
arguments (starting with ‘--’, e.g. --server.port=9000) to a property
and add it to the Spring Environment. As mentioned above, command line
properties always take precedence over other property sources.

Printing a MS Word document using JNA

I'm using the MSOfficeDemo/MSWord classes as a starter.
How can I print a document that is open in Word?
In a new method in the MSWord.java class I've tried:
this.invokeNoReply("Print", this.getDocuments());
this.invokeNoReply("PrintOut", this.getDocuments());
this.invokeNoReply("FilePrint", this.getDocuments());
I get an Unknown Name (hr=-2147352570) error for each of the above calls.
I've been searching for a week now and haven't found a solution.
Rather than guessing, you need to match your method signature to the documentation.
You need to actually print the active document (this.getActiveDocument()) rather than the collection of documents. Then refer to the Document methods to see which method (and arguments) to use, in this case PrintOut is the correct method.
What you pass for the parameters, you need to look at the various method signatures in ComLateBindingObject and pick the one that best matches your needs (you can pass one or two arguments, more than that you need an array.
This code should work... haven't tested it (don't have MSWord on my Windows VM) but combined with the links above it should get you in the right direction:
this.invokeNoReply("PrintOut", getActiveDocument());
If that doesn't work, try:
this.invokeNoReply("PrintOut", getActiveDocument().getIDispatch());
If you actually need to pass any of the parameters, you'll create a VARIANT for them and start filling in 1 or more of the parameters (or an array of them).

How to user user input variables in Build file?

prompted for user entry by I'm new to ant and I was wondering if it would be possible to create a global variable in the build file so that I can use it repeatedly throughout the file itself.
For example, if the command were 'ant a', I would be able to use that value 'a' throughout the build file (for example in a file path i.e C:/test/a).
The reason I want to know how to do this is because there are multiple values like 'a' (lets say all the letters in the alphabet), and instead of copying and pasting the same code 26 times, I would be able to have 1 piece of code that takes different values (depending on what the user enters). In java you are able to have a variable storing the user input, and use that variable throughout the code (same idea here).
I tried searching for this but wasn't sure how to word it.
UPDATE
With the help of some people I managed to solve what I needed.
So I managed to use Input Task to kind of fix my problem. I prompted the user for an entry by using the following command:
Then I can just use the value entered by the user anywhere i want by simply writing ${hold.it}. For example in a file path "C:/go/to/${hold.it}"
Have a look at Ant properties and the property task used to set them. For example, you can define a property named prop1 and pass its value using ant -Dprop1=some_value.
A property is "global" since after defining it, any part of the buildfile can use it.

How do I use Team Build Properties in MSBuild?

I have a simple tfs-2010 build definition using the default process template. In it I defined the Build Number Format using $(BuildID) to define part of the computed field. This works and I can see what BuildID's value is.
Now I try to pass the BuildID property to MSBuild as an argument:
/p:SomeProperty=$(BuildID)
However when I look at the build log I see SomeProperty literally equals $(BuildID) rather then the value of BuildID.
What am I missing?
Update for clarity: What I'm asking is how to reference as a Build Process Parameter in the Build Definition. For example Build Number Format has a default expression of $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)
You need to use a VB.NET expression. For example:
String.Format("/p:SomeProperty={0}", BuildDetail.BuildNumber)
The Build Number tokens, e.g. $(BuildDefinitionName), are specific to the Build Number Format process parameter. They aren't tokens that you can use anywhere else in the build process. Most are available in the BuildDetail object or from the environment. The Build Id is a bit of a special case, however. It comes from the identity column of the builds table and isn't directly exposed in our public API. You could extract it from the BuildNumber, like this:
BuildDetail.BuildNumber.Substring(BuildDetail.BuildNumber.LastIndexOf('/') + 1)
Note that you would need to do this in the XAML directly rather than putting a VB expression into the build process parameter editor GUI. That's because those values just get passed through as literal strings.