Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can indeed run tests within VS without having the .vsmdi and .testsettings files (infact, you can just delete them after adding the test project)</p> <p>So why doesnt it work with a normal class library? the awnser lies inside the .csproj file. This is a regular class library:</p> <pre><code>&lt;PropertyGroup&gt; &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt; &lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt; &lt;ProductVersion&gt;8.0.30703&lt;/ProductVersion&gt; &lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt; &lt;ProjectGuid&gt;{F191EC72-AFDF-49CE-A918-01905E7C32EF}&lt;/ProjectGuid&gt; &lt;OutputType&gt;Library&lt;/OutputType&gt; &lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt; &lt;RootNamespace&gt;test&lt;/RootNamespace&gt; &lt;AssemblyName&gt;test&lt;/AssemblyName&gt; &lt;TargetFrameworkVersion&gt;v4.0&lt;/TargetFrameworkVersion&gt; &lt;FileAlignment&gt;512&lt;/FileAlignment&gt; &lt;/PropertyGroup&gt; </code></pre> <p>And this is a test project:</p> <pre><code>&lt;PropertyGroup&gt; &lt;Configuration Condition=" '$(Configuration)' == '' "&gt;Debug&lt;/Configuration&gt; &lt;Platform Condition=" '$(Platform)' == '' "&gt;AnyCPU&lt;/Platform&gt; &lt;ProductVersion&gt;8.0.30703&lt;/ProductVersion&gt; &lt;SchemaVersion&gt;2.0&lt;/SchemaVersion&gt; &lt;ProjectGuid&gt;{F191EC72-AFDF-49CE-A918-01905E7C32EF}&lt;/ProjectGuid&gt; &lt;OutputType&gt;Library&lt;/OutputType&gt; &lt;AppDesignerFolder&gt;Properties&lt;/AppDesignerFolder&gt; &lt;RootNamespace&gt;test&lt;/RootNamespace&gt; &lt;AssemblyName&gt;test&lt;/AssemblyName&gt; &lt;TargetFrameworkVersion&gt;v4.0&lt;/TargetFrameworkVersion&gt; &lt;FileAlignment&gt;512&lt;/FileAlignment&gt; &lt;ProjectTypeGuids&gt;{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}&lt;/ProjectTypeGuids&gt; &lt;/PropertyGroup&gt; </code></pre> <p>That last element, <code>ProjectTypeGuids</code> is what tells VS that its a project that you can run MSTest tests on. these guids are always the same as far as i know, [at least given the same version of VS] so you should be able to paste that line into any .csproj file and have VS recognize the tests inside.</p> <p>The test settings file can be useful to specify options for deployment (and alot of other things) but most of the options can also be specified at the command line to mstest.exe</p> <p>The .vsmdi can also be replaced by adding attributes to your test methods. most if not all options available in the <code>Properties</code> for a test can be set as attributes as well as in the vsmdi file. i generally prefer the attributes as they are 'closer' to the code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload