CruiseControl.net - CCNetUser property empty - cruisecontrol.net

Looking at a recent build log I noticed the CCNetUser property is set to empty, should it not be the user who has requested the build?
<cruisecontrol project="...">
<parameters>
....
<parameter name="$CCNetUser" value="" />
I want the username of the person who's just requested a force build so that I can send them an e-mail.

The CNetUser property can be empty if it's not a force build. If the build is triggered by a source control/project trigger then the property is empty.
If the build is forced via the dashboard and not cctray the property may be empty too.

Related

String was not recognized as a valid Boolean. in mvc5 show error in #using in razor

I am using mvc5 for application my local system application is working properly. but I upload publish file then server shows error show
Would be nice if anyone helps about it
Without seeing more code, it is hard to tell, but at a guess, you may want to look into your config file(s) and particularly the transformation side of this value in app settings.
<add key="ClientValidationEnabled" value="true" />
It may have an incorrect value which cannot be parsed, which is why the error is occurring down the stack after "get_clientvalidationenabled" is called.

Where to store configuration values in Azure Service fabric application

I am working on Azure Service Fabric Reliable Actor implementation. Any idea/link on where can I store the Configuration value (e.g. DB connection string) and how to access that in code.
A Service Fabric application consists of the code package, a config package, and the data (https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-application-model/).
You can use the config package to store and retrieve any kind of key-value pairs you need e.g. a connection string. Have a look at this article https://azure.microsoft.com/en-us/documentation/articles/service-fabric-manage-multiple-environment-app-configuration/ for more information.
You can add multiple ApplicationParameters file. Just copy and paste the same from Cloud.Xml and use for multiple environment configurations.
Steps to Make necessary changes
The values given in the Settings.xml need to be overridden in the ApplicationManifest.xml when it imports the ServiceManifest.xml .Below is the code supporting the overriding changes add them in the ApplicationManifest.xml.
a) Add the Parameter Default value first
<Parameters>
<Parameter Name="StatelessService1_InstanceCount" DefaultValue="-1" />
<!-- Default Value is set to Point to Dev Database -->
<Parameter Name="DatabaseString"DefaultValue="Server=someserver.database.windows.net\;Database=DbDev;user id=[userid];password=[Password];Trusted_Connection=false;" />
</Parameters>
b) Then override it in the ServiceManifestImport
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="StatelessServicePkg"
ServiceManifestVersion="1.0.0" />
<ConfigOverrides>
<ConfigOverride Name="Config">
<Settings>
<Section Name="DatabaseConnections">
<Parameter Name="DbString" Value="[DatabaseString]" />
</Section>
</Settings>
</ConfigOverride>
</ConfigOverrides>
</ServiceManifestImport>
The above code change will override the following code in settings.xml
<Section Name="DatabaseConnections">
<Parameter Name="DbString" Value="Server=someserver.database.windows.net\;Database=DbDev;user id=[userid];password=[Password];Trusted_Connection=false;" />
</Section>
Overall when the application is deployed the values in the ApplicationParameter DevParam.xml or QaParam.xml or ProdParam.xml will overtake all the setting values.
<Parameters>
<Parameter Name="StatelessService1_InstanceCount" Value="-1" />
<Parameter Name="DatabaseString" Value="Server=someserverqa.database.windows.net\;Database=DbQA;user id=[userid];password=[Password];Trusted_Connection=false;" />
</Parameters>
In addition to the above info, it is important to know the order in which ASF overrides application setting:
Service Fabric will always choose from the application parameter file
first (if specified), then the application manifest, and finally the
configuration package (source)
For more info:
http://www.binaryradix.com/2016/10/reading-from-configuration-within-azure.html

No Code First Migrations When Deploying Via Visual Studio 2013

I've written an API with no azure connection currently. I am now ready to publish this to Azure. In doing so, I assumed, as was the case with many other deployments, there would be an option for code first migrations. The website already exists, so when I log in I select my website in the drop down, but the screen I get looks like the below where the code-first migrations checkbox should be:
How do I correct this so that I can deploy with code-first migrations?
I found the solution to this issue. If this happens, then your publish profile is set to update the database schema, but not to allow code first migrations. I can't speak to why Visual Studio sometimes does this, but to fix it, you'll need to alter the xml file representing that profile. They can be found under the 'Publish Profiles' folder. Most likely, your <PublishDatabaseSettings> element will have an <Object Type="Dbfx...etc."> and possibly and <UpdateFrom> element. Get rid of those and replace the settings with the below.
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="Namespace.Models.YourDBClass" Order="1" Enabled="True">
<Destination Path="your-connection-string-goes-here" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="Namespace.Models.YourDBClass, AssamblyName" MigrationConfiguration="Namespace.Migrations.Configuration, Assambly" Origin="Convention" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
Now clean and rebuild for good measure and you should be ready to go. Do note, if you do not delete the other pre-generated elements in the PublishDatabaseSettings element the schema will update on publish and you will likely have an error on your first attempt to hit your API and the migrations occur. In my case, and in most, it will be an 'X already exists' error, as the migrations are attempting to create tables that were already created with the schema update.
I was able to figure out the issue and correct it with the help of this article: http://www.dominicstpierre.com/2012/11/enable-code-first-migrations-check-box.html

MVC 5 Remote Validator - call web service

I built a remote validator (controller -> action) and decorated the field with the Remote attribute that points to the action and controller.
The action itself will take the value entered by user and call a remote service. The service will return true or false.
If the response is false then the remote validation returns false and the error message is shown.
The problem is that it works fine except that the input is not validated after the focus is lost on the field but after the form is submitted. Basically the form is submitted, hit's the controller action but the validation of the value occurs after submit and then the error message is shown.
Make sure your web.config has this set
<add key="ClientValidationEnabled" value="true" />
And for a cleaner output, you may also want to try enabling the unobtrusive validation as well.
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
Just make sure your project has those javascript files included, they should have been added via Nuget

How can I specify the IisVirtualDirectoryPhysicalPath in the {Project}.SetParameters.xml file?

I've been unable to get our TFS build server to stop putting it's local build path in the {Project}.SetParameters.xml file. I'm currently trying to override it using a project parameters.xml file, but can't find the magic combination that will let me override that property. Main problem is that I don't know where that value comes from, so it's difficult to match & override it.
Current result:
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/MyService" />
<setParameter name="IIS Web Application Pool Name" value="MyService" />
<setParameter name="IisVirtualDirectoryPhysicalPath" value="F:\Builds\59\EAS\MyService.Changeline_1.1.1.0\Sources\API Layer\API_deploy" />
</parameters>
I want that last line to be:
Of course, MSFT documentation is lacking in this regard. Here's my current parameters.xml file, that does not work. No build errors, it just doesn't overwrite that IisVirtualDirectoryPhysicalPath value.
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<parameter name="IisVirtualDirectoryPhysicalPath"
description="Physical path where files for this Web application will be deployed."
defaultValue="C:\Program Files\Blah\MyService\API"
tags="DestinationVirtualDirectory">
<parameterEntry kind="DestinationVirtualDirectory" scope=".*" match="^F:\\Builds[\w\s\\\.\-]+$" />
</parameter>
</parameters>
I couldn't get that parameters.xml to do anything.
If you create a MyService.wpp.targets file,
http://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx
Then you can add an entry into that file. It will set this value in the setparamters.xml (it wont however set the value inside the zip, which is a bit of a pain, cos what if the someone just imports the zip. But this is better than nothing.
C:\Program Files\Blah\MyService\API

Resources