Vianna
Vianna

Reputation: 31

Doesn't heat project support -var param in Visual Studio 2010?

I'm having problems using the command

"$(WIX)bin\heat.exe" project "$(SolutionDir)\My.project.csproj" -dr FOLDER -cg filesUP -pog:Content -pog:Satellites -gg -g1 -sf -srd -suid -var "var.SourceDir" -out "$(ProjectDir)FilesFragment.wxs"

the output file is ignoring this parameter -var "var.SourceDir" and using var.My.project.ProjectDir

...
<Component Id="My.project.Content.Web.config" Directory="My.project.Content" Guid="10E9C2E0-2A35-4D6F-B12D-D66AE2E831D4">
    <File Id="My.project.Content.Web.config" Source="$(var.My.project.ProjectDir)\Web.config" />
</Component>
...

Visual Studio 2010 returns this error:

Undefined preprocessor variable '$(var.My.project.ProjectDir)'.
C:\My.project\My.project.Installer\FilesFragment.wxs

I searched, but only found examples where heat is used with the parameter dir.

I did not find anything in the documentation that says the parameter -var is not supported by heat project.

Is there a solution?

Upvotes: 2

Views: 1488

Answers (2)

Vianna
Vianna

Reputation: 31

One solution I found is instead of using the command:

"$(WIX)bin\heat.exe" project "$(SolutionDir)\My.project.csproj" -dr FOLDER -cg filesUP -pog:Content -pog:Satellites -gg -g1 -sf -srd -suid -var var.SourceDir -out "$(ProjectDir)FilesFragment.wxs"

remove the parameter -var var.SourceDir and set the environment variable My.project.ProjectDir in its place and remove the parameter -dr FOLDER and set in the file Setup.wxs an id My.project.Content in its place.

This way, the command shall look like this:

"$(WIX)bin\heat.exe" project "$(SolutionDir)\My.project.csproj" -cg filesUP -pog:Content -pog:Satellites -gg -g1 -sf -srd -suid -out "$(ProjectDir)FilesFragment.wxs"

In my use case I had no problems with this solution so far.

Upvotes: 1

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32270

I'm using this option with no problems in my project. Perhaps, the quotes are unnecessary? Try -var var.SourceDir instead of -var "var.SourceDir".

Another guess: you harvest a project (heat.exe project). It could be that this option ignores -var switch, and overrides it with something project related. As far as I remember, the project harvesting type doesn't work that well in heat and is not recommended for usage... You can try to run heat.exe dir instead to see if it passes the -var correctly.

Upvotes: 0

Related Questions