开发者

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

开发者 https://www.devze.com 2023-02-20 16:10 出处:网络
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.

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

精彩评论

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

关注公众号