简体   繁体   中英

Using Environmental Variables in Visual-Studio C# Properties

I would like to use an environmental path variable in the Visual Studio C# properties pages to set the "Output path".

$(MYDIR) does not work. The Path becomes C:\\....\\release\\$(MYDIR) . It works perfectly in the C++ properties page.

Question: How can I use a path variable in the C# properties page.

Thank you.

Use SubString() method to extract the path

  string path = @"C:\\....\\release\\$(MYDIR)"; string root = path.Substring(0, path.LastIndexOf('\\\\')); string folder = path.Substring(path.LastIndexOf('\\\\') + 1); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM