New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot open source file #137
Comments
Hi @tg2k Are you using Visual Studio to build? If so, can you try doing a rebuild? If not, in Visual Studio can you provide the commands you are running, including when and where deleting of bin/obj. Out of curiosity, why are the bin/obj directories being manually deleted? |
Yes, I'm using Visual Studio 2022 Community, and I installed the latest x64 and x86 .NET 6 SDKs this morning. I manually deleted bin/obj to create a clean slate build while debugging other issues. Here's the build log for a Rebuild All as it hits this project:
It may be worth adding that I was just creating a number of test methods to verify basic behavior, and in so doing I noted that at present there doesn't seem to be a way to return a string or directly accept an object passed in as a COM reference. I'm assuming I can work around the reference object issue using something like IntPtr but not sure about the string return. |
Does any part of this path exist? I'm very confused as to why this would since if the bin/obj directories are deleted, then the entire build process would start again.
The DNNE project is about a low-level near zero-overhead approach to exposing types to native code. The .NET |
BC3\obj\Debug\net6.0-windows\win-x86\dnne exists, but the BC3.g.c file isn't there. Thanks for the advice on marshalling, I'll definitely make use of it if I'm able to return to investigating this approach to interop. |
@tg2k Let me confirm one more thing. In your project, I am assuming there is at least a single exported function marked with |
@AaronRobinsonMSFT Yes, I did have one, but your reply prompted me to experiment around that. The following code will Rebuild All fine, regardless of whether there is bin/obj already:
But this code (which you established above is not correct code) will only successfully Rebuild All after there has first been a successful build without it:
When I replace this with marshalled code however it does build:
It may be worth handling the build more gracefully when there is an illegal signature present. Aside from that, it would be great if there was a more detailed explanation around how to customize entry point names to get around decoration while still controlling calling convention. What's in the readme doesn't convey what I actually need to add or edit in the C# project. It mentions DNNE.props which is inside the NuGet package folder rather than anything inside the project, and I don't see a way to actually provide a .def file in a C# project. |
Hmm. Let me see how that would work.
Those are MSBuild properties that you can set inside your project. They are defined in that props file for documentation purposes and describe what they do. It should be as simple as setting the property to a defined <DnneWindowsExportsDef>MyExports.def</DnneWindowsExportsDef> An example of what the
|
Thanks for the clarification. I've worked a little with |
vs-threading has a similar problem. The build is fine, but VS itself reports two errors in the error list: Transcribed as text below for searchability:
|
@AArnott Is this consistent? Should I be able to reproduce this locally? |
Yes. These steps should repro it:
My guess is once you build once, a fresh open in VS won't show this error. If so, you should be able to reproduce the problem as I did by running |
Another thing that concerns me about this message is that it means VS is trying to run cl.exe in its design-time build, which is totally inappropriate, as it will slow down a great many other design-time experiences in VS. In fact this failure appears to be breaking the design-time build, which is now producing many more errors in the error list as the language service cannot fully initialize. |
@AArnott That is entirely possible and likely the case. I wrote most of this while testing outside of VS. I assume following these docs will help avoid a majority of these problems, https://github.com/dotnet/project-system/blob/main/docs/design-time-builds.md. |
After deleting my bin/obj folders, I get this when trying to build:
c1 : fatal error C1083: Cannot open source file: '<path>\BC3\obj\Debug\net6.0-windows\win-x86\dnne\BC3.g.c': No such file or directory
I've seen this with multiple projects (I've created new projects multiple times when encountering this problem).
This is an x86 project and does have
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
set per #58 and this commit .
The text was updated successfully, but these errors were encountered: