How to determine valid NuGet package version combinations for NanoFramework - .net-core

I am building a .NET NanoFramework demo using the ESP32_VROOM_32 board. I'm having trouble figuring our the correct combination of NuGet packages to avoid getting an assembly mismatch error when I try to debug my solution on the actual hardware. This error I keep getting when I push to the device is:
[Found assemblies mismatches when checking for deployment pre-check.]
The combination of packages I currently have installed are:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AMQPNetLite.nanoFramework" version="2.3.0.39" targetFramework="netnanoframework10" />
<package id="nanoFramework.CoreLibrary" version="1.7.3-preview.4" targetFramework="netnanoframework10" />
<package id="nanoFramework.Hardware.Esp32" version="1.2.1-preview.12" targetFramework="netnanoframework10" />
<package id="nanoFramework.ResourceManager" version="1.0.0-preview.15" targetFramework="netnanoframework10" />
<package id="nanoFramework.Runtime.Events" version="1.4.2-preview.8" targetFramework="netnanoframework10" />
<package id="nanoFramework.Runtime.Native" version="1.4.0-preview.1" targetFramework="netnanoframework10" />
<package id="nanoFramework.System.Collections" version="1.0.1-preview.7" targetFramework="netnanoframework10" />
<package id="nanoFramework.System.Math" version="1.2.0-preview.16" targetFramework="netnanoframework10" />
<package id="nanoFramework.System.Net" version="1.4.1-preview.21" targetFramework="netnanoframework10" />
<package id="nanoFramework.System.Text" version="1.0.0-preview.22" targetFramework="netnanoframework10" />
</packages>
My question is, is there a reliable systematic way to determine which combination of NuGet packages will work together with the firmware installed on the device?
I have tried many different combinations and can't get anything to work.
Currently, I have 1.4.0-preview.208 firmware installed on the ESP32, which appears to be the latest stable version.

There is no direct relation between the versioning of the C# libraries and the native firmware implementation. That's because each part has it's own separate development cycle.
The declaration is on which native version it requires. From managed to native, not the other way around.
This is showned on the NuGet description. If you want to learn more about this, take a look at this blog post here.
In the meantime know that stable releases have been published for all class libraries and firmware. The links for the firmware images have been updated.

Each NuGet package has a declaration on which other packages it depends on and which version. There is no other way to determine a valid package combination.
The fw version you have loaded it's not a stable version, therefore the "preview" in the version. But neither are the NuGets. Which is all OK: if you are using the "preview" firmware you have to use the "preview" NuGets.
Can you post here the error message about the version mismatch that you get? This will help determine what is wrong there.

Related

Can't install NuGet package Serilog.Sinks.*

I am facing a problem to install packages of Serilog.Sinks in an old project, e.g. when I try installing Serilog.Sinks.MSSqlServer I get the following error:
An error occurred while retrieving package metadata for Serilog.2.6.0
I have already installed package Serilog.2.6.0 and the process went fine, I tried running the code that uses this library and it works okay, but in case I try to uninstall this package I get the error:
Object reference not set to an instance of an object
Thus, I think that something might be wrong with Serilog.2.6.0 in my machine, since I cannot uninstall it or install any of its sinks, but I can't figure out the problem.
Details:
Visual Studio 2015
.NET Framework 4.5 Web Forms
Hi this worked for me nugget install Serilog.Sinks
If you can't uninstall your nuget via package manager console or with Nuget Package Manager, you still have the option to uninstall it. Open your package.config file.
Looks like this:
<packages>
<package id="Respond" version="1.2.0" targetFramework="net461" />
<package id="Serilog" version="2.6.0" targetFramework="net461" />
<package id="WebGrease" version="1.5.2" targetFramework="net461" />
</packages>
There you will find the id of Serilog your dependency with the version associated. Remove that line. And then unload your project, edit it, there you will find the HintPath of Serilog:
Looks like this:
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.6.0\lib\net46\Serilog.dll</HintPath>
<Private>True</Private>
</Reference>
Then the package Serilog could be uninstalled complete by manually.
Besides, if you re-install that package still get the same error after uninstall it, this issue should be more related to the NuGet rather than the package Serilog.
In this case, please try to uninstall the NuGet Package Manager for Visual Studio 2015 from Tools->Extensions and Updates, restart Visual Studio. Then install the latest version NuGet:
https://dist.nuget.org/visualstudio-2015-vsix/latest/NuGet.Tools.vsix
After the installation is completed, Reopen the Visual Studio in Administrator mode (right-clicked Visual Studio and started in Administrator mode), try to install that package again, check if it works fine.
The thing that worked for this case, from those I tried, is copying the references (.dll files) from another project where they're working fine. Thank you for your answers! :)
It works fine with me with the following package.config setting:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Serilog" version="2.6.0" targetFramework="net461" />
<package id="Serilog.Exceptions" version="4.1.0" targetFramework="net461" />
<package id="Serilog.Sinks.File" version="3.2.0" targetFramework="net461" />
</packages>

Extension method IsNullOrWhiteSpace with the same namespace is placed in two assemblies

