Visual Studio 2010 预构建活动编译&部署解决方案
我需要在 Visual Studio 中设置一个预构建事件来构建和部署解决方案。单独的解决方案位于我正在使用的解决方案的当前目录下的目录中。这有意义吗?
top level dir
/ \
/ \
/ \
|------------| |-----------------|
| mySLn.sln | |prebuild sln dir |
|------------| |-----------------|
\
\
\
|-----------------|
| prebuild.sln |
|-----------------|
问题是我们有多个开发人员,因此使用绝对路径作为解决方案是行不通的。我们必须手动更新每个开发服务器的每个开发者的路径。开发人员是否可以进行预构建活动,以使用相对路径从 Visual Studio 2010 构建和部署 prebuild.sln? 我在网上看到的所有内容都是完整路径: devenv /构建 devenv /deploy
是否有一个变量可以获取当前解决方案所在的完整路径,并将我的子目录和解决方案附加到 devenv 命令以获得完整路径?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您有两个选择:
第一个是修复解决方案的结构,并将项目引用添加到 mySln.sln 中的项目。 (为此,您必须将子项目添加到解决方案中,然后添加项目引用。如果需要,您可以从 mySln.sln 中删除子项目。)
第二个选项是在预构建解决方案。然后,您可以在需要引用预定义的项目中设置引用路径 -构建输出,然后添加对 dll 的引用。 Visual Studio 将把 dll 的路径存储在 *.csproj.user 文件中。然后,每次开发人员提取新版本的 mySln.sln 时,他们都需要在项目中检查并设置引用路径,但他们不需要自己设置引用。然后,您的预构建解决方案可以存在于任何地方,或者实际上可以构建在 CI 服务器上,并根据需要下载输出。
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.
该宏可在构建事件命令行中使用:
$(SolutionDir)
This macro is available in the Build Event command line:
$(SolutionDir)