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

Notification

Icon
Error

NChrunch 3.22.0.1 has issue with with building.
trondr
#1 Posted : Saturday, November 24, 2018 10:36:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/24/2018(UTC)
Posts: 2
Location: Norway

Thanks: 1 times
NChrunch 3.22.0.1 has issue with with building.

Repro steps - Visual Studio 15.9.2
1. Create F# Console Project - .NET Framework 4.7.2 -> Visual Studio builds project OK. NChrunch builds project OK.
2. In Nuget Manager add reference to FSharp.Data and FSharp.Data.Xsd -> Visual Studio builds ok. NChrunch no longer builds project. Fails with error:

---
FSC (0, 0): The type provider 'C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'file:///C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.DesignTime.dll' or one of its dependencies. The system cannot find the file specified.
FSC (0, 0): The type provider 'C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.Xsd.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.Xsd.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'file:///C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.Xsd.DesignTime.dll' or one of its dependencies. The system cannot find the file specified.

WARNING - FSC (0, 0): FS3005: Referenced assembly 'C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
WARNING - FSC (0, 0): FS3005: Referenced assembly 'C:\Users\devuser\AppData\Local\NCrunch\9964\1\_ncrunchreferences\FSharp.Data.Xsd.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
---

I experienced this issue initially in 3.15 which is the latest version I have support for. When I tested the latest version I do not currently have support for, 3.22.0.1, this version also have the same issue.

It seems the same issue is not reproducible in a .Net Core Console project.
Remco
#2 Posted : Saturday, November 24, 2018 11:59:44 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,476

Thanks: 717 times
Was thanked: 898 time(s) in 854 post(s)
Hi,

Thanks for sharing this issue. I've reproduced it as you've described.

The problem is caused by FSharp Type Providers being used in the referenced assemblies. Type Providers are a special feature native to FSharp, allowing assemblies to create implicit design-time references to other assemblies. To my knowledge, these references aren't represented inside the build system, so NCrunch is completely unaware of them. We've implemented some handling for type providers before, but this was only inside user code whereas in this case we have them appearing in libraries.

Fixing this properly in NCrunch is something that we don't yet have an acceptable way to do, but this will likely change over the next few months with some planned internal improvements. For the time being, you can work around this problem by introducing assembly references from your FSharp project directly to the missing assemblies. If you want to avoid having these assemblies placed in your normal build output directory and accidentally shipped with your software, you can include them with a condition inside your project file, for example:

<ItemGroup Condition="'$(NCrunch)' == '1'">
<Reference Include="FSharp.Data.Xsd.DesignTime">
<HintPath>..\packages\FSharp.Data.Xsd.1.0.2\lib\net45\FSharp.Data.Xsd.DesignTime.dll</HintPath>
</Reference>
<Reference Include="FSharp.Data.DesignTime">
<HintPath>..\packages\FSharp.Data.3.0.0\lib\net45\FSharp.Data.DesignTime.dll</HintPath>
</Reference>
</ItemGroup>
1 user thanked Remco for this useful post.
trondr on 11/25/2018(UTC)
trondr
#3 Posted : Sunday, November 25, 2018 4:16:29 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/24/2018(UTC)
Posts: 2
Location: Norway

Thanks: 1 times
Thanks Remco!

I have confirmed your workaround. I have added the following (with adjusted hint paths) to my console and test projects. NChrunch is now building and running tests.

<ItemGroup Condition="'$(NCrunch)' == '1'">
<Reference Include="FSharp.Data.Xsd.DesignTime">
<HintPath>$(USERPROFILE)\.nuget\packages\fsharp.data.xsd\1.0.2\lib\net45\FSharp.Data.Xsd.DesignTime.dll</HintPath>
</Reference>
<Reference Include="FSharp.Data.DesignTime">
<HintPath>$(USERPROFILE)\.nuget\packages\fsharp.data\3.0.0\lib\net45\FSharp.Data.DesignTime.dll</HintPath>
</Reference>
</ItemGroup>

Users browsing this topic
Guest (2)
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.043 seconds.