the i get the following error in build (local and grid note, v3.17)
Btw. i'm not able to copy and paste the error message from the NCrunch Test Window.
NCrunch: This project was built on server 'whatever
..\..\..\..\Users\DerAl\.nuget\packages\microsoft.build.task.git\1.0.0-beta=62925-02\build\Microsoft.Build.Task.Git.targets (20, 5): Unable to locate repository containing repository 'C:\NCrunch Grid Node\5668\327\src\Myproject.Name.Foo
This makes seens, because the build taks try to guess the git repository uri at build time, but there is of cource none visible for NCrunch.
So i tried to obvious and added a condition to the package reference.
But this does not help, i packed this inside a seperate ItemGroup with the condition, but this also not work.
Now this can be a problem on the MSBuild Side, or on the NCrunch side. Because of the highly optimized custom build on the NCrunch Side, i assume that is NCrunch which is ignoring Conditions on PackageReferences.
if not, then i file a bug on dotnet repository.
This is probably due to the way the MSBuild binding system works for PackageReferences.
To my knowledge, the PackageReference declaration doesn't really get used during the build of a project. Instead, it gets used to create the files under the 'obj' directory (specifically project.assets.json). This only happens during the Nuget restore step, which VS has complete control over and we can't safely execute ourselves.
So VS would run the Nuget restore step, probably using MSBuild integration and without the $(NCrunch) property set. NCrunch then picks up the generated project.assets.json and carries it on downstream. Because the actual binding happened before NCrunch was in the picture, the condition was never usefully evaluated.
So technically, this is between the chairs. We don't have a feasible way to take control of the restore step, and it we can't inject our own properties into VS's restore step because that would break your foreground solution.
I recommend looking at other options to disable this library under NCrunch. Maybe it has its own property that can be used as an off-switch, or you can trick it into failing silently rather than blowing up the build.
Maybe you should (can?) set that property if there is a Microsoft.SourceLink.* PackageReference in the project. Because SourceLink is something that MS will push in the Future.
trobinson-empactis wrote:
I'm running into the same problem and the above solution doesn't help. Do I just put it anywhere in my .csproj file(s)?
Here is the complete *.csproj file, this is NOT the Project with the tests, this is the actual project which get's nuget packed.
A Company is only for removing personal information. I've done this in several of our nuget packages now.
I just wanted to let you guys know that we have a change pending for the upcoming 3.18 release that will set this property automatically, so that changes to project files won't be necessary.