Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

cant resolve project Dependency
Joreyk
#1 Posted : Tuesday, January 24, 2023 4:47:03 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/24/2023(UTC)
Posts: 10
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
i have 2 projects,
The Main Project : BFN_DamageCalculator
Second: BfnXmlLibrary ( which is both a cs library AND source generator which uses Roslyns source generator afaik )

Code:

PS C:\Users\ixlle\Documents\BFN_DamageCalculator> dotnet build
MSBuild version 17.4.1+9a89d02ff for .NET
  Wiederherzustellende Projekte werden ermittelt...
  Alle Projekte sind für die Wiederherstellung auf dem neuesten Stand.
  BfnXmlReaderLibrary -> C:\Users\ixlle\Documents\BfnXmlReaderLibrary\bin\Debug\netstandard2.0\BfnXmlReaderLibrary.dll
  BFN_DamageCalculator -> C:\Users\ixlle\Documents\BFN_DamageCalculator\bin\Debug\net6.0\BFN_DamageCalculator.dll

Der Buildvorgang wurde erfolgreich ausgeführt.
    0 Warnung(en)
    0 Fehler

Verstrichene Zeit 00:00:02.34

thats the result when i manually build it, so it works and resovles dependencies

when ncrunch wants to build it says
that the using directive to a class in the XmlLibrary cant be resolved "mybe im missing a using directive"...

"using BfnXmlLibrary;" is the line that cant be resolved.. HOW would i miss a dependency here???

the second project is included this way in the csproj
Code:
 <ProjectReference Include="..\BfnXmlReaderLibrary\BfnXmlReaderLibrary.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true"/>
Joreyk
#2 Posted : Tuesday, January 24, 2023 5:56:30 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/24/2023(UTC)
Posts: 10
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
im using 4.15.0.4 and VS22 latest version
Joreyk
#3 Posted : Tuesday, January 24, 2023 8:33:49 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/24/2023(UTC)
Posts: 10
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
so i was able to resolve the issue

the problem is:
ncrunch cant use a project as source generator AND normal project

so you will have to extract all "normal" code of your source generator project and generate that code on the main project
this way you dont need to include it anymore as normal project which results in resolving the conflict.. i wish this would have been fixed..
Remco
#4 Posted : Wednesday, January 25, 2023 12:38:50 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

I apologise for the frustration here.

Source generator projects are referenced differently inside project XML, and have a very different life-cycle through the build system. We went through some pain to make them work under NCrunch. All the examples I've seen of people building source generator projects involved having the source generator housed within its own project, separate from the rest of the application. In truth, I had no idea it was even possible for them to reside inside standard application projects without referencing issues showing up. If a source generator project is also an application project, this would require all dependencies of the application to potentially be rolled into the compile-time environment, which is a delicate place that we all need to be very careful with.

I am uncertain whether such a structure is intentional from MS's standpoint. Truthfully, I'm not qualified to make such an assessment. I'll make a note to examine this closer from NCrunch's side to see if this is something we can support. From a tooling and dependency management standpoint, I would recommend keeping source generator projects and application code separate in your solution.
1 user thanked Remco for this useful post.
Joreyk on 1/28/2023(UTC)
Joreyk
#5 Posted : Saturday, January 28, 2023 11:17:33 PM(UTC)
Rank: Member

Groups: Registered
Joined: 1/24/2023(UTC)
Posts: 10
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thanks.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.040 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download