.NET Code setup in Visual studio 2010 - c#

I am new to .NET development and I am setting up a project in Visual studio 2010 with DevExpress 12.2.6 version.
When I build the project, I get this error:
Error 25 'DevExpress.XtraRichEdit.FieldOptions' does not contain a definition for 'UseCurrentCultureDateTimeFormat' and no extension method 'UseCurrentCultureDateTimeFormat' accepting a first argument of type 'DevExpress.XtraRichEdit.FieldOptions' could be found (are you missing a using directive or an assembly reference?) C:\Users\Development\Support\SecurityMasterMonitor\SuppWikiSearchProcessInfoForm.Designer.cs 145 50 SecurityMasterMonitor
I have added DevExpress.XtraRichEdit.dll in my project refernece as well. I am not sure what is missing here.. Can you please help me?

From DevExpress support forum concerning version 2012 vol 2.7 (i.e. 12.2.7)
The DevExpress.XtraRichEdit.FieldOptions.UseCurrentCultureDateTimeFormat property is implemented. It is accessible using RichEditControl.Options.Fields.UseCurrentCultureDateTimeFormat notation.
So, as you can see - you need either upgrade to 12.2.7 or don't use UseCurrentCultureDateTimeFormat in your code since it was implemented in version 12.2.7.

Related

IntelliSense complains about missing Microsoft.AspNetCore packages despite being there

In my Blazor application, on the client side, IntelliSense complains about a lot of Microsoft.AspNetCore packages although the project compiles and runs fine.
I get a lot of things like
The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)
The type or namespace name 'Razor' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)
...
Things like
#inject HttpClient Http
are also underlined with red squigglies.
The project builds and runs perfectly.
What is wrong here?
Followup 1
Because I was asked for all versions:
Visual Studio 2019, 16.0.2
Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview4-19216-03
In my project:
Id Versions ProjectName
-- -------- -----------
Microsoft.AspNetCore.Blazor.Build {3.0.0-preview4-19216-03} MyBlazorApp.Client
Microsoft.AspNetCore.Blazor {3.0.0-preview4-19216-03} MyBlazorApp.Client
NETStandard.Library {2.0.3} MyBlazorApp.Client
You need Visual Studio Preview version 16.1 or higher to work with 3.0.0-preview4 Blazor.
If that alone doesn't help, verify that you dont have any .cshtml files in your client project - they all have a .razor extension since 3.0.0-preview4. The presence of .cshtml file triggers a different SDK's behavior, requiring AspNetCore.Mvc namespace. Though Microsoft guys see it as a bug and probably will fix it.
https://github.com/aspnet/AspNetCore/issues/9640
Shut down VS
Delete the .vs folder or the .suo file
Restart VS
uninstalling x86 version of .NET Core 3.0 Preview SDK
https://dotnet.microsoft.com/download/dotnet-core/3.0
Then installing the x64 again on Windows10 64bit fixed that issue for me

ASP.NET MVC program fails to compile after most recent patch Tuesday

I am using MVC 5, C#, .NET 4.5.1 in Visual Studio 2013. Following a Microsoft/Windows Update yesterday (15 October 2014) my program refuses to compile with multiple errors of the two types below:
The type or namespace name 'Mvc' does not exist in the namespace 'System.Web'
The type or namespace name 'ControllerContext' could not be found (are you missing a using directive or an assembly reference?)
I have tried this on a different computer (also with the patches) and had the same errors. The program in question is in production and compiled perfectly before the changes.
Before I start uninstalling and restoring the different patches, has anyone else seen this problem and is a solution/workaround known.
I got the same error yesterday. I assumed it was something I had done. One of the projects in our solution had a reference to System.Web.Mvc 4.0.0.0 and it could no longer find it. I updated that project using NuGet to System.Web.Mvc 5.2.0.0 (which is what all the other projects in the solution were using anyway) and all was well.

Microsoft.Bcl package using CallerMemberName fails to build within Teamcity

