Closed mkosieradzki closed 7 years ago
Having the same issue, on a net461 project.
Error CS0012 The type 'StatefulService' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.ServiceFabric.Services, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Error CS0012 The type 'ServiceInstanceListener' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.ServiceFabric.Services, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
I can't build anything with the preview packages due to this.
@mkosieradzki, Thanks for reporting this issue.
I am quite sure that CS0012 is related to the signing issue ;)
running into the same with FabActUtil:
2>System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceFabric.Actors, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
2>File name: 'Microsoft.ServiceFabric.Actors, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
2> at FabActUtil.ToolContext..ctor()
2> at FabActUtil.Tool.Run(ToolArguments arguments)
2> at FabActUtil.Program.Main(String[] args)
<Exec Command=".\bin\Debug\net462\win7-x64\FabActUtil.exe /spp:PackageRoot /t:manifest /arp:.\bin\Debug\net462\win7-x64\ /sp:DotNetCoreActorExample /in:.\bin\Debug\net462\win7-x64\DotNetCoreActorExample.exe" />
So, from this issue i gather that the libs for netstandard2.0 (located in /ref folder in nuget) are not strong named.
I reverted my projects back to 462, but still my project got the bad dlls above. (easy to see the different in output folder. Microsoft.ServiceFabric.Actor is 452kb for the net452 in nuget and 417kb for the netstandard).
I created a very clean project with the following csproj.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net462</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="Unity" Version="5.0.0-beta" />
<PackageReference Include="Microsoft.ServiceFabric" Version="6.1.211-preview" />
<PackageReference Include="Microsoft.ServiceFabric.Data" Version="3.0.211-preview" />
<PackageReference Include="Microsoft.ServiceFabric.Actors" Version="3.0.211-preview" />
<PackageReference Include="Microsoft.ServiceFabric.Services" Version="3.0.211-preview" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\..\dev\S-Innovations\S-Innovations.ServiceFabric.Unity\src\S-Innovations.ServiceFabric.Unity\S-Innovations.ServiceFabric.Unity.csproj" />
</ItemGroup>
</Project>
and build to see that the output uses the 452kb version of Actors.dll.
If I clean the output folder, add <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
as a dependency and build again, i now have the bad dll 417kb in my output folder.
I am not clever enough to figure out why dotnet core works like this, but this caused me some issues due them not being strong named.
@hrushib Not fixed in 3.0.219-preview :-(
OK. Some more info on this issue. This nuget package is broken two-fold.
So basically there are three additional scenarios to test:
Referencing from net461 signed
Referencing from net461 not-signed
Referencing from netcoreapp2.0 signed
Referencing from netcoreapp2.0 not-signed - basically works but it fails due to probable bug in satellite assembly resolution #563
Yes, the fix is still not out yet for this one. Will confirm here once we update the SDK.
@raunakpandya This issue is caused us to change our test projects to netcoreapps, which means our codecoverage tooling is not able to work, as they are still working on that feature for netcore. Could you give an indication in which SDK this problem will be addressed and when this SDK will become available?
The fix for this should be out very soon in the next SDK update, which is in the process of rollout. I didn't quite understand what do you mean by having to update test projects to netcoreapps because of this issue. Can you elaborate there?
During compilation of the net47 testproject, the System.Fabric dll from netstandard/ref gets used. However the dll in the output folder was the net45 version. This caused exceptions of not being able to find the assembly during the tests.
Making the test project a netcoreapp project, it is compiled and uses the netstandard System.Fabric assembly and works correctly. But as stated before our tooling is not able to do code coverage for netcore test dlls yet.
@PepijnGramberg, I didn't get what you mean by below statement
However the dll in the output folder was the net45 version.
Some follow-up questions below.
During testing when loading the main project assembly it starts looking for the netstandard System.Fabric Assembly (PublicKeyToken NULL) and cannot find it.
Building is done in VS 15.4.2
@raunakpandya - i see that the next SDK has been released.
But i dont see any new nuget preview packages? Does this mean that the issue with not signed dll was not in the nugets? or is there coming updated nuget packages also?
@pksorensen According to the release notes there are no changes the in .NET SDKs and Preview SDKs :-(
I have checked some random nuget packages and it seems 6.1.232-preview are finally signed! I am going to check today!
Cool, i also managed to get netcoreapp2.0 service fabric apps running with netstandard2.0 libraries.
@pksorensen - Great to know that you were able to get netcoreapp2.0 working with this SDK.
@mkosieradzki - These packages are released as part of Service Fabric 6.0 CU2, and should fix compilation issue you were facing.
@PepijnGramberg - Please update your project to use nuget package version 6.1.232-preview, this will resolve issue you were facing (PublicKeyToken NULL).
@hrushib Thanks that fixed it
Preview version of packages are causing issues during compilation.
10>CSC : warning CS8002: Referenced assembly 'Microsoft.ServiceFabric.Services, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. 10>CSC : warning CS8002: Referenced assembly 'System.Fabric, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. 10>CSC : warning CS8002: Referenced assembly 'Microsoft.ServiceFabric.Data.Interfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.
I have checked for example package:
microsoft.servicefabric\6.1.211-preview
andref
andruntime
version ofSystem.Runtime
is not signed, butnet45
version is signed. However I am not really convinced it should be net45 and not netstandard2.0... but that's a different issueThe core issue I am investingating is:
error CS0012: The type 'ServiceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Fabric, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
- and my guess this is due to the discrepancy between ref lib and runtime assemblies