Microsoft Robotics Studio和绝对路径问题
我刚刚安装了 Microsoft Robotics Studio 2008 R2,我必须承认我对路径的处理方式感到震惊。
首先,工作室想要将自己安装到我的个人配置文件中(这是在 Vista 上):
C:\Users\MyUserName\Microsoft Robotics Dev Studio 2008 R2
我认为这是因为在开发过程中我必须将文件写入机器人工作室文件夹,使 C:\Program Files
不行。
然后,当我创建一个新的机器人项目时,许多指向机器人工作室的绝对路径被添加到该项目中。如果我将我的项目签入源代码管理,而另一个开发人员将其签出到他的计算机上,则绝对路径将无法解析,并且项目将无法编译。
此外,由于所有服务都收集到机器人工作室文件夹中的单个文件夹中,因此在一台计算机上开发多个独立服务似乎至少会令人困惑。
你有什么好的策略来处理这个混乱吗?
I have just installed Microsoft Robotics Studio 2008 R2, and I must admit that I'm shocked to discover how paths are handled.
First of the studio wants to install itself into my personal profile (this is on Vista):
C:\Users\MyUserName\Microsoft Robotics Dev Studio 2008 R2
I assume this is because during development I have to write files to the robotics studio folder making C:\Program Files
a no go.
Then when I create a new robotics project a lot of absolute paths pointing to the robotics studio is added to the project. If I check my project into source control and another developer checks it out onto his machine the absolute paths will not resolve and the project will not compile.
Also, since all services are collected into a single folder in the robotics studio folder developing multiple independent services on a single computer appears to be at least confusing.
Do you have any good strategies for handling this mess?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(3)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我现在找到了一种方法,可以将 Microsoft Robotics DSS Service 视觉工作室项目更改为可以在自己的源代码树中编译和运行的项目,而与机器人工作室的安装路径无关。以下是修改项目所需执行的操作的描述:
将 robots studio bin 路径添加到 PATH 环境变量中,以便能够执行
dssproxy.exe
不提供完整路径。我已将 robots studio 安装到了程序文件文件夹中,以避免意外将文件写入 robots studio 文件夹。打开项目的属性页面,然后选择构建选项卡。在输出部分中,将输出路径更改为
Debug\bin
。对于 .NET 项目,通常会编译到文件夹bin\Debug
和bin\Release
中,但机器人托管服务期望位于文件夹中名为bin
并将数据存储在bin
文件夹上方的文件夹中。转到签名选项卡,然后在选择强名称密钥文件框中选择一个新密钥。您可以在此时生成自己的密钥,也可以使用
sn.exe
实用程序生成新密钥。或者,如果您有自己的创建密钥的策略,请遵循该策略。sn.exe
实用程序可以在 robots studio 的tools
文件夹中找到。在构建事件选项卡中编辑构建后事件命令行:
dssproxy.exe /dll:"$(TargetPath)" /proxyprojectpath:"$(ProjectDir)Proxy" /keyfile:"$(SolutionDir)Key.snk" $(ProxyDelaySign) $(CompactFrameworkProxyGen) /binpath :“。” @(ReferencePath->'/referencepath:"%(RootDir)%(Directory)"', ' ')
注意
/keyfile
的参数。输入一个表达式,用于定位在上一步中创建的强名称密钥文件。复制文件
DssHost.exe
和DssHost.exe.config
(或DssHost32.config)。 exe
和DssHost32.exe.config
(用于 32 位托管服务))从 robots studio bin 文件夹复制到项目文件夹中,并将这些文件添加到项目中。将构建操作设置为内容,将复制到输出目录设置为如果较新则复制。对您的服务的清单文件执行相同的操作。实际上,清单文件不必与服务位于同一文件夹中,但将其复制到输出文件夹可以让您执行 XCOPY 部署。在调试选项卡中,将启动外部程序更改为输出文件夹中的
DssHost.exe
你的项目。您必须构建项目一次才能将文件复制到输出文件夹。清除工作目录。将命令行参数设置为/p:50000 /t:50001 /m:DSSService1.manifest.xml
将清单文件名更改为项目中的正确名称。您可以修改此处或
DssHost.exe.config
文件中使用的端口号。如果您在受保护的 Windows 环境 (UAC) 中运行,则必须使用httpreserve
命令来授予自己对特定端口的访问权限。您必须以管理员身份运行此命令。调试设置不会存储在项目文件中,每个开发人员都必须创建个人设置。
您还应该相应地更新发布配置。
I have now figured out a way to change a Microsoft Robotics DSS Service visual studio project into something that you can compile and run in you own source tree independent of the installation path of the robotics studio. Here is a description of what you need to do to modify the project:
Add the robotics studio bin path to you PATH environment variable to be able to execute
dssproxy.exe
without supplying a full path. I have installed robotics studio into the program files folder to avoid accidentially writing files to the robotics studio folders.Open the Properties page for the project and select the Build tab. In the Output section change the Output path to
Debug\bin
. For .NET projects it is customary to compile into foldersbin\Debug
andbin\Release
but the robotics hosting service expects to live in a folder namedbin
and will store data in the folder above thebin
folder.Go to the Signing tab and select a new key in the Choose a strong name key file box. You can either generate your own key at that point or use the
sn.exe
utility to generate a new key. Or if you have your own policy for creating keys follow that. Thesn.exe
utility can be found in thetools
folder of robotics studio.In the Build Events tab edit Post-build event command line:
dssproxy.exe /dll:"$(TargetPath)" /proxyprojectpath:"$(ProjectDir)Proxy" /keyfile:"$(SolutionDir)Key.snk" $(ProxyDelaySign) $(CompactFrameworkProxyGen) /binpath:"." @(ReferencePath->'/referencepath:"%(RootDir)%(Directory) "', ' ')
Pay attention to the argument to
/keyfile
. Enter an expression that locates the strong name key file created in the previous step.Copy the files
DssHost.exe
andDssHost.exe.config
(orDssHost32.exe
andDssHost32.exe.config
for the 32 bit hosting service) from the robotics studio bin folder into the project folder and add these files to the project. Set the Build Action to Content and Copy to Output Directory to Copy if newer. Do the same for the manifest file for your service. Actually, the manifest file doesn't have to be in the same folder as the service, but copying it to the output folder enables you to do XCOPY deployment.In the Debug tab change the Start external program to the
DssHost.exe
in the output folder of your project. You will have to build the project once to copy the file to the output folder. Clear the Working directory. Set the Command line arguments to/p:50000 /t:50001 /m:DSSService1.manifest.xml
Change the manifest file name to the proper name in your project. You can modify the port numbers used either here or in the
DssHost.exe.config
file. If you are running in a protected Windows environment (UAC) you will have to use thehttpreserve
command to give yourself access to a particular port. You have to run this command as administrator.Debug settings are not stored in the project file and each developer will have to create personal settings.
You should also update the Release configuration accordingly.