Skip to content

Look for DLLs in RID directory, not just EXEs #37

@mwhelan

Description

@mwhelan

My xproj test project targets netcoreapp1.0 and net46 (project.json defines them in that order). I have some tests that use a dependency that is only net46 so I am using #if directives to make it compile:

    public class SemanticVersioningTests
    {
#if NET46
        [Test]
        public void specify_has_no_public_api_changes()
        {
            var publicApi = PublicApiGenerator.PublicApiGenerator.GetPublicApi(typeof(IScenario).Assembly);
            publicApi.ShouldMatchApproved();
        }

        [Test]
        public void specify_autofac_has_no_public_api_changes()
        {
            var publicApi = PublicApiGenerator.PublicApiGenerator.GetPublicApi(typeof(AutofacContainer).Assembly);
            publicApi.ShouldMatchApproved();
        }
#endif
    }

When I right click the file and choose Test with > .Net Framework, I get the following error:

System.IO.FileNotFoundException: Could not load file or assembly 'nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
File name: 'nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'
   at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
   at Polyfills.ReflectionPolyfill.GetCustomAttributes(MemberInfo member)
   at TestDriven.NetCore.TestRunnerFactory.hasCustomAttributes(MemberInfo member)
   at TestDriven.NetCore.TestRunnerFactory.useAdHoc(MemberInfo member)
   at TestDriven.NetCore.TestRunnerFactory.Create(ITestListener testListener, String assemblyFile, String cref, TestRunnerTarget& target)
   at TestDriven.NetCore.Program.run(String assemblyFile, String cref)
   at TestDriven.NetCore.Program.Remote.Run(String assemblyFile, String cref)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions