间接引用“C:\Windows\Microsoft.NET\Framework64\v4.0.30319\datasvcutil.exe”的方法在预构建事件中
我正在预构建事件中运行 datasvcutil.exe 命令。
datasvcutil.exe 位于“C:\Windows\Microsoft.NET\Framework64\v4.0.30319”(在 64 位计算机上)。
我可以将其硬编码为 C:\Windows\Microsoft.NET\Framework64\v4.0.30319 \datasvcutil.exe,但这看起来相当脆弱。当假设的 .net v4.0.30320 发布时,我的预构建事件将不再起作用。
使用 Visual Studio 命令提示符,我可以调用 datasvcutil.exe,而无需路径。我想知道是否有类似的间接方法可以从我的预构建事件命令行调用它。
I am running the datasvcutil.exe command in a prebuild event.
datasvcutil.exe is located in "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" (on 64 bit machines.)
I can just hard code this as C:\Windows\Microsoft.NET\Framework64\v4.0.30319\datasvcutil.exe, but that seems rather brittle. When a hypothetical .net v4.0.30320 comes out my prebuild event will not work anymore.
With the Visual Studio Command prompt, I can call datasvcutil.exe with out the path. I am wondering if there is a similar indirect way to call this from my pre-build event command line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您需要的工具与
MSBuild.exe
位于同一路径中,因此您可以简单地使用$(MSBuildBinPath)\DataSvcUtil.exe
引用它,这将使其独立于 < em>框架/Framework64Since the tool you need is in the same path as
MSBuild.exe
you could simply reference it with$(MSBuildBinPath)\DataSvcUtil.exe
which would make it also independent of Framework / Framework64我喜欢上面菲尔伯特的回答。但如果您真的想勇敢一点,您可以调用:
如果您更加勇敢,MSBuild 能够自行读取注册表 - 以下链接可能会有所帮助:http://msdn.microsoft.com/en-us/library/ms171458.aspx(检查“注册表属性” 部分)
I like Filburts answer above. But if you really want to be courageous, you can invoke:
If you are even more courageous, MSBuild is capable of reading registry by itself - the following link may help: http://msdn.microsoft.com/en-us/library/ms171458.aspx (check the "Registry Properties" section)