Hi,
I'm facing a rather weird issue.
I'm using NCrunch 3.5.0.1 and VS2017 Professional.
When ncrunch is becoming ENABLED, it's uninstalling packages from my project - which in consequence makes the builds fail
Am I missing something? or is this a new feature I'm not yet aware of?
Build/Test Issues
[VS2017] When NCrunch is Enabled, NuGet packages are being uninstalled
Started by mmisztal on 6,280 views
Remco NCrunch Developer
#9949
12 Mar 2017 22:01 UTC
Hi, thanks for sharing this issue.
This is .. very weird. I haven't heard a report like this before.
Can you describe in detail what you're seeing when these packages uninstall? Are we talking about the references from a project to Nuget packages?
Package references are usually declared in project XML. There is no code in NCrunch that manipulates source code or project XML.
This is .. very weird. I haven't heard a report like this before.
Can you describe in detail what you're seeing when these packages uninstall? Are we talking about the references from a project to Nuget packages?
Package references are usually declared in project XML. There is no code in NCrunch that manipulates source code or project XML.
Here you go: https://youtu.be/tjbhHdUiZnk
There was some audio but apparently my mic is broken.
Basically, NCrunch seems to remove the package that was added last (Shoudly) to the unit tests project.
After re-adding the package, NCrunch didn't pick this fact up, so I had to manually start a rebuild process, which triggered the package removal again.
In a different SLN it removed a package (MediatR) from the only assembly in the project.
Hope this helps.
There was some audio but apparently my mic is broken.
Basically, NCrunch seems to remove the package that was added last (Shoudly) to the unit tests project.
After re-adding the package, NCrunch didn't pick this fact up, so I had to manually start a rebuild process, which triggered the package removal again.
In a different SLN it removed a package (MediatR) from the only assembly in the project.
Hope this helps.
Remco NCrunch Developer
#9953
13 Mar 2017 02:51 UTC
Wow.. It just vanished! That's crazy.
There is one thing I can think of that will do this.
When NCrunch loads a project for the first time, it will run 'dotnet.exe restore' for this project. This will happen if the project is using the new CPS system (i.e. minimal .csproj template).
So my best guess here is that dotnet restore is dropping the reference for some reason.
When you start NCrunch, have all changes to the project been saved to disk?
Also, can you confirm the TargetFramework for this project? (you can just grab this out of the project XML, i.e. <TargetFramework>netcoreapp1.1</TargetFramework>)
There is one thing I can think of that will do this.
When NCrunch loads a project for the first time, it will run 'dotnet.exe restore' for this project. This will happen if the project is using the new CPS system (i.e. minimal .csproj template).
So my best guess here is that dotnet restore is dropping the reference for some reason.
When you start NCrunch, have all changes to the project been saved to disk?
Also, can you confirm the TargetFramework for this project? (you can just grab this out of the project XML, i.e. <TargetFramework>netcoreapp1.1</TargetFramework>)
Remco NCrunch Developer
#9954
13 Mar 2017 03:45 UTC
Ok, I've managed to get this happening for me.
It's because the project changes haven't been saved to disk.
NCrunch accepts the in-memory changes from VS, and then uses these changes to load the project. It doesn't save the changes to disk, so 'dotnet.exe restore' doesn't have them when it works with the project file. Because dotnet restore touches the project file, VS discards its in-memory changes and automatically reloads the project file from disk.
This is rather messy. It means that project changes will automatically be stripped by NCrunch if the engine is running while the changes are made.
To work around this, make sure NCrunch is disabled when you make changes to your projects. Always save in-memory changes before starting the engine.
I'll see what I can do about implementing a proper fix.
It's because the project changes haven't been saved to disk.
NCrunch accepts the in-memory changes from VS, and then uses these changes to load the project. It doesn't save the changes to disk, so 'dotnet.exe restore' doesn't have them when it works with the project file. Because dotnet restore touches the project file, VS discards its in-memory changes and automatically reloads the project file from disk.
This is rather messy. It means that project changes will automatically be stripped by NCrunch if the engine is running while the changes are made.
To work around this, make sure NCrunch is disabled when you make changes to your projects. Always save in-memory changes before starting the engine.
I'll see what I can do about implementing a proper fix.
Remco NCrunch Developer
#9967
15 Mar 2017 04:38 UTC
A fix for this is now out with v3.6.
Post a reply
Log in to reply.