Reference custom table in WiX fragment file - visual-studio-2010

I want to create a fragment file that will only contain a CustomTable in the file. This is easy enough, but I do not know how to link/include it back into the main product.wxs file.
The fragment file is in the same project as the product file, and I have also tried adding an include tag for the file without success, and even putting the custom table into a WiX include file.
Is there a way to do this? Or is it going to have to live in the product file?

The WiX toolset compiles and links in a similar manner to the C/C++ compiler. The linker starts at the "main" entry point (Product element, in your case) then follows the references from there, which in turn follows references from there until all are resolved.
Part of your question is missing but based on the title I'm going to guess that you want a CustomTable element. Typically that CustomTable is processed by a CustomAction. There are a couple good ways to reference a CustomAction.
I would not use an include file.

You could try using EnsureTable if you'd like to make sure the table is created whether or not there is data in it. If you'd like to separate the custom table's schema definition from the data I believe you can just define them in separate fragments and reference the schema definition from the data definition fragment by opening with <CustomTable Id="your table name"> and defining the rows of data within it.
In general Wix won't pull fragments into the main authoring unless they contain elements that are referred to somewhere and since there is currently no such thing as CustomTableRef you may opt to use other elements such as an empty PayloadGroup or ComponentGroup that you can refer to (using a PayloadGroupRef or ComponentGroupRef respectively) from your main Bundle, Product or Module element as the case may be.

Related

How to add additional assembly references to Linq2SQL DBML file?

