Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "get rid of" $(SolutionDir) when building Visual Studio project from outside Visual Studio

Tags:

I want to build a .vcxproj via MSBuild from outside Visual Studio. The problem is that there are many occurrences of $(SolutionDir) inside the .vcxproj file which apparently only get set correctly when the solution is loaded.

When I replace $(SolutionDir) with the actual absolute path, it works. But other people on other machines are working with the same project file, so this is not a solution.

Is there a solution or hack to solve this problem?

like image 204
goTAN Avatar asked Feb 24 '13 16:02

goTAN


People also ask

How do I change the solution path in Visual Studio?

In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.


1 Answers

You can set the variable by passing parameter arguments:

/p:SolutionDir=path 

So, rather than editing the solution file, you can create a build script that sets up the environment and executes MSBuild accordingly, leaving the Visual Studio file as is for development work.

like image 52
Grant Thomas Avatar answered Sep 18 '22 06:09

Grant Thomas