Menu

#1290 VS References with short namespace

v3.0
closed
nobody
msbuild (104)
2012-09-15
2008-07-30
No

I think I have found an issue with WIX.

In my solution I try to keep project names short and only put the full namespace on the output files. So something like

Organisation.Application.Data
Oragnisation.Application.Data.DAL.Entity

would appear in my solution simply as

Data
Data.DAL.Entity

but the project properties would have the full namespaces on the output file etc

Now in VS when you click "Add Reference" and add a project reference, these will show up as

Data (Data\Data)
Data.DAL.Entity

Don't ask me why the one without a "." gets a bracketed qualification cos I have no idea.

Adding a reference to a WIX project does the same.

Now in my WXS file I have something like this

<file id="user-content-Data" name="$(var.Data.TargetFileName)" keypath="no" assembly="no" vital="yes" checksum="yes" source="$(var.Data.TargetPath)" --="">
<file id="user-content-Data.DAL.Entity" name="$(var.Data.DAL.Entity.TargetFileName)" keypath="no" assembly="no" vital="yes" checksum="yes" source="$(var.Data.DAL.Entity.TargetPath)"></file></file>

The $(var.Data.targetFileName) causes a compilation errors whereas $(var.Data.DAL.Entity.TargetFileName) works fine.

It seems these () qualified references break the "var" system in some way.

Discussion

  • Cliff Harker

    Cliff Harker - 2008-07-30

    Logged In: YES
    user_id=2008707
    Originator: YES

    ok, a little investgation, and more confusing.

    These projects are in VS folders to keep related thing together.

    When you add a project reference to another project with no "." in its name it gets added as

     projectName (FolderName/ProjectName)
    

    So if I add a reference to "Data" in the "Common" folder I get

     Data (Common\Data)
    

    If I go back and rename the "Data" project as "Data.Data" the reference changes!

     Data.Data
    

    Strangely if I rename the project back to simply "Data" the reference becomes

     Data
    

    and not

     Data (Common\Data)
    

    So the problem only occurs if you add a project reference to a project where the source project has not got a "." in its name and it's in a folder. You can fix things by renaming back and forth after you have added the reference to the WIX (or any other) project.

     
  • Jason Ginchereau

    Logged In: YES
    user_id=2086430
    Originator: NO

    It's by design. VS automatically distinguishes references to projects with the same name by appending the project folder in parenthases. But because the WiX preprocessor doesn't support parentheses in variables, the WiX build tasks will replace the parentheses with underscores (_) when generating the preprocessor variables for the referenced project.

    So to resolve the issue you need to do one of the following:

    1. In the WiX code, refer to the project variables using underscores where the parentheses would have been.
    2. Edit the reference name (not the project name but the name of the reference node in the WiX project) so that it doesn't include parentheses. I think you can edit this name in the property grid of the reference node, or by editing the project file.
    3. Temporarily rename the target project when adding the reference so that the name of the added reference node doesn't have parentheses.
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 15 days (the time period specified by
    the administrator of this Tracker).

     
MongoDB Logo MongoDB