Closed Herbie60D closed 6 years ago
Hi,
yes, from version 2.0, NMF only supports .NET Standard 2.0 in order to avoid cross-compilation and thus simplify the code. However, .NET 4.6.1 with Visual Studio 2015 should be supported (according to https://github.com/dotnet/cli/issues/6739), but you might have to install the .NET Core 2.0 SDK.
If this absolutely does not work, I can restore the old project files and perform a cross-compilation to .NET Standard 2.0 and .NET Framework 4.0/4.5.
Best,
Georg
Hello Georg. Thank you for the fast reply. Simply installing the .NET Core 2.0 SDK did not fixed the problem, but was the first step.
I installed the SDK, but got no other result than before. https://www.microsoft.com/net/download/windows
Then I found the announcement https://github.com/dotnet/announcements/issues/24. It states that at least Nuget 3.6 is needed in Visual Studio 2015 to reference a .Net Standard 2.0 library. https://www.nuget.org/downloads
Now I got another error message:
To reference a library that targets .NET Standard 1.5 or higher, you need to install the .NET Standard Build Support extension for the .NET Framework https://aka.ms/netstandard-build-support-netfx
I installed the .NET Standard Build Support extension from the link above and got a lot of the following errors.
error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\System.Xml.XmlSerializer.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.XmlSerializer.dll'. Remove one of the duplicate references.
For this I found the open issue https://github.com/dotnet/sdk/issues/1539 As workaround it is suggested to set \<ImplicitlyExpandDesignTimeFacades>false\</ImplicitlyExpandDesignTimeFacades> in first PropertyGroup element of the project file. I did this an now my project and also a newly created test project compiled.
But now I got a warning for each project that uses NMF-Basics 2.0.*
Warning The referenced component 'System.Net.Http' could not be found.
To solve this I found a workaround in the issue https://github.com/dotnet/sdk/issues/1499#issuecomment-322874417. I added the suggested lines to the end of my project file and the warning disappeared. The second solution would be to delete the reference to 'System.Net.Http' from all projects.
Now I get the warning
warning MSB3061: Unable to delete file "[path removed]System.Net.Http.dll". Access to the path '[path removed]\bin\Debug\System.Net.Http.dll' is denied. Visual Studio seems to block the file by itself, wehn I open the project.
This is the current status of my research how to use a .NET Standard 2.0 assembly from a Visual Studio 2015 project. Maybe this helps someone. I hope Microsoft fixes those issues. For now I will stay with NMF-Basics 1.0.99 and will change the version only when needed.
Oh, that looks like a lot of mess, indeed. I did not know it was that difficult to use .NET Standard with Visual Studio 2015 (I am using VS 2017 for quite some time now).
This should be fixed now as the latest version has support for .NET 4.5 for most runtime libraries
Thank you! This helps us as long as we have not switched to Visual Studio 2017 in our company.
Hello. Currently I use the nuget package NMF-Basics 1.0.99 with .NET Framworke 4.6.1 in Visual Studio 2015 Update 3. When I try to update to the newest version or create a test project and try to freshly install version 2.0.111 i get always the following error for all .NET Frameworks from 4.0 to 6.6.1.
Thnak you for the help!