开发者

Visual studio 2010 pre-build event to compile & deploy a solution

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)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