Although cn1libs cannot be nested Shai Almog said that a first project can be created which uses the first cn1lib and referenced from the second. Is there a specific example on how to do this?
I don't have something like that actually running but you can probably just edit the the jar task in the cn1lib to also include the classes from the other cn1lib:
<target name="jar" depends="compile,Stubs">
<ant inheritall="false" antfile="pathtoothercn1lib/build.xml" target="jar" />
<copydir src="pathtoothercn1lib/build" to="build" />
...
</target>
I have a common build.xml file that contains most of my targets.
There are two satellite build files that import the common file. The difference between the satellites is that one will run the common targets once, whereas the other has a foreach ant-contrib task which loops through subfolders and runs the common targets once per subfolder.
One of my targets in the common file prompts the user to select an area to release to (dev or qa).
For the satellite build that runs once, this works fine.
For the looping satellite build, the prompt appears to the user for each subfolder, but they will all go to the same release area so I only need this prompt to be asked once.
The simple solution is to move the "select-area" target to each of the satellite build files so it only runs once, i.e. it is outside of the loop.
I am interested to know if there is a cleaner way to do it.
My initial thoughts were to call the target outside of the loop, in the looping satellite build (using the ant task) and set a property. I would then add an "unless" attribute to the select-area target in the common build file which checks if the property set in the ant task has been set.
By my reckoning, this would mean the non-looping build runs the select-area target as the property has not been set (which it does).
The looping satellite build runs the target (using the ant task) but then when it loops into the common build file and hits the select-area target it still runs it, even though the property has been set and the select-area target has the unless attribute to check it.
Sample code below:
Extract From Common Build
<target name="select-area" unless="area.selected" description="prompts user what area to deploy to and validates response">
<input message="Which area do you want to deploy to?" validargs="dev,qa" addproperty="deploy.to" />
...
</target>
Looping Satellite Build File
<project name="run-build-file-multi" default="loop-brands">
<import file="../../../common/builds/newbuild.xml"/>
<ant antfile="${ant.file.common} target="select-area">
<property name="area.selected" value="yes" />
</ant>
<target name="loop-brands" depends="select-area" description="loops through each brand folder found in branch folder">
<foreach target="end-confirmation" param="current.brand" inheritall="true">
<path>
<dirset dir=".">
<include name="*"/>
</dirset>
</path>
</foreach>
</target>
</project>
It appears as soon as the ant task has called the target, the area.selected property is no longer set.
I am not sure if I am even going about this the right way but hopefully it is relatively clear what I am trying to achieve.
Any assistance appreciated, thanks.
This seems wrong:
<target name="select-area" unless="area.selected" description="prompts user what area to deploy to and validates response">
<input message="Which area do you want to deploy to?" validargs="dev,qa" addproperty="deploy.to" />
It should be
<target name="select-area" unless="deploy.to" description="prompts user what area to deploy to and validates response">
<input message="Which area do you want to deploy to?" validargs="dev,qa" addproperty="deploy.to" />
i.e. the unless should use the same variable as the input When the variable has been set once, it should stay that way.
Alternatively, in your two build scripts, have the script call select-area once at the beginning (so this is the same code in both) and then start the loop in the recursive build.
I'm trying to figure out a way to handle multiple app.config files. Each app.config file is for a different enviornment.
Currently, I have multiple .SED Files(each .SED file references to one enviornment) that in their post-command(PostInstallCmd) they execute a .bat file that looks for a certain app.config and puts in the directory needed. However, the problem with this method is that the command prompt opens up after the installation and I am unable to figure out how to suppress the command prompt.
I am not sure if my way is the best idea to go about handling multiple App.Config. That is why I am throwing it out there to see if there is a better method or if someone has a solution to the method I already have.
If you keep your config files in separate components, you can add a condition element to your components.
Component conditions are evaluated during the CostFinalize standard action (source), so you'd have to use a custom action that runs before file costing to gather info about the environment. You can use the built-in OSInfo custom actions or predefined properties to do so.
Just set the File/#Name attribute to the same across all the config files if they have different names on your build server. Unfortunately, this will set off ICE30, but if the conditions are mutually exclusive, you can safely ignore it.
Your xml would look something like:
<Component Guid="PUT-GUID-HERE">
<Condition>VersionNT = 602</Condition>
<File Name="app.config" Source="config1.config" />
</Component>
<Component Guid="PUT-GUID-HERE">
<Condition>NOT VersionNT = 602</Condition>
<File Name="app.config" Source="config2.config" />
</Component>
Note that you'll have to specify component guids, because they have the same target path. The auto generated guid would be the same for both.
I was attempting to make a "library" type of project in dart and then "depend" on that library from another project (all using the path dependency functionality of the yaml file). I understand that I might be able to get the dependency stuff to work if I hosted my library or if I used GIT, but I don't want to do either, because I feel that pure filesystem based dependencies should be a "no brainer".
So, without further adieu, here is my situation. I have a very simple dart library/project based on web_ui that contains two files:
esrvdartui.dart
---------------
library esrvdartui;
import 'dart:html';
import 'package:web_ui/web_ui.dart';
part 'esrvradiobutton.dart';
esrvradiobutton.dart
--------------------
part of esrvdartui;
class ESrvRadioButton extends RadioButtonInputElement
{
ESrvRadioButton ()
{
}
}
I then created another very small/simple web_ui based project called "ExampleForm" that wants to use my esrvdartui project above. Both of these projects exist in the same directory structure. My ExampleForm project contains the following yaml file:
pubspec.yaml
------------
name: ExampleForm
description: A sample WebUI application
dependencies:
js: any
browser: any
web_ui: any
esrvdartui:
path: ../esrvdartui
No matter what I set my path to in the above yaml file, I never see my web\packages directory underneath of my ExampleForm project get updated with my files from the esrvdartui project and as such, I cannot use the files in my library using the file based dependency method, because the build fails for my ExampleForm project.
"Pub install" does not complain with the above path and it doesn't complain when I use an absolute path, so I know that "Pub install" see my dependent project. It just doesn't copy the darned files for me.
Any thoughts?
My pubspec.lock file for ExampleForm is:
# Generated by pub
# See http://pub.dartlang.org/doc/glossary.html#lockfile
{"packages":{"logging":{"version":"0.5.0+1","source":"hosted","description":"logging"},"source_maps":{"version":"0.5.0+1","source":"hosted","description":"source_maps"},"unittest":{"version":"0.5.0+1","source":"hosted","description":"unittest"},"pathos":{"version":"0.5.0+1","source":"hosted","description":"pathos"},"analyzer_experimental":{"version":"0.4.7+1","source":"hosted","description":"analyzer_experimental"},"web_ui":{"version":"0.4.6+1","source":"hosted","description":"web_ui"},"js":{"version":"0.0.21","source":"hosted","description":"js"},"csslib":{"version":"0.4.3","source":"hosted","description":"csslib"},"esrvdartui":{"version":"0.0.0","source":"path","description":{"relative":false,"path":"C:/Users/Jason/dart/esrvdartui"}},"html5lib":{"version":"0.4.3","source":"hosted","description":"html5lib"},"args":{"version":"0.5.0+1","source":"hosted","description":"args"},"browser":{"version":"0.5.0+1","source":"hosted","description":"browser"},"meta":{"version":"0.5.0+1","source":"hosted","description":"meta"}}}
My pubspec.lock file for esrvdartui is:
Generated by pub
See http://pub.dartlang.org/doc/glossary.html#lockfile
{"packages":{"meta":"version":"0.5.0+1","source":"hosted","description":"meta"},"browser":{"version":"0.5.0+1","source":"hosted","description":"browser"},"args":{"version":"0.5.0+1","source":"hosted","description":"args"},"html5lib":{"version":"0.4.3","source":"hosted","description":"html5lib"},"analyzer_experimental":{"version":"0.5.0+1","source":"hosted","description":"analyzer_experimental"},"csslib":{"version":"0.4.3","source":"hosted","description":"csslib"},"web_ui":{"version":"0.4.6+1","source":"hosted","description":"web_ui"},"pathos":{"version":"0.5.0+1","source":"hosted","description":"pathos"},"js":{"version":"0.0.22","source":"hosted","description":"js"},"source_maps":{"version":"0.5.0+1","source":"hosted","description":"source_maps"},"unittest":{"version":"0.5.0+1","source":"hosted","description":"unittest"},"logging":{"version":"0.5.0+1","source":"hosted","description":"logging"}}}
I finally got this to work, but for the life of me, I couldn't find this documented anywhere. All you have to do is create a project in the Dart IDE. Then, create a top level folder in that project called "lib" (blow all other directories away other than the top level "packages" folder). Now, create your main library's .dart file. Let's call it "mylibrary.dart". This contents of this file will look something like this:
mylibrary.dart
library mylibrary;
import 'dart:json';
part 'src/libraryfile1.dart';
Now, create a sub-directory underneath of "lib" to place your library's source files into. This can really be named anything, but I choose to name it "src". Place your libraryfile1.dart file there and it should look something like this:
src/libraryfile1.dart
part of hix_lib;
.
.
.
All import statements should always be placed in your top-level main library file: mylibrary.dart.
Now, in the project that you wish to use this file-based library in, you must add your "mylibrary" to your project's pubspec.yaml file and choose: "Source: path". On my machine, because all projects are in the same directory, my path simply points to: ../mylibrary
And that's all there is to do!!!!!
I'm trying to get our app to handle different icon sets (make it sort of skinnable). I asked about the usual way to do it here. When I tried to apply the solution from the answer, I replaced all hardcoded icon paths in .resx files with paths using an environment variable. For example, I replaced...
<data name="btnDel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\Icons\btnDel.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
...with:
<data name="btnDel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>$(IconsFolder)\btnDel.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Then, as an initial test, I defined a System-level environment variable called IconsFolder, applied changes, restarted Visual Studio and tried to build. But I got this error:
D:\SVN.DRA.WorkingCopy\UserControl\My Project\Resources.resx(123,5): error MSB3103: Invalid Resx file. Could not find a part of the path 'D:\SVN.DRA.WorkingCopy\UserControl\My Project\$(IconsFolder)\btnDel.png'. Line 123, position 5.
It seems like .resx files don't understand environment variables. How can I avoid hardcoding those paths, then?
EDIT: Each icon can be referenced by more than one project, so the environment variable of whatever mechanism is used to configure the paths must be available on a solution-wide basis, and I should be able to set it from inside an MSBuild script.
EDIT 2: All my forms are defined in C# or VB.NET projects
System wide environment variables may not work. You might want to try following the instructions here:
http://msdn.microsoft.com/en-us/library/ms173406.aspx
I don't think there is a way to accomplish using the resource file. One way to achieve this is to drop your bitmap on your project, right click it and change build action to "Embedded Resource". Open up the project file in text editor and change the path to your environment variable. (this is how we do it with VS 2008, they have made it easier since then). Then in code you can do this....
Assembly myAssembly = Assembly.GetExecutingAssembly();
Stream myStream = myAssembly.GetManifestResourceStream("btnDel.png");
new System.Drawing.Bitmap(myStream);