How big is the risk when testing a .net 3.5 Assembly using a .net 4.0 test assembly

南楼画角 提交于 2019-12-08 01:54:30

问题


I realise that Visual Studio 2010 sp1 allows test projects to target 3.5 now. However, for various reasons I don't fully appreciate, our test projects still target dot net 4.0.

The general question is in the title. How big is the risk?

Specifically, this presumably means that the tests will run in the CLR v4, whereas many of our clients will be using CLR v2. Also, the tests seem to use v4 of library components (such as System.Data), even though the application is built against v2.

One method (System.Data.SqlClient.SqlBulkCopy) contains a bug in v2 which has been fixed in v4. Our testing missed this.

Leaving aside the CLR, how can I force my application to use v2 of some library, even when it is referenced by (loaded into the app domain of) a v4 test assembly? I've been experimenting with an example, and can't seem to make it happen. My 3.5 App references System.Data v2, and echos the assembly version number to the console. When called from a 3.5 test assembly, the version is 2.0. From a 4.0 test assembly, the version is 4.0. ("Specific Version" is set to true in the reference from my App)


回答1:


This should give you what you need:

In-Process Side-by-Side Execution




回答2:


I don't have an answer to this, so we've decided to side-step the issue by reverting our test projects to dotnet 3.5. This means that tests run under the CLR 2.0. However, we still use MSTest from VS2010, and are still able to use nifty 2010 features such as test categories and data driven tests.



来源:https://stackoverflow.com/questions/9079518/how-big-is-the-risk-when-testing-a-net-3-5-assembly-using-a-net-4-0-test-assem

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