Hi,
That is not entirely correct. When you reference one project to another,
msbuild doesn't copy anything. It simply makes the reference project available
to the target project. It is up to the target project itself to decide what
it's going to do with that reference. In the case of a c# project, it decides
to copy files according to the "Copy Local" property of the reference, and the
"Build Action" and "Copy to Output Directory" properties of each file.
Votive, (the Wix Visual Studio plugin), does other things with project
reference. First, it makes the project available through variables such as
$(var.ProjectName.Whatever) (see the wix docs on "project references"). Second,
if you are using Wix 3.5 with VS2010, you get options for "Harvest"
(true/false) and "ProjectOutputGroups" that go along with Harvest=True.
Those two harvesting properties will control how Heat builds .wxs files from
your project. Those end up in the obj subdirectory, and then passed in to
Candle during the build process.
Whether files from your c# project make their way to your final output
directory in Wix depends on a whole lot of things. For example, you may be
using a compressed package where all your files go inside cabinets and those
get embedded in the msi. There may be different Media elements defined in your
package, or you may be using those files in some other way inside your wix
project.
Hopefully you now understand why you don't get files in your output directory
just from making the project reference. That would go against all of the
reasons that you build a wix project in the first place.
Now - if what you really want to know is how to get files from your referenced
c# package into your output directory without them being embedded in an msi,
it's fairly simple:
1) Set Compressed="no" on your package
2) Reference your project and use the harvesting properties.
The only downside to this is that ALL your harvested files will end up outside
of the msi. To work around that, you'll need Compressed="yes" on the files
that you want inside your msi. The problem now is that there's no opportunity
to modify the .wxs generated by the harvesting on the project reference, to get
that attribute on the files harvested there. IMHO, this is a major oversight
in Votive. We need the ability to provide transforms on the project reference.
There is a workaround for this problem - You have to turn OFF harvesting on
your reference and do it the old wix 3.0 way. Basically, open up your wixproj
file and add an item group like such:
<ItemGroup>
<HarvestProject Include="..\MyWebApp.csproj">
<ProjectOutputGroups>Content;Binaries</ProjectOutputGroups>
<Transforms>MyWebTransform.xslt</Transforms>
<Link>MyWebApp.csproj</Link>
</HarvestProject>
</ItemGroup>
Don't delete the reference though, it is still useful for the
$(var.ProjectName.Whatever) variables. Just set Harvest=False.
Now you can create an xslt for heat to use to add the Compressed="yes"
attribute to your File elements in the generated wxs.
I know this is an ugly workaround. I hope someone that works on Votive is
listening. This is a great example of why we need to be able to specify
transforms as a property on the project reference.
Matt Johnson MCPD, MCTS, MCSD, MCDBA
Director of Application Development
Time America, Inc.
[email protected] | www.timeamerica.com
-----Original Message-----
From: Илья Сербис [mailto:[email protected]]
Sent: Thursday, May 13, 2010 8:08 AM
To: [email protected]
Subject: [WiX-users] Adding reference to WiX project doesn't lead to copy
referenced project's files
Hello!
I have WiX project included into Visual Studio solution along with
other projects written on C#. In order to automate build process I
need to get output files from some of C# projects, and add them to
.msi file.
Usually when you add reference from one C# project to another,
msbuild copy files from output dir of referenced project to the
referrer's folder. But this rule is not applicable to WiX projects.
I've made reference from WiX project to one of C# projects but haven't
got any files from C# project in WiX output directory. Is it possible
to make standard references (which allow files to be copied)?
After getting all of the files in WiX output dir I'm going to filter
out some of them (in pre-build event) and then automatically generate
the list by the heat utility (also in pre-build event). It's simpler
than filter out Components through the xsl transformation from wxs
file generated by the heat.
Another issue I faced with: usually when I add file to C# project as a
link I can set "Copy if newer" option for this file in it's properties
window. But in case of WiX projects there is no such option. May be I
missed something?
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users