I have an DBML file in which I am using the IPAddress class (System.Net) to map a field in the database. Yet, I didnt find a way to have the DBML designer remember that it should add a "using System.Net" to the generated code.
Adding it manually works until the next time I save the file. Aint there a way to specify additional assemblies? I thought that specifying, like it already does for the predefined types, would work (like in "string (System.String)" but that just messes it up because it would insert literally "IPAddress (System.Net.IPAddress)" as type.
So, how do I get non-standard types into the O/R Designer so i can edit them too?
Well, using the fully classified name of the type (in this case System.Net.IPAddress) it actually works. Although of course it doesnt add the "using System.Net;" so one must have it referenced already.

Visual stuio template parameters not returning values?

I'm trying to get these parameters while creating a visual studio template but it doesn't return a value, it just stays like this:
string rootnamespace = $rootnamespace$; // this is the output, it just stays as it was declared
string SpecificSolutionName = $SpecificSolutionName$; // this is the output, it just stays as it was declared
According to msdn - Template Parameters:
SpecificSolutionName:
The name of the solution. When "create solution directory" is checked, SpecificSolutionName has the solution name. When "create solution directory" is not checked, SpecificSolutionName is blank.
And I made sure that the "create solution directory" is checked, but still it doesn't give any value.
How can I get these values. please... ?
I also found $SpecificSolutionName$ to be broken. As a work around it turns out the directory of the solution is usually the same as the name of the solution and thus:
If your solution template has only 1 project: the solution and project names are identical and thus you can simply use $projectname$ in lieu of the broken $SpecificSolutionName$.
If your solution template has multiple projects (aka ProjectCollection): add the attribute CopyParameters="true" to the desired ProjectTemplateLink element and use $ext_projectname$ in lieu of the broken $SpecificSolutionName$.
I think the documentation is not enough clear when it comes to multiproject templates. Putting the wizard declaration in the vstemplate of your multiproject definition, and on the project/s that you desired to use to, makes the "broken" variable appears.
This is because, it launch the wizard for each time you declare it, so to speak, and it behaves differently depending on the context.
Pay attention: the variable $SpecificSolutionName$ only has value when executing the first time for the multiproject vstemplate declaration, and only executes RunStarted, ProjectFinishedGenerating and RunFinished methods. So, to use it in a global context you need to figure out some kind of mechanism to mantain the value between Wizard executions, as adding a new key in the replacementsDictionaryor something.
Hope this help.
I fixed this by adding this doctype declaration to the start of my .vstemplate.
<?xml version="1.0" encoding="utf-8"?>
The doctype declaration is not supplied by the template wizard, but is present in all the preinstalled templates. Good luck and thank you for your patience while I researched this question.
$SpecificSolutionName$ is always empty. How can I tell if the user is making a new solution directory or not?
Frustratingly, the docs are wrong in 2 ways.
There is no "SpecificSolutionName". It is "SpecifiedSolutionName".
If the user unticks "Create directory for solution", then $SpecifiedSolutionName$ is not blank as stated; it actually becomes the same as $projectname$. How you determine when this has or has not occurred and whether what you're reading is a unique solution folder's name or not, is another story.

loading macro files in a directory, transparently

I am looking for a way to separate the repetitive html codes from web pages, and for this I am planning to use the macro functionality. The problem here is for every macro I need to put this macro in a file, or put some of them in a file and include this in the template file.
What I need is to include once just the directory name something like
<#import "/tags/widgetDirectory" as widgets />
here the /tags/widgetDirectory is a directory , and every files here can be seen as a macro defined.
when I need to insert a code part from a file from this directory lets say slide.ftl I will just use
<#widgets.slider />
the system will check for slider.ftl in the /tags/widgetDirectory directory . here the slider.ftl can have <#macro> as first and as last line , or these can transparently added and system can load it as a macro
this will easy my designer work.
Maybe there is better way for doing this kind of widgets/components based web design ?
best regards,
This feature (importing directories) is something that's planned for FM actually... but it won't happen anytime soon. But I guess it can be solved fairly well with a hack right now. Instead of #import, use your own TemplateMethodModelEx, that you could use like <#assign widgets = importDirectory('/tags/widgetDirectory') >. This will return a TemplateHashModel that's also implemented by you and is bound to the directory path. When an item of that hash is get, it uses Environment.getCurrentEnvironment().include. The included file is expected to create a macro with name __main or something. So then you get that variable with Environment.getCurrentNamespace().get("__main") and return it as the result of the hash lookup. Of course this hash should also maintain a cache, so that if the same item is get twice, it wont include the template for the second time, just return the macro extracted earlier. This can be developer further, so that if the include file didn't define __main, then it's supposed that it prints directly to the output, and so it will be included again, when the "tag" is called again.

How to maintain Interface and Implementation in separate files simultaneously in Xcode

I have several lines of code of a written class with Interface written in testclass.h and implementation written in testclass.m in Xcode. I wish when I update an entry in testclass.m, its counterpart in testclass.h can be updated automatically.
For example, I have an interface for following function in both testclass.h and testclass.m:
-(void)testfunction
And I modified its name to a different one due to some reason in testclass.m to:
-(void)another_test_function
If I want this code to run I need to manually change the entry in the header. Although I'm very new to programming but I can imagine it could be really frustrating if you are trying to modify something in a big program with a lot of different files invoking some modified entry name. I wish Xcode can auto-detect this change and modify the entry in the header file to -(void)another_test_function automatically.
Is there any way I can do that? All I know by searching the internet is that you can use a shortcut to "edit all in scope" but this only affect all the occurrence in the same file, not header file.
Right-click the method name you would like to change (in either the header or the implementation file) and then select Refactor > Rename. You can then change the name of the method, and Xcode will show you what it will change.
If that looks good, you can accept the changes and you're done.

Can we use control the source formats/layout in DMExpress using environment variables?

I am using DMExpress tasks to do taransformations on my business data. These business data come in multiple format/layout. I need to be able to use single task for transformation on multiple source layouts. Any DMExpress experts here??
One way that I found out for doing transformation on multiple source layouts with the help of single task was by using the Dmexpress SDK to write the script for the task rather than building the tasks using the GUI task editor. SDK gives lot more flexibility compared to the GUI editor.
But if you are bound to GUI then there is a way around for this specific purpose. You should define a common name for the source layout. Only the source layout name is binded to the task but not the actual layout definition. So you can alter the layout definition while keeping the layout name constant to get a generic task.
FYI- DMExpress is now called DMX (Syncsort changed the name about a year ago).
Do you have multiple different record types within a single file or is each type of record in a separate file? Your question is not clear on this.
If they are in separate files, this is very easy, but you will need to create a separate DMX task for each file. In each of these tasks, define one of the files as the source and create a record layout that matches the format of that file.
If they are in the SAME file, it is only a little more difficult. You can split them into separate files by creating multiple targets and defining a named condition for each target using the SourceName() function (this function returns the name of the file that the current record came from). Then you can process them as separate files (see above). This works UNLESS you have a parent-child relationship going on between the different types of records in that single file. If that is the case, please post some sample data and I can advise on how to handle it.

Resources