Is there a way to setup a working directory for “r and ”load commands

浪尽此生 提交于 2019-12-07 21:12:37

问题


Quesiton is relative to References in Roslyn .rsp files

Did install the Roslyn, playing with: C:\Users\name\Documents\Microsoft Codename Roslyn CTP - October 2011\CSharp\WpfSeedRepl Walkthrough: http://msdn.microsoft.com/ru-ru/hh543924.

I'm unable to load current DLL and csx:

> #r "wpfseed.exe"
(1,1): error CS0006: Metadata file 'wpfseed.exe' could not be found

> #load "setup.csx"
Specified file not found.
Searched in directory:
  C:\Users\name
> 

On other hand:

> Console.WriteLine(Environment.CurrentDirectory);
C:\Users\name\Documents\Microsoft Codename Roslyn CTP - October 2011\CSharp\WpfSeedRepl

Is there any workaround to not to specify the project folder?


回答1:


Disclaimer: I work at Microsoft on the Roslyn team.

There is not currently a way to change the search path from within the Interactive window. However, we're considering adding a command to do so in the future. For now, the paths are rooted at your user directory ("C:\Users\name" above), and you can use relative paths from that directory. Additionally, you can use paths relative to the process current directory with a ".\", and you can change that with Environment.CurrentDirectory = "<your path>".

For example:

Environment.CurrentDirectory = @"C:\Users\name\Documents\Microsoft Codename Roslyn CTP - October 2011\CSharp\WpfSeedRepl";
#r ".\wpfseed.exe"
#load ".\setup.csx"

Hope this helps!



来源:https://stackoverflow.com/questions/8180086/is-there-a-way-to-setup-a-working-directory-for-r-and-load-commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!