2017-04-26 195 views
2

我有用F#編寫的基於XUnit的規範項目。它有AutoGenerateBindingRedirects集到真正作爲當項目文件的AutoGenerateBindingRedirects設置爲true時,爲什麼我必須在XUnit規範中使用綁定重定向

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 

但是得到在VS2017測試運行,我需要有約束力重定向添加一個app.config運行規範。

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /> 
    </startup> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-4.4.1.0" newVersion="4.4.1.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

是否AutoGenerateBindingRedirects真正做到在這種情況下什麼嗎?如果不是那麼它的目的是什麼?

回答

0

使用此:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> 

你需要他們兩人的單元測試項目。

+0

請不要張貼重複的答案,如果問題是相同的答案,並投票結束其他重複。如果問題不盡相同,請根據每個問題的具體情況定製答案。 – ChrisF

相關問題