문제

i need to set a pre-build event in visual studio that will build and deploy a solution. the separate solution is in a directory below the current directory of the solution that i am working in. does that make sense?

           top level dir
          /          \
         /            \
        /              \
 |------------|    |-----------------|
 | mySLn.sln  |    |prebuild sln dir |
 |------------|    |-----------------|
                          \
                           \
                            \
                   |-----------------|
                   |  prebuild.sln   |
                   |-----------------|

the problem is that we have multiple developers so to use a absolute path for the solution will not work. we will have to manually update the path per develoepr per dev server. is there for the developers to have a pre-build event to build and deploy the prebuild.sln from visual studio 2010 with a relative path? everything i see online is full path for: devenv /build devenv /deploy

is there a variable i can grab for the full path that the current solution is in and append my subdirectory and solution to the devenv command for a full path?

도움이 되었습니까?

해결책

You've got two options:

The first is to fix the structure of the solutions, and add project references to the projects in mySln.sln. (To do this you'd have to add the sub-projects to the solution, then add the project references. You can then remove the sub-projects from mySln.sln if you want.)

The second option is to build the projects in prebuild solution. You then setup reference paths in the projects where you need to reference the pre-build output, and then add references to the dlls. Visual studio will store the paths to the dlls in the *.csproj.user files. Then, each time a developer pulls a new version of the mySln.sln they will need to go through and set-up the reference paths in the projects, but they wont need to setup the references themselves. Your pre-build solution can then live anywhere, or indeed be built on a CI server and the output downloaded as necessary.

다른 팁

This macro is available in the Build Event command line:

$(SolutionDir)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top