Xamarin.iOS versioning during build - xamarin.ios

I've been trying to get an automatic versioning system going for builds (mainly due to external crash analytics picking up each build as the same until I change the version manually). The format is simple, I take the CFBundleShortVersionString from the Info.plist, and append the current date and time (in yyyyMMddmmss format) as subversion.
The task I've put together for this:
<Project>
<Target Name="BeforeBuild">
<XmlPeek XmlInputPath="$(ProjectDir)Info.plist" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]">
<Output TaskParameter="Result" ItemName="VersionNumber" />
</XmlPeek>
<PropertyGroup>
<BuildNumber>$([System.DateTime]::Now.ToString(yyyyMMddmmss))</BuildNumber>
</PropertyGroup>
<XmlPoke XmlInputPath="$(ProjectDir)Info.plist" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" Value="$(VersionNumber).$(BuildNumber)" />
</Target>
</Project>
However it fails with the following error:
Target BeforeBuild:
[...]/[...].csproj(1069,5): error MSB3733: Input file "[...]/Info.plist" cannot be opened. For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
Done building target "BeforeBuild" in project "[...].csproj" -- FAILED.
What am I doing wrong? There's not much info about this error, at least not much that I could find and would help fixing it.

Related

Service Fabric: packaging code error: missing required references

After updating SF I've got an issue that prevents using of SF totally, I'll try to put a problem in words without code.
Service fabric application AppName.SF consists of an AppName.SF.StatefulActor and AppName.SF.StatefulService. Both reference to class library called AppName.Core.
Case 1: StatefulActor not references StatefulService - package performs OK:
AppName.SF\pkg\Debug\AppName.SF.StatefulActor\Code has AppName.Core.dll
AppName.SF\pkg\Debug\AppName.SF.StatefulService\Code has AppName.Core.dll
each package Code folder has AppName.Core.dll. Deployment performs successfully.
Case 2: StatefulActor references StatefulService - package performs BAD:
AppName.SF\pkg\Debug\AppName.SF.StatefulActor\Code has AppName.Core.dll
AppName.SF\pkg\Debug\AppName.SF.StatefulService\Code has no(!) AppName.Core.dll
So I get a missing reference error if I try to deploy application in cluster. Issue appeared after SF updated to 1.4.87-preview.
Looks like you've found a bug - we are investigating. In the interim, it should work if you build using msbuild.
For a workaround add the following to your application project (.sfproj) file:
<Target Name="CopyExtraPackageFiles" AfterTargets="Package">
<Copy SourceFiles="..\AppName.Core\bin\$(Configuration)\AppName.Core.dll"
DestinationFolder="pkg\$(Configuration)\AppName.SF.StatefulService\Code" />
</Target>
This makes some assumptions about the location of your AppName.Core project. Adjust the path if necessary.
This will manually copy AppName.Core.dll to the appropriate location in the package where it is missing.
EDIT:
Or try this for a general purpose workaround instead of the above code snippet. Let me know if it works.
<Target Name="EnsureProjectReferencesAreConfigured" BeforeTargets="GetCopyToOutputDirectoryItems">
<MSBuild
Condition=" '#(ServiceProjectReference)' != '' "
Projects="#(ServiceProjectReference)"
Targets="AssignProjectConfiguration"
Properties="Configuration=$(Configuration);Platform=$(Platform)" />
</Target>

Conditional force build publisher CCnet fails

I have two build projects. lets call them project A and project A.pack. When I force build project A it asks me for Boolean parameter if I want to build project A.pack.
But I can't make in publishers block of project A a correct way to force build the project A.pack. I use conditional task but it doesn't work. In log file ccnet writes only that it fails on conditional task. What a usual way to do this in ccnet?
Update:
Sorry for my English. It's not my first language.
What I wanted to do is this:
In project A I added Boolean parameter:
<booleanParameter>
<name>ExampleParam</name>
<true name="Yes">1</true>
<false name="No">0</false>
<display>Example Param</display>
<default>No</default>
<required>false</required>
</booleanParameter>
And added conditional forcebuild in publishers like this:
<publishers>
<!-- some other tasks .. -->
<conditional>
<conditions>
<compareCondition>
<value1>${ExampleParam}</value1>
<value2>1</value2>
<evaluation>equal</evaluation>
</compareCondition>
</conditions>
<tasks>
<forcebuild>
<project>A.pack</project>
<serverUri>tcp://localhost:21235/CruiseManager.rem</serverUri>
</forcebuild>
</tasks>
</conditional>
</publishers>
When I press "force" it asks me for "Example Param", I check "Yes" and when it finishes building dashboard says that build was succesful but ForceBuildPublisher task failed.
There is no information in server log about why force build task failed.
It's CruiseControl.NET-1.6.7
Update 20150808:
I convinced my colleagues to update CCnet. In version 1.8.5 it's possible to do a conditional build like I wrote.
If the boolean parameter is true then write to a file that A.pack watches. A.pack builds if the file gets dirty. See Filesystem Source Control Block for use by A.pack in listening to the file made dirty by A.

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)

