Output the name of the current DLL being acted on using MSBuild - dll

This is probably a really stupid MSBuild question but if I have
<ItemGroup>
<Dll Include="<Path_to_DLLs>\*.dll" />
</ItemGroup>
And then
<SomeTarget useFiles=#(Dll)>
....do stuff
</someTarget>
What I want to do is to output the current item that #(Dll) is looping through. Basically I wanting to output the name of the current DLL being acted on.
I think this must be possible and it is probably so simple but it is driving me nuts!

Aha The joys of metadata.
On the creation of every item in MSBuild, specific MetaData is assigned to it.
In this case I could use %(Filename) to retrieve the file name
This is a full list of Well Known metaData

Related

save entity-find results and iterate throught it later

I'm doing a conditional entity-find and want to save the results somewhere to iterate through it later. I searched around and found 2 solutions. I'm using mySql btw.
1-create a temp table and insert results into it
2-saving results in a file (csv, ...)
now my question is:
1-which solution is preferable or maybe suggest another solution (common/trusted pattern)
2- how to do it? (for example I don't know how to create a table on the fly or drop it in moqui.Suggesting a resource/example source code etc. would be awesome)
thanks in advance
One possible approach would be to convert the list that your entity-find gives you to binary data and store it as a DbResourceFile using the moqui.resource.DbResource entities, and using the utilities from org.apache.commons.io etc.
EDIT - To expound in response to comment below, I was thinking along such lines as
<set field="fileData" from="yourList.toString().getBytes()" />
<service-call name="create#moqui.resource.DbResource" in-map="[filename:'ExampleListFrom01012019.bin', isFile:'N']" out-map="context" />
<service-call name="create#moqui.resource.DbResourceFile" in-map="context + [mimeType:'application/octet-stream', fileData:fileData]" />
Then bring it back after a find on the DBResource with something like
<set field="convertedBack" from="x.fileData.getBinaryStream()" type="NewList" />
I haven't tried this, and there are no near samples in the code that I know of.
This type of conversion between types is not best practice, but storing lists to iterate through them later is probably not either.
Perhaps it would help if you elaborated on your business requirement.

Concat in xslt, unable to get an image from server

I am new to xslt coding, I am trying to fix an issue in existing piece of code. I got stuck up at a point
<fo:external-graphic content-width="150pt"
content-height="50pt"
src="url:{concat('${OA_MEDIA}/',$revised_last_name,',',DOCUMENT_BUYER_FIRST_NAME,'.gif')}" />
The above piece of code is trying to find a .gif file in OA_MEDIA directory. Till that part I can understand fine.
When I am placing a file name as "Eckert,Tim.gif" (excluding the quotes) my program isn't picking that file
In the above piece, I printed $revised_lastname and $document_buyer_first_name..It's coming as Tim and Eckert, but it's still not picking the file. If I am hardcoding a file name like below it's working fine
<fo:external-graphic content-width="150pt"
content-height="50pt"
src="url:{concat('${OA_MEDIA}/','Tim','.gif')}" />
How can I print what value is coming into the src in above piece of code so I can see what file is it trying to look in the $OA_MEDIA.
Any suggestions are appreciated.
Thanks!
Your first problem appears to be that in your constructed URI and your file name, you have put the given name and the family name in different orders: Tim,Eckert.gif vs Eckert,Tim.gif. Choose one.
If you still have problems after that, your next step is to confirm that your concatenation is producing the value you expect. I'd add a line like
<xsl:message>Generating fo:external graphic with URI <xsl:value-of
select="concat('url:',
'${OA_MEDIA}/',
$revised_last_name,
',',
DOCUMENT_BUYER_FIRST_NAME,
'.gif')"/></xsl:message>
And if that did not shed light on what was going wrong, I'd insert individual messages to display the current value of $revised_last_name and DOCUMENT_BUYER_FIRST_NAME.
More than that it's difficult to say, because your question does not provide a short, self-contained, complete example that allows readers to reproduce the problem you are trying to solve. There is good advice on asking effective questions in the SO help files and in Eric Raymond and Rick Moen's essay How to ask questions the smart way.

WiX: How to create file name from a property value

