NRefactory has missing dlls - c#

Heys all, I've tried to use NRefactory(Vb) https://github.com/icsharpcode/NRefactory/ but it didn't come with mono.cecil.dll so i downloaded that too, but when i merged it together the versions seem
to be off (i had error Mono.Collections missing class)
does anyone seem to be able to get NRefactory working?
Edit:
btw i've changed to Mono.Cecil 0.9.4. However when i try to build ICSharpCode.NRefactory i had some errors:
Error 6 'Mono.Cecil.PInvokeInfo' does not contain a definition for
'IsBestFitDisabled' and no extension
method 'IsBestFitDisabled' accepting a
first argument of type
'Mono.Cecil.PInvokeInfo' could be
found (are you missing a using
directive or an assembly
reference?) C:\Users\Joseph\Desktop\Test\NRefactory\ICSharpCode.NRefactory\TypeSystem\CecilLoader.cs 376 14 ICSharpCode.NRefactory
post)

In the new Version the Method IsBestFitDisabled now is called: IsBestFistDisabled
The got an extra "s" inside... :)

Did you make sure to get Mono.Cecil 0.9.4 as mentioned on the GitHub page?
It has a different API than the previous Mono.Cecil 0.6.9.

Related

How to fix : 'IDataProtectionBuilder' does not contain a definition for 'PersistKeysToDbContext' and no accessible extension

I am attempting to persist Keys to SQL using the PersistKeysToDbContext extension from services.AddDataProtection(). At the moment we are using PersistKeysToStackExchangeRedis which works really well, however a need was identitied to move it to DB instead.
We are using a .net Core 2.2 project having added the following references:
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (2.2.0)
Microsoft.AspNetCore.DataProtection.Extensions (2.2.0)
Microsoft.AspNetCore.DataProtection.StackExchangeRedis (2.2.0) (obviously for current functionality)
Microsoft.EntityFrameworkCore (2.2.0)
services.AddDataProtection().PersistKeysToDbContext<ApplicationDbContext>();
I get the following error from the compiler:
'IDataProtectionBuilder' does not contain a definition for 'PersistKeysToDbContext' and no accessible extension method 'PersistKeysToDbContext' accepting a first argument of type 'IDataProtectionBuilder' could be found (are you missing a using directive or an assembly reference?)
1) Make sure you have Microsoft.AspNetCore.DataProtection.Extensions + Microsoft.AspNetCore.DataProtection.EntityFrameworkCore installed (as references).
2) Add using Microsoft.AspNetCore.DataProtection; to Startup.cs (or wherever you have the problem).
I've tested and it works, so if it still doesn't work, you probably need to make sure you haven't missed anything.

c# Wrapper for CNTK step 2

This is a follow-up question from "c# Wrapper for CNTK step"
After adding reference EvalWrapper.dll, The type or namespace name 'IEvaluateModelManagedF' could not be found error went away.
The next compile error I encounter is at line
model.CreateNetwork(string.Format("deviceId=-1\nmodelPath=\"{0}\"", modelFilePath));
Error CS1061 'IEvaluateModelManagedF' does not contain a definition for 'CreateNetwork' and no extension method 'CreateNetwork' accepting a first argument of type 'IEvaluateModelManagedF' could be found (are you missing a using directive or an assembly reference?)
I made sure all the DLLs are in the same directory as EvalWrapper.dll.
What am I missing ?
Thanks in advance,
I encountered this error too. To solve the problem you should add the following using clause at the beginning of your code:
using Microsoft.MSR.CNTK.Extensibility.Managed;

Unknown namespace during build (but intellisense knows it)

I am currently working on a project with SignalR. On my production server, it is missing an automatically generated js-file in ~/signalr/hubs.
I wanted to try this solution:
SignalR not working on production server
But when I try to add this line to my application_start method in global.asax, my project will not build anymore. Although intellisense knows and suggests the extension method!
I referenced the namespace with using SignalR;. I tried calling it as an extension method and calling it as a static method with the object instance as the first parameter.
The exact error messages:
When calling as extension method:
Error 1 'System.Web.Routing.RouteCollection' does not contain a definition for 'MapHubs' and no extension method 'MapHubs' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)
When calling as static method:
Error 1 The type or namespace name 'RouteExtensions' does not exist in the namespace 'SignalR' (are you missing an assembly reference?)
Anybody knows why this happens and how to solve the problem? Many thanks in advance!
I'm pretty sure that it could be one of these reasons:
Your project requires a reference to an assembly that's not added to the project.
Is your project using the .NET Framework version that's compatible with the referenced assembly?
With your given info, it would be hard to determine the exact reason, but I believe that I provided you some helpful hints.
The fact that intellisense suggests you anything like an extension method won't mean that the project has the required references to work properly.

Castle Windsor's DictionaryAdapter

I'm trying to upgrade one of our applications from Castle Windsor 2.1 to 2.5.
I've removed all of the Castle DLL's, and added the 2.5 version as downloaded from Castle's website:
Castle.Core.dll
Castle.Windsor.dll
Before doing the migration, I also had a reference on my project to:
Castle.Components.DictionaryAdapter.dll
However, according to Krzysztof Koźmic's post here, such reference is no longer necessary, since the DictionaryAdapter now comes bundled into Castle.Core.dll.
Upon removing it, I get errors all over the place saying:
Error 6 The type or namespace name 'DictionaryComponent' could not be
found (are you missing a using directive or an assembly
reference?)
and
Error 64 The type or namespace name 'DictionaryKey' could not be found
(are you missing a using directive or an assembly reference?)
and
Error 27 The type or namespace name 'DictionaryKeyAttribute' could not
be found (are you missing a using directive or an assembly reference?)
I then thought I'd add a reference to Castle.Components.DictionaryAdapter.dll, as it could be that CORE didn't have the types listed above implemented in it.
Doing that got rid of all the errors, but gave me a new one:
Error 8 The type 'Castle.Components.DictionaryAdapter.DictionaryAdapterFactory' exists in both 'd:.NET\app\libs\Castle.Core.dll' and 'd:.Net\app\libs\Castle.Components.DictionaryAdapter.dll'
The error happens on the following method implementation:
internal static ISettingService GetServiceFromAdapterFactory(NameValueCollection collection)
{
var adapter = new DictionaryAdapterFactory();
return adapter.GetAdapter<ISettingService>(collection);
}
Has anyone faced such problem when upgrading from 2.1 to 2.5 and could offer me some advice?
Thanks in advance.
To answer my own question here, this is what I had to change in my code.
Changed all the DictionaryKey to become KeyAttribute
Changed all the DictionaryComponent to become ComponentAttribute
Used Kernel.Register instead of Kernel.AddComponent
And obviously removed all the 2.1 DLL's and added the 2.5. You will notice that the DictionaryAdapter.dll has been removed, as it's now bundled within Castle.Core.dll
Hope that helps someone in the future.

Umbraco 5 - type or namespace 'AssemblyContainsPlugins' could not be found

I'm trying to create plugins for Umbraco 5. I see in all examples mention of the following line to AssemblyInfo.cs, in order to mark an assembly for export:
[assembly: AssemblyContainsPlugins]
Trouble I'm having is I receive the 'type or namespace' error for AssemblyContainsPlugins and AssemblyContainsPluginsAttribute. I tried googling the names to see what assembly I'm not referencing but can't find it.
Can anyone see what I've missed here?
Yes, you missed this using statement:
using Umbraco.Cms.Web;

Categories