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.
Related
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.
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>
I am having a problem with a project with Web API.
Inside of the global.asax file I have this and it is giving an error that says
An exception of type 'System.TypeLoadException' occurred in System.Web.Http.WebHost.dll but was not handled in user code
Additional information: Inheritance security rules violated while overriding member: 'System.Web.Http.WebHost.Routing.HostedHttpRoute.get_RouteTemplate()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
On this line
RouteTable.Routes.MapHttpRoute(name:="DefaultApi", routeTemplate:="api/{controller}/{id}", defaults:=New With { _
Key .id = RouteParameter.[Optional] _
})
I upgraded some packages. This used to be my packages.config file
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
They are now upgraded to this:
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net45" />
Any idea why I just started getting this error after upgrading?
Thank you very much!
I have project A that references project B.
In project B there are controllers and there I am calling RouteTable.Routes.MapHttpRoute for these controllers.
I have found in my case that problem was that in project A WebApi NuGet package version was higher than in referenced project B.
I'm trying to follow the azure DocumentDb quick start project. The app I will be developing will be in WPF rather than the console, so to ramp up on documentdb I created a new wpf project (.Net 4.5.1) but I get the following error:
'Microsoft.Azure.Documents.Client.DocumentClient' does not contain a definition for 'CreateDatabaseQuery' and no extension method 'CreateDatabaseQuery' accepting a first argument of type 'Microsoft.Azure.Documents.Client.DocumentClient' could be found (are you missing a using directive or an assembly reference?)
I used the following command to install the azure documentdb client:
Install-Package Microsoft.Azure.Documents.Client -Pre
This is the code that is giving me the issue (lifted straight from the quick start tutorial):
DocumentClient client = new DocumentClient(new Uri("endpoint"), "authKey");
var db = client.CreateDatabaseQuery()
.Where(d => d.Id == databaseId)
.AsEnumerable()
.FirstOrDefault();
This is the contents of my Nuget Packages.config file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Documents.Client" version="0.9.1-preview" targetFramework="net451" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" />
</packages>
Anybody any ideas what I'm missing? I'm using Visual Studio 2013 Premium Update 4
I believe you are missing the using directive for the DocumentDB Linq provider (Microsoft.Azure.Documents.Linq). Please make sure you have the following directives to the top of your .cs file:
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
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.