I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:
The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.
The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets
The sample on this site is the following:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName> </FileName>
<DisplayName> </DisplayName>
<Description> </Description>
<FileContentType> </FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="lang" value=""/>
</Attributes>
</Content>
</VSContent>
My file looks like this:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>SSDTTest.snippet</FileName>
<DisplayName>SSDTTest</DisplayName>
<Description>SSDTTest</Description>
<FileContentType>Code Snippet</FileContentType>
<ContentVersion>1.0</ContentVersion>
<Attributes>
<Attribute name="lang" value="SQL_SSDT"/>
</Attributes>
</Content>
</VSContent>
I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).
The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)
The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.
Am I missing something?
Installed VS products on this box:
SSDT
SSDT-BI
VS Express for Desktop (2012)
Update
I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).
Now the question is: Does SSDT add any extensions to this XML schema?
It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.
I did not found any other resources related to this issue.
There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.

How to disable code analysis in MSBuild target ClCompile?

When I build my projects via MSBuilds scripts, I obtain the following message during the work of ClCompile target: Running Code Analysis for C/C++…
Output of MSBuild looks like:
ClCompile:
....
Source1.cpp
Source2.cpp
Running Code Analysis for C/C++…
After changing <RunCodeAnalysis> property in build scripts to false:
<PropertyGroup>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
this just disabled running RunCodeAnalysis MSBuild target, but it does not affect running code analysis in ClCompile target - it seems it should be disabled somewhere else.
How can I disable code analysis during execution of ClCompile target?
<EnablePREfast> should be set up to false.
I have used the following code:
<PropertyGroup>
<EnablePREfast>false</EnablePREfast>
</PropertyGroup>
More info at CL Task
In Project Property page, goto Code Analysis (the last one on left tree). There you can disable Code analysis feature. In VC10+, you just need to de-select second check box. In earlier versions, you set third property to No.

Include build output as attachment

We have a CruiseControl.NET Server 1.5.0.4401 running. One project uses an external compiler, which is included via exec-task. This compiler is configured to write its output into a textfile that is located in the artifact directory. The filename is keil_Revision-x.txt (x is the revision number) whereas the configuration for this file looks like %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
We want this output file to be attached to the e-mail report CC is sending for each build. The configuration of the email-publisher is (a bit shortened) the following:
<email from="buildmaster#xxx.yy" mailhost="zzz" mailport="25" includeDetails="TRUE" useSSL="FALSE">
<users>
<!-- Here are some users -->
</users>
<groups>
<!-- Here are some groups -->
</groups>
<converters>
<!-- LDAP converter-->
</converters>
<modifierNotificationTypes>
<!-- Several notification types -->
</modifierNotificationTypes>
<subjectSettings>
<!-- Here are some subject settings -->
</subjectSettings>
<attachments>
<file>${CCNetArtifactDirectory}\keil_${CCNetLabel}.txt</file>
</attachments>
</email>
The only problem is, that the files are not attached. The debug output on the cruise control console doesn't contain any error message. The artifact directory contains all files, only they are not attached. Where is the failure?
Are Integration Properties like CCNetLabel available inside CCNET configuration? I venture to doubt that. Up to CCNET 1.4.4 SP1 they weren't. So please check the attachment node in Your project configuration to see if CCNetLabel has been resolved properly.
You need to define preprocessor constants that can replace the integration properties like this:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<cb:define project.artifact.dir="C:\foodir" />
<project name="foo">
<artifactDirectory>$(project.artifact.dir)</artifactDirectory>
...
<publishers>
...
<email
from="buildmaster#xxx.yy"
mailhost="zzz"
mailport="25"
includeDetails="TRUE"
useSSL="FALSE">
....
<attachments>
<file>$(project.artifact.dir)\keil.txt</file>
</attachments>
</email>
</publishers>
</project>
</cruisecontrol>
You need to instruct your compiler to write the results to a file whose name is predictable by CCNET configuration. Since configuration has no access to the label it must not be part of the filename. If you want to keep the result files from being overwritten by each build, add an executable task that triggers a simple batch file whose purpose is to copy %ccnetartifactdirectory%\keil.txt to %ccnetartifactdirectory%\keil_%ccnetlabel%.txt.
Otherwise the answer to this question might help here as well.

Resources