开发者

Indirect way to reference "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\datasvcutil.exe" in a prebuild event

开发者 https://www.devze.com 2023-04-12 15:53 出处:网络
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 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.


Since 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


I like Filburts answer above. But if you really want to be courageous, you can invoke:

%VS100COMNTOOLS%\VCVarsQueryRegistry.bat
rem and query one of the %FrameworkDIR32% or %FrameworkDIR64% environment variables, depending on your choice

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)

0

精彩评论

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