Error adding oxygene .netcore library to c# .netcore 3 application

I am getting an error when I create a c# console application for .netcore in visual studio 2019 16.5, and try to add an existing oxygene console application as a reference. I am getting an error saying that the oxygene targets .NETCore3.1, and that it can’t be referenced by a project that targets ‘.NETCoreAPp, Version v3.1’. I have tried creating a console application that was built in oxygene as well as a library, and even tried turning the console application to library. I have tried by specifying in oxygene to target both .NETCore3.1 and .NETCore, and get the same error message. I have even tried creating a wpf oxygene project and tried to set it to a library, and go the same error . What am I doing wrong, when I need to reference the oxygene project inside a c# .netcore console or wpf application?

Steven,

do you get this error during build, or when adding the reference? If the latter, can you as, a workaround, try adding the reference in Water? (just open the Solution, and drag the library project onto the main project).

It is the second case, when adding the reference does it give me an error. I tried the solution in Water, and get the following error: Reference ‘NetweaverEngineCore’ could not be resolved for target ‘Echoes’ (Echoes .NETCore anycpu). I have added the “echoes” reference, but got the same error.

Steve

Steven,

any chance you could send me those two projects (I dont need the source files, just the .elements and .sln file) so I can have a look?

Alternatively, a complete rebuild (Contrl-Shift-B) log from Water would help, ideally with log verbosity set to the highest level in the Preferences dialog.

Yeah, “Echoes” here refers to the (auto-generated internal name of the target your project is build for, not the Echoes.dll reference (which is optional for .NET projects).

Is there an email address I can send the projects to? I have no problem sharing the projects with you, just don’t want them on a public forum. The two projects are simple, one is currently just a shell of console application for c# that will reference the second, the oxygene project.

Steve

~WRD000.jpg

You can DM them to me here, or send them to support@remobjects.com, whichever you prefer.

Wait: I missed this part before: are these both Elements projects? Or is it one Oxygene and one Visual C#?

The original version of the oxygene project was done in elements, and then tried adding it as a reference to a new project that was part of an existing visual studio 2019 solution. That failed. I recreated the oxygene project in Visual Studio 2019, and got the same error when I tried to add this oxygene project as a reference, couldn’t reference the oxygene project in the visual c# project.

As part of your suggestion to try to move this into Water, I imported/converted the visual c# project into the Water IDE and tried to add the reference, but from either version of the above oxygene projects, and got that I an error : “Reference ‘NetweaverEngineCore’ could not be resolved for target ‘Echoes’ (Echoes .NETCore anycpu)”, and I tried other compiler architectures, and they failed. What I am sending right now is the 2 visual studio projects, both targeting .net core 3.1.

Let me know if you need any additional information.

Steve

Ok, looks like these are two unrelated scenarios/errors then:

  • referencing a Oxygene project from VC#, isn CS
  • referencing a Oxygene project from another Elements project, in Water

I’d still like to see both projects (or both sets of projects), so I can have a look whats wrong as both scenarios, while going thru different paths in the background, should of course work w/o error.

I will send you the two elements projects from water soon. I have sent the first case already. Thank you for help and patience.

Steve

1 Like

Got it. booting my Windows VM now to test that in VS.

Ok, so I opened bth projects in there same .sln is Visual Studio 2019. I riughtc-lciked there Dependencies node of the VC# project, selected Add Project Refrence, picked the NetweaverEngineCore and clicked Add, and it was added fine without any error:

the following entry was added to the ,.csproj:

 <ItemGroup>
    <ProjectReference Include="..\NetweaverEngineCore\NetweaverEngineCore.elements" />
  </ItemGroup>

(note that this is all done by the Visual C# project system, not us).

I do get the error you reported when building the projects though. the Elements project builds fine, but the VC# one doesnt like the reference, same message as you quoted:

Project '..\NetweaverEngineCore\NetweaverEngineCore.elements' targets '.NETCore'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v3.1'

This seems to be a difference in the exact working of the .NET version string, .NETCore (which as far as I know is correct, in the Elements project, but .NETCoreApp in the VC# one.

after some research’s this does seem to be an error on our end, “.netcoreapp” looks to ben the correct name to report, not “.netcore”. Oddly, reviewing our build chain code, “.NETCoreApp” is what we report back to MSBuild…

I have a potential fix, but I can’t get VS to use my locally-modified .targets file; I’ll need to wait for a installer to build on out CI before I can retest.

Yep, that fix did it:

========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

I’ll upload a new build to your Personal Downloads folder.

I’d still like to see the converted project that gives you the “Reference ‘NetweaverEngineCore’ could not be resolved for target ‘Echoes’ (Echoes .NETCore anycpu)” error, though.

thanx!

I figured out the problem with the other type. The original project was done on a MAC with FIRE. When I brought it in, I originally opened the project in visual studio, and tried adding the it to the test visual studio console project. I do not know why, but that seemed to change the project, because when I tried to use the same FIRE in a new Water console application, it gave me that error. This morning, I decided to revert the code repository and there were changes to the elements file that were reverted. I created a new solution inside Water, and created a .net core console app. I added the FIRE project, fixed a couple of minor path issues, compiled it, and then was able to add it to the console app as expected. I think opening up the nweng first in visual studio and going to Water second screwed it up.

Steve

Curious, but possible.