I have a working WiX installer that correctly writes properties to certain INI files, which works fine, but I have a need to generate the name of an INI file on the fly, from the computer name, eg.
MACHINE(xxx).INI
where xxx is my computer name.
I have tried all sorts of combinations of properties and I just can't seem to get it working. Can anyone put me right ?
This is my latest attempt that doesn't work:
<Property Id="MACHINEINI" Value="MACHINE([%COMPUTERNAME]).ini" />
...
<IniFile Id="IniPermissions"
Directory="MYDIR"
Action="addLine"
Name="[MACHINEINI]"
Section="[ComputerName]"
Key="Permissions"
Value="TEST" />
I never see the value of MACHINEINI, as the filename that gets created is actually called
[MACHINEINI]
The value it writes in is correct, so I see the contents as follows:
[xxx] Permissions=TEST
(where xxx is my machine name)
I have tried using [ComputerName], [COMPUTERNAME], [%COMPUTERNAME]
When I build the installer, I get the following error:
C:\Source\blah\BLAH.wxs(50) : warning CNDL1077 : The 'MACHINEINI' Pro
perty contains '[COMPUTERNAME]' in its value which is an illegal
reference to an other property. If this value is a string literal,
not a property reference, pl ease ignore this warning. To set a
property with the value of another property, use a CustomAction with
Property and Value attributes.
The underlying Windows Installer table doesn't support this. Note that the FileName column is of type FileName. Only the Formatted type can take a [PROPERTY].
IniFile Table
You could need a custom action to write temporary records to the IniFile table to transform the file name. The advantage versus using a custom action to literally write the INI file is that rollback would be automatically handled for you.
It's not possible to tell you how to do this exactly since I don't know what language you'd want to use to write the custom action.
A simpler approach (from the installers perspective) would be to transform the [KEY] name inside a single INI instead of writing to different INI files.

MSBuild parse item metadata

Is there anyway to modify each item in an item group? For example, given this item:
<_CustomAreas Include="..\My.Project.*\Areas\**\*.*" Condition="'$(AppBuildFolder)' == ''" />
I want to remove the "..\My.Product.* portion. Basically we have separate project containing MVC areas, and in the Package / Deployment (MSDeploy) we want to copy them into the main project. Here's where the group is used:
<FilesForPackagingFromProject Include="%(_CustomAreas.Identity)">
<DestinationRelativePath>Areas\%(relativedir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
$(relativedir) is coming through as "..\My.Project.Plugin1\Areas**." and it ends up in the package as ZipFileRoot\My.Project.Plugin1\Areas (The .. backs out of the hardcoded Areas, and then it just creates the folder for the plugin\areas) where I'd like it to actually all end up in ZipFileRoot\Areas.
Thanks
Andy
The RegexReplace (credentials: guest/guest) task should be able to match \My.Product.* and replace with an empty string.
Something like this should work: (untested, need to verify escaping)
<RegexReplace Input="%(_CustomAreas)" Expression="\\My\.Product\..*" Replacement="" Count="-1">
<Output ItemName="_CustomAreas" TaskParameter="Output" />
</RegexReplace>
There's a little work getting the MSBuild Community Tasks up and running, but enough good stuff in there for me to find it worth the effort.
With MsBuild 4.0 You can use String methods directly in your script (or use inline tasks). With this option, you can edit your relativedir to delete the My.Project.* part .
You can see examples in this article : http://sedodream.com/2010/03/07/MSBuild40PropertyFunctionsPart1.aspx
Items in ItemGroups can have an Exclude attribute that allows you to specify items to leave out.

MSbuild built in variables

Could someone translate this, into a syntax that uses the built in variables?
\\myserver\builds\mybuild\Daily_20090525.1\Release\_PublishedWebsites\myWebsite
it should be something like:
$(DropLocation)\mybuild\$(?...)\Release\_PublishedWebsites\myWebsite
This might help:
substitute "mybuild\$(?...)" with "$(BuildNumber)"
I had a similar problem where I was trying to copy from the drop location to a "Latest" folder. I found that to construct the final destination of the files (\MyServer\MyShare\builds\MyBuild\Daily_20090708.14\Mixed Platforms\Release) translated to the following using variables:
$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.PlatformToBuild)\%(ConfigurationToBuild.FlavorToBuild)
I also found it helpful to use the Message task for troubleshooting. The following task will tell you what the variable translate to.
<Message Text="$(DropLocation)\$(BuildNumber)\%(ConfigurationToBuild.PlatformToBuild)\%(ConfigurationToBuild.FlavorToBuild)\"/>
To see the output, look in BuildLog.txt.
PS: My tasks that used the properties and items mentioned above where located inside <Target Name="AfterDropBuild">.