我正在编写一个从TFS中获取错误的应用程序.当我在我的机器上运行此程序并安装了Visual Studio运行Windows 8时,它运行正常.当我在我的一台运行Server 2008 R2和Windows 7的虚拟机上运行此程序时安装了Visual Studio Agent它会引发以下异常
Error occured: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal()
at AutomationEntities.TFSManager.GetBugsFromTestCase(Int32 testCaseID)
at AutomationEntities.ReportManager.GetBugStringFromTestCases(String testCaseString, String status)
at AutomationEntities.ReportManager.InsertOrUpdateReport(String agentMachineName, String product, String versionName, String serverURL, String testCategory, String testName, String testNumber, String status, DateTime lastModifyTime, String errorMessage, Nullable`1 elapsedTime)
at AutomationManager.XMLHandlerReport.AddItemToReportDatabase(String agentMachineName, String product, String version, String serverURL, String …Run Code Online (Sandbox Code Playgroud) 我正在运行一个引用DLL的CodedUI测试,该DLL引用了一种"配置"文件.在运行测试时,当前Directory返回CodedUI放置我使用过的测试结果文件的目录
AppDomain.CurrentDomain.BaseDirectory
Run Code Online (Sandbox Code Playgroud)
和
System.Reflection.Assembly.GetExecutingAssembly().CodeBase
Run Code Online (Sandbox Code Playgroud)
和
System.Reflection.Assembly.GetExecutingAssembly().Location
Run Code Online (Sandbox Code Playgroud)
这些都给了我相同的道路
我需要的是获取DLL所在的路径,因为这是构建配置文件的位置.
如果我正在调试或者我刚刚运行测试(显然),这将改变的位置,所以我不能使用它并向后导航或类似的东西.
有没有其他方法来获取您引用的DLL的位置?
编辑:
我从我引用的DLL内部引用此配置文件.