I was facing an Unsupported Framework issue with Nuget packager on Visual Studio Team Service Online (VSTS) when porting my HBD Framework to the .Net Standard.
I had been mad with this issue in a couple of days, and eventually, I found a solution to fix it. Let me explain about the problem and the solution. So it might help for those who are facing the same problem.
1. Build and Deployment Process.
First, I would like to share my Nuget Publishing Automation Process. I have using VSTS as primary source codes repository sin last few years. In there, I created a few auto build and auto release processes that help to publish my packages into Nuget.org continuously.
Internally, I’m using the Package Management for VSTS as my test environment. So all beta versions of my packages have been published into this tool for testing purposes. Once the package is stable, I just simply trigger the other release to put it to Nuget.org.
Below is the illustration of the publishing process that had been implemented on my VSTS.
I will show you the details of the continuous deployment in difference post as the purpose of this post is fixing the Nuget Packager issues.
2. The Issue.
When ported my HBD framework to the .Net Standard, the Nuget Packager was showing the below warning message when packaging my binaries on VSTS.
1234567 1 issue(s) found with package 'HBD.Framework'.Issue: Invalid framework folder.<span style="color: #ff0000;">Description: The folder 'netstandard1.6' under 'lib' is not recognized as a valid framework name or a supported culture identifier.Solution: Rename it to a valid framework name.</span>##[section]Finishing: NuGet Packager
After then The .Net Standard had displayed as the Unsupported framework on my package. Hence, my package was not able to publish to Nuget.org as it is not allowed an Unsupported framework to be deployed.
Furthermore, if open the nuspec file with Nuget explorer the frameworks is displaying properly.
Here is the configuration of my nuspec file.
123456789101112131415161718 <dependencies><group targetFramework=".NETFramework4.6.0"/><group targetFramework=".NETStandard1.6"><dependency id="NETStandard.Library" version="1.6.1" /><dependency id="System.Data.Common" version="4.3.0"/><dependency id="Microsoft.CSharp" version="4.3.0" /><dependency id="System.ComponentModel" version="4.3.0" /></group></dependencies><references></references><tags>Framework Adapters Extensions</tags></metadata><files><file src="HBD.Framework\bin\Release\HBD.Framework*" target="lib\net460" /><file src="HBD.Framework.St\bin\Release\netstandard1.6\HBD.Framework*" target="lib\netstandard1.6" /></files>
3. The solution
After spending a lot of times on this issue, I realized that the problem is the version of default Nuget.exe file in Nuget Packager is old (3.x), and it is not supporting the .Net Standard.
So, to fix this issue, I downloaded the latest version of Nuget.exe here and replaced the default version of Nuget packager by the following configuration of the build definition on VSTS.
- Put the Nuget.exe file in the Shared location on VSTS.
- Map the Shared location to the Build Definition.
- Replace the Nuget.exe of Nuget Packager with the version in Shared location.
Then execute a new build and re-deploy the package to Nuget.org again, here is the result.
- Hopefully the issue of the Nuget Packager will be fixed soon. However, ai this time if you are facing the same problem then just apply this as the work around solution for your build.
- VSTS online is free tool. Register here if you want to learn about the auto build, auto deployment.
You can download the latest source code of HBD.Framework here.