Description
Hi all --
This may not be a bug, but I'm tearing my hair out trying to figure out where things are going wrong..
Sample Project here: https://github.com/cmoski/DllExportErrorExample
I'm getting a weird netstandard error that it cannot load the assembly when using a DateTime in the sample class -- can't quite figure out where this error is coming from.
Any assistance would be amazing!
Thanks.
Steps to reproduce:
- Create a NetStandard 2.1 DLL Library Project
- Create a C++ Native App to utilize DLL
- Call a C# Native function like DateTime
public class Class1
{
[DllExport]
static public double FailTest(double num1, double num2)
{
return num1 - num2;
}
public static DateTime Today = DateTime.Now; // <- If this variable init is commented out, the application works fine!
}
Observe the error: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
If the DateTime piece is commented out, app works fine. This is problematic for obvious reasons :P
DllExport -version
: v1.7.4.29858+c1cc52f- Used Visual Studio / MSBuild / ...: Visual Studio 2019
Information from Data
tab or log data:
Installed: True; 1.7.4+c1cc52f; invoked: 1.7.4
Project type: CsSdk
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.ordinalsBase: 1
Compiler.rSysObj: False
Compiler.ourILAsm: False
Compiler.customILAsm:
Compiler.genExpLib: False
Compiler.peCheck: PeIl
Compiler.patches: None
PreProc.Type: None
PreProc.Cmd:
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd:
SignAssembly:
Identifier: D9901FE8-62AA-4BE4-96A4-8F48F6C83261
Instance: C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Dev\SubmissionTo3F\SmallFuncTest\SmallFuncTest.csproj
Action: Configure
PlatformTarget: x86
TargetFramework: netstandard2.1
TargetFrameworks:
TargetFrameworkVersion:
RootNamespace:
AssemblyName:
MgrArgs:
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy:
StoragePath: .net.dllexport.targets
ddNS: SmallFuncTest
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Dev\SubmissionTo3F\
PkgPath: C:\Dev\SubmissionTo3F\packages\\DllExport.1.7.4\
SlnFile:
SlnDir: C:\Dev\SubmissionTo3F\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError:
Demo Project file:
https://github.com/cmoski/DllExportErrorExample