简体   繁体   中英

Can I reference a .NET executable as if it is a DLL in LINQPad 6?

In LINQPad, I can add a reference to a local .NET dll file using Query Properties > Additional References > Add / Browse .

Then I can import namespaces and access members defined in the dll in my LINQPad script.

I can also add a reference to a local .NET exe file in the same way, just as I might do for a normal .NET project. The exe in question was compiled as a net472 target.

When I try to access members defined in the exe file, I get this error

The type or namespace name '...' could not be found

Is there a way to import and use members defined in a .NET project which was compiled to an exe in this way?

(I'm using LINQPad 6)

This is a good question: LINQPad 6 lets you reference .NET Framework assemblies if they happen to be compatible with .NET Core.

However, right now it doesn't recognize files with a .exe extension as potential .NET assemblies, and instead copies them to the output directory rather attempting to reference them. I'll look into whether this is easy to fix for the next build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM