The current version of mule runtime we are using is 4.3.0. We have multiple environments where we have to set up the runtimes.
We want to define a variable in the runtime wrapper.conf and use that variable across multiple properties.
Tried to follow the tanukui software instructions "https://wrapper.tanukisoftware.com/doc/english/props-envvars.html"
set.default.ENV_BASE_PATH=/path/to/the/environment
wrapper.java.additional.22=-DMULE_LOG_DOMAIN_V2=%ENV_BASE_PATH%/logs/%WRAPPER_HOSTNAME%/DomainV2
WRAPPER_HOSTNAME is working which is a default variable that tanuki provides. But the custom variable "ENV_BASE_PATH" is not working.
when the runtime is comes up it is not taking "ENV_BASE_PATH" as a variable but taking it as an absolute value.
My recommendation is to just avoid using environment variables in the wrapper. Just replace it by the actual value. It doesn't look as good but it will work.
Related
Going through documentation for (ASP).NET Core, I come across multiple environment variable names that seem to do virtually the same, or at least similar, things.
However, I'm having a hard time finding any detailed information on what exactly differs between:
Hosting:Environment
ASPNETCORE_ENVIRONMENT
ASPNET_ENV
Is this server-specific (IIS vs Kestrel, for example), or is it relating to something else?
ASPNET_ENV is legacy and has been removed, use 'ASPNETCORE_ENVIRONMENT' instead. It was announced in this issue and pr: Rename environment variables to ASPNETCORE_.
Hosting:Environment was used in RC1 as replacement for ASPNET_ENV, and now is also legacy. See this ASPNET_ENV variable should be changed in docs to Hosting:Environment issue for more details.
ASPNETCORE_ENVIRONMENT is used to describe the environment the application is currently running in. This variable can be set to any value you like, but three values are used by convention: Development, Staging, and Production.
My goal is to create build definitions within Visual Studio Team Services for both test and production environments. I need to update 2 variables in my code which determine which database and which blob storage the environment uses. Up till now, I've juggled this value in a Resource variable, and pulled that value in code from My.Resources.DB for a library, and Microsoft.Azure.CloudConfigurationManager.GetSetting("DatabaseConnectionString") for an Azure worker role. However, changing 4 variables every time I do a release is getting tiring.
I see a lot of posts that get close to what I want, but they're geared towards C#. For reasons beyond my influence, this project is written in VB.NET. It seems I have 2 options. First, I could call the MSBuild process with a couple of defined properties, passing them to the .metaproj build file, but I don't know how to get them to be used in VB code. That's preferable, but, at this point, I'm starting to doubt that this is possible.
I've been able to set some pre-processor constants, to be recognized in #If-#Else directives.
#If DEBUG = True Then
BarStaticItemVersion.Caption = String.Format("Version: {0}", "1.18.0.xxx")
#Else
BarStaticItemVersion.Caption = String.Format("Version: {0}", "1.18.0.133")
#End If
msbuild CalbertNG.sln.metaproj /t:Rebuild /p:DefineConstants="DEBUG=False"
This seems to work, though I need to Rebuild to change the value of that constant. Should I have to? Should Build be enough? Is this normal, or an indication that I don't have something set quite right?
I've seen other posts that talk about pre-processing the source files with some other builder, like Ant, but that seems like overkill. It feels like I'm close here. But I want to zoom out and ask, from a clean sheet of paper, if you're given 2 variables which need to change per environment, you're using VB.NET, and you want to incorporate those variable values in an automated VS Team Services build process upon code check-in, what's the best way to do it? (I want to define the variables in the VSTS panel, but this just passes them to my builder, so I have to know how to parse the call to MSBuild to make these useful.)
I can control picking between 2 static strings, now, via compiler directives, but I'd really like to reference the Build.BuildNumber that comes out of the MSBuild process to display to the user, and, if I can do that, I can just feed the variables for database and blob container via the same mechanism, and skip the pre-processor.
You've already found the way you can pass data from the MsBuild Arguments directly into the code. An alternative is to use the Condition Attribute in your project files to make certain property groups optional, it allows you to even include specific files conditionally. You can control conditions by passing in /p:ConditionalProperty=value on the MsBuild command. This at least ensures people use a set of values that make sense together.
The problem is that when MsBuild is running in Incremental mode it is likely to not process your changes (as you've noticed), the reason for this, is that the input files remain unchanged since the last build and are all older than the last generated output files.
To by-pass this behavior you'd normally create a separate solution configuration and override the output location for all projects to be unique for that configuration. Combined with setting the Compiler constants for that specific configuration you're ensured that when building that Configuration/Platform combination, incremental builds work as intended.
I do want to echo some of the comments from JerryM and Daniel Mann. Some items are better stored in else where or updated before you actually start the compile phase.
Possible solutions:
Store your configuration data in config files and use Configuration Transformation to generate the right config file base don the selected solution configuration. The process is explained on MSDN. To enable configuration transformation on all project types, you can use SlowCheetah.
Store your ocnfiguration data in the config files and use MsDeploy and specify a Parameters.xml file that matches the deploy package. It will perform the transformation on deploy time and will actually allow your solution to contain a standard config file you use at runtime, plus a publish profile which will post-process your configuration. You can use a SetParameters.xml file to override the variables at deploy time.
Create an installer project (such as through Wix) and merge the final configuration at install time (similar to the MsDeploy). You could even provide a UI which prompts for specific values (and can supply default values).
Use a CI server, like the new TFS/VSTS 2015 task based build engine and combine it with a task that can search&replace tokens, like the Replace Tokens task, Tokenization Task, Colin's ALM Corner Build and Release Tasks. And a whole bunch that specifically deal with versioning. Handling these things in the CI server also allows you to do a quick build locally at all times and do these relatively expensive steps on the build server (patching source code breaks incremental build in MsBuild, because there are always newer input files.
When talking specifically about versioning, there are a number of ways to set the AssemblyVersion and AssemblyFileVersion just before compile time, usually it involves overriding the AssemblyInfo.cs file before compilation. Your code could then use reflection to read the value at runtime. You can use the AssemblyInformationalversion to specify something like you do in the example above which contains .xxx or other text. It also ensures that the version displayed always reflects the information obtained when reading the file properties through Windows Explorer.
Does any one have idea, what if i want to define path with some environment variable in fitnesse setup via content.txt.
At this moment we have content.txt checked in our repository containing the path variable of each and every developers environment. I want to resolve that problem by defining atleast a variable prefix with a standard path.
Current path definitions like below:
!path /home/xyz/workspace/blah/blah
Want to change it to something like
!path $workspace/blah/blah
I tried using !define workspace {this/is/my/path}
but it doesn't seems to be working and complains undefined variable workspace.
Use ${myvariable} to reference a variable.
Mike has pointed out that the way you referring variable is wrong. Here are some more details for those who get confused between ${variable} and $slimSymbol when first started using FitNesse.
${variable} is a concept on the Wiki page level . There are a few ways to define them:
using !define statement
properties in the plugins.properties file
using system variable passed when starting FitNesse Server
through url params
These variable will be translated at the time the page is visited. You can find some official documentation here
$slimSymbol on the other hand is a "runtime variable" used in SLiM test system. They are defined by using $slimSymbol= symtax in the test case, and the value will only be available in the runtime. Documentation here
I'm using Wix 3.8, and I need to check to see if an environment variable is set at runtime - if it is not, I need to set it. If it is, I must NOT overwrite the existing value.
From what I've seen, Wix offers statements, and conditional pre-processor directives. The former seems to be for "read only" type checks, as the element has not eligible child elements, such as . The latter only runs at build time.
Do I have any other options, or must I use a custom action to do this? Thanks in advance!
According to the docs, you should specify an action=create
create
Creates the environment variable if it does not exist, then set it during installation. This has no effect on the value of the
environment variable if it already exists
Is there an automated tool for VB.Net that will identify all global variables in a project?
Short of that, is there any scripts that can be used that will facilitate a manual review of global variables?
There seems to be tools for C/C++, but not for VB.Net:
Tools to find global/static variables in C codebase
Is there a tool to list global variables used and output by a C function?
EDIT:
My current approach uses the following VS REGEX searches:
For finding global variables:
~(Private:b+)Shared:b+:i:b+As:b+
For finding global properties:
~(Private:b+)Shared:b+(~(ReadOnly:b+):i:b+)#Property:b+:i([(][)]|[]):b+As:b+
fxCop might help, but you might need to write a plugin for that particular function.
Also, ndepend (Using the CQL "code query langauge") I'm pretty sure will give you a report or globals (and a whole lot more).
What are you calling a "global variable"? a variable defined as Shared (private or otherwise) isn't 'global' at all.
Really, the only 'global' variables left in vb.net are declared as public in a module