Skip to content

Instantly share code, notes, and snippets.

@urasandesu
Created April 29, 2017 00:39
Show Gist options
  • Save urasandesu/0c76233771de2cdc0c8027b1a8441e4a to your computer and use it in GitHub Desktop.
Save urasandesu/0c76233771de2cdc0c8027b1a8441e4a to your computer and use it in GitHub Desktop.
Visual Studio 2017 does not load .runsettings file. The following sample works fine in Visual Studio 2013.
using NUnit.Framework;
using System.Diagnostics;
namespace RunSettings2017
{
[TestFixture]
public class Class1
{
[Test]
public void ProcessNameTest()
{
#if _NET_3_5
Assert.AreEqual("vstest.executionengine.clr20", Process.GetCurrentProcess().ProcessName);
#elif _NET_4_5
Assert.AreEqual("vstest.executionengine", Process.GetCurrentProcess().ProcessName);
#endif
}
[Test]
public void ImageRuntimeVersionTest()
{
#if _NET_3_5
Assert.AreEqual("v2.0.50727", typeof(object).Assembly.ImageRuntimeVersion);
#elif _NET_4_5
Assert.AreEqual("v4.0.30319", typeof(object).Assembly.ImageRuntimeVersion);
#endif
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<RunConfiguration>
<TargetFrameworkVersion>Framework35</TargetFrameworkVersion>
</RunConfiguration>
</RunSettings>
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<RunConfiguration>
<TargetFrameworkVersion>Framework45</TargetFrameworkVersion>
</RunConfiguration>
</RunSettings>
@milla
Copy link

milla commented Sep 22, 2017

How about framework 4.6, 4.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment