首页 \ 问答 \ 在构建时或运行时获取解决方案路径(get solution path at build time or runtime)

在构建时或运行时获取解决方案路径(get solution path at build time or runtime)

我有一个C#解决方案,我希望在构建期间将解决方案的路径设置为app.config。 例如。 让我说我有解决方案c:\temp\visual studio\super fun project\super_fun_project.sln open。 我构建并在其中一个测试项目中将应用程序设置更改为解决方案的完整路径。 即

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="fullSolutionPath" value="{setAtBuild}"/>
  </appSettings>
</configuration>

如果我要去c:\temp\visual studio\super fun project\Foobar.Tests\bin\Debug\Foobar.Tests.dll.config它会看起来是

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="fullSolutionPath" value="c:\temp\visual studio\super fun project\super_fun_project.sln"/>
  </appSettings>
</configuration>

或者它需要进行格式化,以便在运行时我要求的值我确实得到了正确的路径。 我查看了转换,但我无法弄清楚如何设置解决方案路径。 有没有其他技巧可以得到这个?


I have a C# solution that I would like to get the path of the solution be set to the app.config during build time. for instance. Lets say I have the solutions c:\temp\visual studio\super fun project\super_fun_project.sln open. I build and in one of the test projects a app setting is changed to be the full path of the solution. ie

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="fullSolutionPath" value="{setAtBuild}"/>
  </appSettings>
</configuration>

that if I were to go to c:\temp\visual studio\super fun project\Foobar.Tests\bin\Debug\Foobar.Tests.dll.config it would look be

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="fullSolutionPath" value="c:\temp\visual studio\super fun project\super_fun_project.sln"/>
  </appSettings>
</configuration>

or however it needs to get formated so that when at runtime I ask for the value I indeed get the correct path. I've looked down Transformation, but I can't figure out how I would get the solution path set. Are there any other tricks to get this?


原文:https://stackoverflow.com/questions/35665193
更新时间:2021-08-02 15:08

最满意答案

按如下所示修改/ etc / hosts文件:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster amrit
    10.0.3.108      HadoopSlave1
    10.0.3.109      HadoopSlave2

还要修改10.0.3.108机器的/ etc / hosts,如下所示:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster 
    10.0.3.108      HadoopSlave1 HOME
    10.0.3.109      HadoopSlave2

并在10.0.3.109机器中修改/ etc / hosts,如下所示:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster 
    10.0.3.108      HadoopSlave1
    10.0.3.109      HadoopSlave2 shubhranshu-OptiPlex-9020

Modify your /etc/hosts file as follows:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster amrit
    10.0.3.108      HadoopSlave1
    10.0.3.109      HadoopSlave2

Also modify /etc/hosts of 10.0.3.108 machine as follows:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster 
    10.0.3.108      HadoopSlave1 HOME
    10.0.3.109      HadoopSlave2

and modify /etc/hosts in 10.0.3.109 machine as follows:

    127.0.0.1       localhost 
    10.0.3.107      HadoopMaster 
    10.0.3.108      HadoopSlave1
    10.0.3.109      HadoopSlave2 shubhranshu-OptiPlex-9020

相关问答

更多
  • 你错误的原因: 引起:java.net.BindException:地址已在使用中:bind 说明:默认情况下,Jenkins使用端口8080(与许多其他Web应用程序一样)。 显然,您已经有另一个应用程序侦听端口8080。 所以你应该将Jenkins绑定到另一个端口。 有关更多信息,请参阅启动和访问Jenkins 。 例如,您可以从 java -jar jenkins.war --httpPort=8081 The cause of your error: Caused by: java.net.Bin ...
  • 从您的设备中删除此文件 /mnt/secure/asec/smdl2tmp1.asec Mathias Conradt编辑/更新(OP): 如果您没有root访问权限,则需要安装sdcard并通过pc将其删除: /.android_secure/smdl2tmp1.asec remove this file from your device /mnt/secure/asec/smdl2tmp1.asec Edit/Update by Mathias Conradt (OP): If you don't ...
  • 所以......我尝试使用mapreduce选项运行Pig脚本: pig -x mapreduce script.pig 它仍然失败,但它至少产生了一个有意义的错误。 我似乎不得不从CSV文件中删除标题,因为Pig使用标题行作为数据。 这似乎只有在使用浮点数时才会发生 - 如果使用带整数的相同脚本,则只会忽略标题行。 就是这样。 首先从文件中删除标题,而不是对它运行脚本 - 它工作。 So ... I tried running Pig script with mapreduce option: pig ...
  • 您应该只提供本地 python文件的名称作为-mapper和-reducer参数。 它们不需要在HDFS上,也不应该使用命令行提供字符串来执行脚本。 您还需要为每个脚本提供-file参数。 尝试使用 hadoop hadoop-streaming-2.7.1.jar -file /home/user_name/Documents/mapper.py -file /home/user_name/Documents/reducer.py -mapper /home/user_name/Documents/map ...
  • 您的ExecStartPre =命令似乎没有docker子命令。 你的意思是使用pull ? 阅读该单元的期刊应该可以获得更多信息: journactl -u chat.service Your ExecStartPre= command doesn't seem to have a docker subcommand in it. Did you mean to use pull? Reading the journal for the unit should get you more informati ...
  • 这是Hadoop的另一个链接,可能有助于理解Application Master(如上所述@nigge)。 http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html Here's another link from Hadoop which may help understanding the Application Master (as @nigge noted above) ...
  • 像其他程序一样启动eclipse, 生成一个'项目'。 将文件添加到项目中, 然后单击运行将触发所有文件的编译,这将创建目标文件。 然后是所有目标文件(和需要的库)的链接以生成可执行文件,然后尝试运行该可执行文件。 在项目完全创建之前,IE运行没有任何用处,并且在编译没有错误并且链接没有错误之前会有很多失败 Start eclipse the same as you would any other program, generate a 'project'. add files to the project ...
  • 此错误现已解决。 如果有人遇到类似的问题,我想发布在我的情况下,它是由HADOOP CLASSPATH未在Mesos Master和Agent容器中设置引起的。 一旦设定,一切都按预期工作。 This error is now resolved. In case anybody encounters a similar problem, I wanted to post that in my case it was caused by the HADOOP CLASSPATH not being set i ...
  • 经过所有这些研究和帮助后,它归结为当前版本的Xamarin的一个错误。 选项是等到Xamarin网站上的新稳定版本或GIT构建。 我选择等待,因为我没有好好运用临时版本。 与新的VS 2017下载的Xamarin修复了这个错误。 After all the research and help from those here it comes down to a bug with the current version of Xamarin. Options are to wait until a new s ...
  • 按如下所示修改/ etc / hosts文件: 127.0.0.1 localhost 10.0.3.107 HadoopMaster amrit 10.0.3.108 HadoopSlave1 10.0.3.109 HadoopSlave2 还要修改10.0.3.108机器的/ etc / hosts,如下所示: 127.0.0.1 localhost 10.0.3.107 HadoopM ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。