I have ASP.Net MVC project. The project contains WebGrease, packages.config:
<package id="WebGrease" version="1.5.2" targetFramework="net462" />
Recently because of (https://www.nuget.org/packages/BundleTransformer.MicrosoftAjax/) I added AjaxMin into my packages.config:
<package id="AjaxMin" version="5.14.5506.26202" targetFramework="net461" />
In my code, I am using IsNullOrWhiteSpace() extension method. The method actually exists in these two libraries:
Visual Studio cannot decided which one has to be used.
I cannot remove the reference to WebGrease, because if I do so, I have the following exception:
How can I solve the conflict?
Thank you
You can use string.IsNullOrWhitespace() directly.

Change "Referencee" $(PackageVersion) During DNCore Pack

I am trying to use MSBuild to automatically update package versions based on the branch name. This works for the project itself, but referenced projects (that use the same MSBuild targets) use the default version - meaning that my targets are not running. For example, assume I have the following projects:
ConsoleApp1
ProjectReference: ClassLibrary1
ClassLibrary1
When building the above, I get the following nuspec/nugets:
ConsoleApp1 version 0.0.2-beta00001
dependency id="ClassLibrary1" version="1.0.0"
ClassLibrary version 0.0.2-beta00001
Note that the PackageVersion that is being pulled through is the default for the ProjectReference, while the project itself is building with the discovered package version.
I've tried changing GetTargetPathDependsOn as well as BeforeTargets="GetTargetPath;GetProjectsReferencingProjectJson" (after poking around in the Nuget Pack MSBuild), but they don't seem to be having an effect.
<PropertyGroup>
<BuildDependsOn>
OverridePackageVersion;
$(BuildDependsOn);
</BuildDependsOn>
<GetTargetPathDependsOn>
OverridePackageVersion;
$(GetTargetPathDependsOn);
</GetTargetPathDependsOn>
</PropertyGroup>
<Target Name="OverridePackageVersion"
BeforeTargets="GetTargetPath;GetProjectsReferencingProjectJson"
DependsOnTargets="GetDefaultVersion">
<CreateProperty
Value=""
Condition="'$(AutoPackagePreName)'=='$(ReleaseBranchName)'">
<Output TaskParameter="Value" PropertyName="AutoPackagePreName" />
</CreateProperty>
<CreateProperty
Value="$([System.String]::Format( $(AutoPackagePreNumberFormat), $([MSBuild]::Add($(AutoPackagePreNumber), 0)) ))">
<Output TaskParameter="Value" PropertyName="AutoPackagePreNumber" />
</CreateProperty>
<!-- Final Override -->
<CreateProperty
Value="$(AutoPackageVersion)"
Condition="'$(AutoPackagePreName)'==''">
<Output TaskParameter="Value" PropertyName="PackageVersion" />
</CreateProperty>
<CreateProperty
Value="$(AutoPackageVersion)-$(AutoPackagePreName)$(AutoPackagePreNumber)"
Condition="'$(AutoPackagePreName)'!=''">
<Output TaskParameter="Value" PropertyName="PackageVersion" />
</CreateProperty>
<CreateProperty
Value="$(PackageVersion)"
Condition="'$(UpdateVersion)'=='true'">
<Output TaskParameter="Value" PropertyName="Version" />
</CreateProperty>
<Message Importance="High" Text="Selected package version $(PackageVersion)." />
</Target>
Is this at all possible, or am I going to have to use Powershell in my CI?
The full source is available.
The targets you'd need to run before for the recent NuGet and .NET Core 2.* SDK versions are CollectPackageReferences;PrepareForBuild. To get it working in older versions, I used Restore;_GenerateRestoreProjectSpec in addition but these should no longer be necessary on recent tooling. See my Directory.Builds.targets i'm using to create a public NuGet package.
At the moment, dependency package versions are locked down during restore time and read from the obj\project.assets.json file, this is why the restore-specific targets are used. Note that restore doesn't import props/targets files from NuGet packages so you currently cannot consume versioning logic via a NuGet package containing build assets that work for project-to-project references. See the GitHub issue for it - the plan seems to be to move from reading the assets file to re-evaluating the versions from referenced projects instead of locking them down during restore.

wix: can not see in add remove program after installing msi

IN wix project, i do not use ARPNOREMOVE property to forbid product from adding the interface to add/remove programs, but i cannot see in add remove programs.
any one who can give me some suggestions? any suggestions i will appreciate.
My Product.wxs like below
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="ARPSYSTEMCOMPONENT" Value="1"/>

How do I connect to SQLite with Simple.Data.SQLite

I wrote this code in Webmatrix 2.0 beta:
string Dbfile=HttpContext.Current.Server.MapPath("data/db.db3");
var Db = Simple.Data.Database.OpenFile(Dbfile);
Simple.Data.SimpleDataException: No ADO Provider found.
why??
I'm sure that I have included the reference:
packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Simple.Data.Ado" version="0.16.1.0" />
<package id="Simple.Data.Core" version="0.16.1.0" />
<package id="Simple.Data.Sqlite" version="0.16.0.0" />
<package id="System.Data.SQLite" version="1.0.80.0" />
</packages>
In my test application conn is the physical path including the the db filename and calling
cn = Database.OpenConnection(conn);
works for me. When I used OpenFile I also received the No ADO Provider error.
I am using (from NuGet):
Simple.Data.Core 0.16.1.0
Simple.Data.Ado 0.16.1.0
System.Data.SQLite 1.0.80.0
Simple.Data.Sqlite 0.16.0.0
System.Data.SQLite 1.0.80.0
Getting the dlls required for the System.Data.SQlite can be hassle. If you want to do it quickly then download the Nuget extension for VS 2010. Then you can get the dlls from the extensions console.
Make sure you read the extension installations instructions.

Resources