Service Reference in UWP reusing NetStandard assemblies - wcf

In an client/server application I am trying to reuse assemblies targeting NetStandard1.4 in the Server and in an UWP. Communication is done using WCF.
If "Reuse types in referenced assemblies" is unchecked the service references is created. Once I check the option to reuse assemblies I get the following error:
"Custom tool warning: Cannot resolve dependency to assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event."
and warnings saying:
"Custom tool warning: Cannot resolve dependency to assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event."
I found this thread: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5092755b-e1ed-4496-ae6d-74386ebdac98/uwpservice-references-in-universal-apps-and-portable-class-libraries?forum=wpdevelop it is related to PCL and I hope netstandard has overcome that issue.
I have tried importing frameworks in my UWP app:
"frameworks": {
"uap10.0": {
"imports": [ "netstandard1.4", "netstandard1.6.1" ]
}
},
but it didn't work. It seems like I am really close to have it working but I am missing a detail that makes everything work.

Related

Building VSIX project in Release does not create a VSIX file anymore, just a DLL

I think the title is pretty clear. I always build in Release mode and upload the created VSIX file to the VS Marketplace.
Since today, it just creates a .dll file when I build in Release mode, no VSIX is generated. Also,in Debug I cannot set break points anymore, symbols won't load.
After reverting the commit (5 lines of code) to the previous version the problem still occurs.
I have no idea what could have caused this. Anyone experienced this before and what can I try to resolve this?
Edit:
This shows up in the build log, can this be the cause?
warning CS1762: A reference was created to embedded interop assembly 'EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because of an indirect reference to that assembly created by assembly 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Consider changing the 'Embed Interop Types' property on either assembly
When I set the Embed Interop Types property to true on the EnvDTE assembly I get service can not be embedded errors throughout the package code.
I tried creating new VSIX projects or opening older ones, no issues there, it creates a .VSIX file when building in release mode. Comparing the CSPROJ files and configuration shows no difference.

Could not load a dependency of my custom dll exception

I have written a custom data-access library (aka DAL) which references [Microsoft.Practices.EnterpriseLibrary.Data.dll] as a dependency.
When my client app which has a reference to the DAL dll, try to use one of the DAL's methods, an exception is thrown:
Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
If I, of course, put the EnterpriseLibrary dll in my client app bin folder (or make the client reference it...), there is no error, but it's a 'crooked' solution.
What is not clear to me is why referenceing ONLY my custom DAL dll is not enough?
And, is there a way to only reference the DAL dll without referencing EnterpriseLibrary dll's directly?

system.design reference issue of WixSharp on .net 4

I'm trying to use WixSharp with .net 4, but I got this warning:
Warning The currently targeted framework ".NETFramework,Version=v4.0,Profile=Client" does not include "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which the referenced assembly "WixSharp, Version=1.0.39.0, Culture=neutral, PublicKeyToken=3775edd25acc43c2, processorArchitecture=MSIL" depends on. This caused the referenced assembly to not resolve. To fix this, either (1) change the targeted framework for this project, or (2) remove the referenced assembly from the project.
I checked that System.Design is not referenced. When I tried to add reference to it, it's actually grayed out in add reference dialog.
As a result, just as the warning says, WixSharp is not resolved, and all namespaces in WixSharp has a missing of reference error.
How should I fix this? compile WixSharp from source?
Fei

The type `System.Xml.XmlElement' is defined in an assembly that is not referenced. Consider adding a reference to assembly System.Xml

I tried to import an external library to my project, but I'm receiving an error:
Error CS0012: The type System.Xml.XmlElement' is defined in an assembly that is not referenced. Consider adding a reference to assemblySystem.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
System.XML (2.0.5.0) is added to the project. What can be the problem?
The problem may be that you are using an 'external library'
Is this a library that has been built for Xamarin.iOS? Or is it a more conventional .Net assembly.
Because Xamarin.iOS is based originally on Moonlight (which used the Silverlight assemblies), then you cannot just pull in external assemblies - you should recompile these assemblies specifically for Xamarin.iOS

What do these Mono/xbuild warnings mean and how do I fix them?

I build VS2010 projects with Mono's xbuild 2.10.5.0. The projects use the '.NET Framework 3.5 Client Profile' as the target framework (they must be 3.5 compatible and I don't need more than the client profile parts).
I'm getting the following warnings:
Build succeeded.
Warnings:
c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets: warning : Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v3.5,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.
c:\Project\MyProject.csproj (default targets) -> C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets (ResolveAssemblyReferences target) ->
C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets: warning : Reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' not resolved
C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets: warning : Found a conflict between : 'System' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System' reference.
C:\PROGRA~2\Mono\lib\mono\4.0\Microsoft.Common.targets: warning : Found a conflict between : 'System.Core' and 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Using 'System.Core' reference.
I'm afraid I don't understand these and the only Google hit for "Unable to find framework corresponding to the target framework moniker" is the commit for that error message.
What do these warnings mean and how can I fix them? Is the 'client profile' not supported by Mono at all? If so, I couldn't find anything about that in the Mono documentation. What causes the unresolved mscorlib reference and where are these two System references it reports a conflict between?
You are guessing correctly - Mono does not support the 'Client' profile (e.g. search Mono version of 3.5 Microsoft.Common.targets for any mention of 'Client'), only the full 3.5 and 4.0 profiles. To fix them, you need to specify one of the supported profiles in your project file. Profile selection only restricts the set of references available during build, an assembly compiled with the 'Client' profile will work on the 'Full' profile just fine.
The mscorlib, Version=2.0.0.0 unresolved reference is happening because you are compiling with a 4.0 profile (which is the default fallback). It will disappear once you set your profile to a supported value. If you do not want to change your project file, you can build with xbuild /p:TargetFrameworkProfile="", which correctly chooses the 3.5 set of assemblies.