开发者

how to add a include path to visual studio using nsis?

does anyone knows how can I make my nsis installer update visual studio include path with my开发者_如何学JAVA sdk paths?


In next text I assume you use Visual Studio 2008.

If you want to directly change the paths you must modify file %LOCALAPPDATA%\Microsoft\VisualStudio\9.0\VCComponents.dat.

There is no need to write keys into registry, because directories are saved here.

Use this NSIS code to add directory C:\YOUR DIRECTORY HERE into it:

Function Write
SetShellvarContext current
ReadIniStr $0 "$LOCALAPPDATA\Microsoft\VisualStudio\9.0\VCComponents.dat" "VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories" "Include Dirs"
WriteIniStr "$LOCALAPPDATA\Microsoft\VisualStudio\9.0\VCComponents.dat" "VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories" "Include Dirs" "$0;C:\YOUR DIRECTORY HERE"
IfErrors Error NoError
Error:
  MessageBox MB_OK "Cound not write!"
NoError:
FunctionEnd

Be carefull with this because there are many options. Ini typically looks like this:

[PLATFORM]

Directories=Dir1;Dir2;$(VSVariable)path

Above example writes directory into Win32 and Include files. See the picture to understand it.

how to add a include path to visual studio using nsis?

For Visual Studio 2010 the format has been changed (to XML): http://blogs.msdn.com/b/vsproject/archive/2009/07/07/vc-directories.aspx


Create batch file (.bat) where you set PATH variable (add your SDK directory to the PATH) - this may be dependent on Windows version you use. Visual Studio searches PATH automatically.

Then simple use nsExec::ExecToStack to run this bat file in quiet mode.


NSIS does not have any specific support for VS but you can edit any registry setting with ReadRegStr and WriteRegStr

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