I have taken over a project that is targeting .net4.
One of the projects within the solution is using System.Runtime.CompilerServices.CallerMemberNameAttribute from the System.Runtime.dll that is installed when you are using the Microsoft BCL Portability Pack.
I have checked and the project is currently using version 1.1.3.
When the solution is build on local dev machines, everything compliles with no problems.
I am now trying to get the solution built in teamcity, but when TeamCity attempts to compile the solution I am getting this error.
error CS0246: The type or namespace name 'CallerMemberName' could not be found (are you missing a using directive or an assembly reference?)
error CS0433: The type 'System.Runtime.CompilerServices.CallerMemberNameAttribute' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll' and 'c:\apps\teamcity\buildAgent\work\bb8aacaa9fabeac8\packages\Microsoft.Bcl.1.1.3\lib\net40\System.Runtime.dll'
I have read Jon Skeets answer to this question: Using CallerMemberName attribute in a portable library But I am already using the BCL library.
After spending some time on this, I found another question answered by Jon Skeet that resolved this issue.
When must we use extern alias keyword in C#?
Within my project, after getting the links to the Package, for each dll I had to change the name of the alias. ie from global to newglobal
Then in the classes that where using the CallerMemberName, had to do the following
At the top of the page, above the using statements
extern alias newglobal;
And then when referencing CallerMemberName, enter the code as
[newglobal::System.Runtime.CompilerServices.CallerMemberName]
This allows the code to be successfully built on teamcity where .net 4.5 has been installed.

c# namespace name cannot be found

I am trying to make an asynchronous client for Windows Phone using this code http://msdn.microsoft.com/en-us/library/bew39x2a.aspx in Visual Studio 2010 but I get 22 errors for using things like IPHostEntry and BeginConnect although I copied the code exactly. Any ideas?
Thanks
Edit
The three different types of errors I'm getting are below. most of them are the third one with sockets.socket
Error 1 The type or namespace name 'IPHostEntry' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The name 'Dns' does not exist in the current context
Error 3 System.Net.Sockets.Socket' does not contain a definition for 'BeginConnect' and no extension method 'BeginConnect' accepting a first argument of type 'System.Net.Sockets.Socket' could be found (are you missing a using directive or an assembly reference?)
You may be missing a reference. Verify that the appropriate DLLs have been identified as project references.
You should check to see if your project is using the correct version of .Net. In .net 4.0 there is both a "client" and "full" version. Typically when you create a new .Net project in Visual Studio the project is created and referencing the "client profile" .net. Honestly, this gets me every time.
You can change this by doing the following (Visual Studio 2010):
Right click the project in Visual Studio Solution Explorer and select "Properties"
Make sure the "Application" tab is selected
View / Change the "Target Framework:" from ".NET Framework _ Client Profile" to ".NET Framework _"
rebuild your project :-)
Here's a good link explaining the difference between the client profile and the full profile: Differences between Microsoft .NET 4.0 full Framework and Client Profile
The code is missing a namespace before it is declaring classes.
namespace YourNamespace
{
// State object for receiving data from remote device.
public class StateObject { ...
Also you may be missing namespaces for stuff the code is using. Click on the classes that are highlighted with red squigglies and press ctrl + . and it should give suggestions for namespaces.
I encountered the same issue today. I think it's because VS2010 Express WP created my project using 2.0 .NET framework, I don't know why, I want to use 7.8, but I have only choice between 7.0 and 7.1. I can't change .Net framework version for use the 4.0/4.5, I have only one choice and it's windows phone 7.1, I can't choose the version of the framework separately...

nettiers data class library not recognized

I needed to make a console application using nettiers class libraries. I created a new Console Application project, added references to all the libraries from NetTiers and created an app.config file with all the necessary configurations. I get intellisense and no errors and everything when I am doing the coding, but when I go to compile the application, I'm getting an error that PPGEDI.Data doesn't exist.
I only have 1 line in the program.cs Main method:
PPGEDI.Entities.VansEntity van
= DataRepository.VansEntityProvider.GetById(16);
I'm getting the following error:
Error 93
The type or namespace name 'Data'
does not exist in the namespace 'PPGEDI'
(are you missing an assembly reference?)
It's frustrating, because I know I've added the assembly reference:
I'm using Visual Studio 2010, with C# and .NET 4.0. Can anyone give me an idea as to what I need to do to get this to work.
As a note, this works if I use the same statement in a method on an ASPX page in the web application generated by nettiers.
#BrokenGlass, you were absolutely correct. I double checked and it was
set to ".NET Framework Client Profile", I changed it to .NET 4 and
it's working now, can you put that as an answer?
You are using the .NET client profile in your console app which is a "minified" version that doesn’t contain all assemblies.
The problem is that when your app adds a reference to a class library that is targeting the full framework, references to the "full" framework assembly will not resolve. This results in the rather non-forthcoming error message that you see. Switching to the the full .NET 4 as target framework will resolve the issue.
For a more in depth overview of the problem and the .NET 4 Client Profile in general also see "What’s new in .NET Framework 4 Client Profile RTM"

Categories