I am having the following error when adding any custom field or overriding any attribute on existing fields on Marketing Campaign screen:
\App_RuntimeCode\PX_Objects_CR_CRCampaign_extensions.cs(1): error CS0246: The type or namespace name 'AP' could not be found (are you missing a using directive or an assembly reference?)
Any idea on where to track this error?
This likely occurred because of using static directive or nested namespace.
For example, having AP.xyz nested in PX.Objects.AP produces no compiler error:
When AP.xyz is nested in another namespace it's not found:
The issue with using static directive is a bit different but results in the same error. This can occur because runtime code uses IIS for compilation and IIS compiler is not the latest dot net compiler. So using static directive can work when you compile a dynamic library extension in visual studio but can fail when it's compiled by IIS as part of a runtime customization.
The easy fix is to edit the files to either:
Fully qualify the identifiers by changing AP.xyz to PX.Objects.AP.xyz
Sometimes all that is required is to remove AP. and add using PX.Objects.AP at the top of the file if it's not there. When there's a conflict between 2 types with the same name in different namespace you must use method #1.
Related
I renamed my project, and updated it to .Net 5. Now, I obviously havent catched all the occurances since I get this error:
\source\repos\BlazorBattles\BlazorBattles\Server\obj\Debug\net5.0\Razor\Pages\Error.cshtml.g.cs(78,71): error CS0246: The type or namespace name 'blazor_battles' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\hagenek\source\repos\BlazorBattles\BlazorBattles\Server\BlazorBattles.Server.csproj]
However, it is hard to locate it, because the error shows a file that is being generated by the project ,not a file that is in the core project.
Any tips?
For some reason visual studio could not locate the string "blazor_battles" in the Error.cshtml file inside of Server/Pages directory.
Using hyphens in your project names creates problems. Don't do it.
i am trying to run a c# script inside the soundforge script editor but it is not supporting system.Linq.... here is the error enclosed.. any help in this regard is appreciated..thank you
Compiler error 0x80004005 on Line 23,14 : The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Seeing how SoundForge (up to 10) only requires .NET 2.0, it seems very plausible it runs script in the same environment. That version of .NET doesn't support LINQ, so that would imply you are out of luck.
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.
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.
I have CA1017 error message with StyleCop saying I need to make it ComVisible false.
Error 18 CA1017 : Microsoft.Design :
Because 'NationalInstruments.Labview.FPGA.ModelsimCommunicator.dll' exposes externally
visible types, mark it with ComVisible(false) at the assembly level and then mark all
types within the assembly that should be exposed to COM clients with ComVisible(true).
Then, I put the code [assembly: ComVisible(false)] before the topmost namespace. However, I still got the same error together with other error messages.
Error 19 The type or namespace name 'ComVisible' could not be found (are you
missing a using directive or an assembly reference?)
Error 20 The type or namespace name 'ComVisibleAttribute' could not be found (are
you missing a using directive or an assembly reference?)
It seems that VS2010 also doesn't recognize this name.
What's wrong with this?
The ComVisibleAttribute is defined in the System.Runtime.InteropServices namespace.
So you either need to:
Fully-qualify the attribute's name with its namespace:
[assembly: System.Runtime.InteropServices.ComVisible(false)]
Add a using directive to the top of your source file to import the namespace for that file:
using System.Runtime.InteropServices;
In the future, you should be able to get Visual Studio to warn you about these things. When you see a squiggly line denoting a compiler error, look for the drop-down button that's nearby or press Ctrl+. A menu should appear, indicating possible solutions for the problem. In this case, it would have suggested that you take either option 1 or 2 listed above, and with a single click, would have performed all of the necessary actions for you.
(The above amazing animated image was ripped from here.)