开发者

Anyone else notice that $(SolutionDir) resolves to ProjectDir when loading Wix projects into Vs2010?

I'm using Vs2010 and Wix 3.6.0917.0, for the record. I use the $(SolutionDir) property quite a bit in my .wixproj file, since I only ever build the installer as part of a solution build or as part of a team build, and never by itself. However, while building from the command line works just fine (both from cmd on the desktop and when building on build agents), when I attempt to reload the .wixproj file into the IDE, I get errors because all the $(SolutionDir) variables are resolving to the project directory, not the solution directory. Consider:

C:\workspace\projectCollection\teamProject\branch\solution.sln C:\workspace\projectCollection\teamProject\branch\source\installer\installer.wixproj

and assume a shared custom targets file:

C:\workspace\projectCollection\teamProject\branch\build\shared.targets

which is referenced inside installer.wixproj with:

<Import Project="$(SolutionDir)build\shared.targets">

Command line builds work fine...

C:\workspace\projectCollection\teamProject\branch\> MSBuild /t:build /property:Platform=x64;Configuration=Debug solution.sln
0 Errors
0 Warnings

Build succeeded!

But load into vs2010 and you see...

The imported project "开发者_如何学PythonC:\workspace\projectCollection\teamProject\branch\source\installer\build\shared.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\workspace\projectCollection\teamProject\branch\source\installer\installer.wixproj

You can see here that the resolved result of $(SolutionDir)build\shared.targets is getting the project directory and not the solution directory. What gives?


My guess would be that $(SolutionDir) resolves to nothing when the wixproj is being loaded into VS2010. In this case the imported file becomes "build\shared.targets". Since the path is relative it is assumed to be relative to the project directory. Using ".." or some other path could get you around the problem.

I verified this failed with WiX 3.5.2222.0 in VS2010. A C# console application project (csproj) worked as expected.

Have you filed a bug against WiX for this?

I looked at the WiX vs2010 addin code a little bit and the Solution properties are only created when doing a build and not when the project is loaded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