Сообщение об ошибке компилятора cs0234

Search code, repositories, users, issues, pull requests…

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

User-1330485181 posted

Hi All,

Summary of the problem I am having:

I am building ASP.NET C# Web form using Visual Studio 2019 with Target framework 4.72,  but I found error like this below

Error I am receiving:

<

Compilation Error

Description:
An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name ‘Linq’ does not exist in the namespace ‘System.Data’ (are you missing an assembly reference?)

Source Error:

Line 12: namespace WebApplication1.App_Code
Line 13: {
Line 14: 	using System.Data.Linq;
Line 15: 	using System.Data.Linq.Mapping;
Line 16: 	using System.Data;


Source File: D:\GL-Project\WebApplication1\WebApplication1\App_Code\DataClassesGL.designer.cs   
Line: 14

Show Detailed Compiler Output:

Show Complete Compilation Source:


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0
>

My code:

<

#pragma warning disable 1591
//——————————————————————————
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//——————————————————————————

namespace WebApplication1.App_Code
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Data;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;
using System;

public partial class DataClassesGLDataContext : System.Data.Linq.DataContext
{

private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();

#region Extensibility Method Definitions
partial void OnCreated();
#endregion

public DataClassesGLDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}

public DataClassesGLDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}

public DataClassesGLDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :

base(connection, mappingSource)
{
OnCreated();
}

public DataClassesGLDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :

base(connection, mappingSource)
{
OnCreated();
}
}
}
#pragma warning restore 1591

>

Does the LinqToSQL still be able to used on dot Net Framework 4.72 or higher ? 

Regards,

Sentoso

We’re working on a WPF project using Visual Studio 2015. We’ve got a folder in the project named Assets. It shows up fine in VS 2015. The files in it show up fine in the Solution Explorer. But when we build it, VS 2015 complains with the following error:

Error CS0234 The type or namespace name ‘Assets’ does not exist in
the namespace ‘CoreFramework’ (are you missing an assembly
reference?)

(CoreFramework is the name of our solution and the project that Assets is in.)

I don’t get how the folder is there in CoreFramework, but when building it, VS 2015 just doesn’t see it. I’ve tried cleaning both the project and the solution in VS 2015, but it doesn’t help at all. The same errors keep popping up. And they popup in our nightly builds as well.

So what is causing VS 2015 to simultaneously see a folder within a project and not see that same folder in the project?

StayOnTarget's user avatar

StayOnTarget

11.8k10 gold badges52 silver badges84 bronze badges

asked Feb 15, 2016 at 22:01

Rod's user avatar

17

In this case what I had to do was to delete everything in the obj folder beneath our project main folder. The solution’s name is CoreFramework and the main project’s name is also CoreFramework. So what I did was go to \CoreFramework\CoreFramework\obj and deleted everything there. Since at this point we’re only dealing with a debug version, the only thing there was the Debug folder and all temporary files and folders under that. Once I did that, then rebuilding the solution re-created all of the temporary files and folders, without the problem I was having with the Assets folder. It built fine.

YMMV

answered Feb 16, 2016 at 18:47

Rod's user avatar

RodRod

4,11712 gold badges57 silver badges82 bronze badges

Check the .Net-Framework Versions of both Projects. If the referenced project has a higher .Net-Framework Version than the referencing project this error might occur.

ProjectName -> Properties -> Application -> Target framework

answered Jun 25, 2021 at 12:44

Findas's user avatar

I had the same issue after I manually copied the referenced DLL file.
I solved it by displaying the reference properties in the Solution explorer then changing the Specific version setting from True to False and finally changing it back to True.
I rebuild and… it works just fine. Do not ask me why…

Note : I had to do the same for each project which had the CS0234 error message

PS : in my case Visual studio version is 16.1.6

answered Dec 30, 2019 at 13:25

leguminator's user avatar

  • Remove From My Forums
  • Question

  • Hello,

    I converted my VB.net project into a C# project using the SharpDevelop Team Vb.net to C# Converter extension in VS2017. As a result of the conversion, some errors were generated.

    There is this code on my LoginForm:-

    using System.Windows.Forms;
    using System;
    
    namespace mydatabase
    {
        public partial class LoginForm
        {
            private void Btnpassword_Click(object sender, EventArgs e)
            {
                if (txtUserName.Text == "mylogin" & txtpassword.Text == "mypassword")
                {
                    this.Visible = false;
                    mydatabase.My.MyProject.MyForms.Form1.Show();
                }
                else
                {
                    MessageBox.Show("You have entered an incorrect login details", "Try Again", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    txtpassword.Text = "";
                    txtUserName.Text = "";
                    txtUserName.Focus();
                }
            }

    An error occurs on the line: —

    mydatabase.My.MyProject.MyForms.Form1.Show();

    and error message is: —

    CS0234: The type or namespace name ‘MyProject’ does not exist in the namespace ‘mydatabase.mydatabase.My’ (are you missing an assembly
    reference?)

    Can you kindly assist me with this issue? Thanks

    • Edited by

      Wednesday, May 22, 2019 11:31 PM

Answers

  • It’s possible that the problems you are having in the other thread are preventing Form1 code from compiling, which might explain the error in this thread. That is, «‘Form1’ does not exist» because it won’t compile. So you might need to fix those
    other problems first.

    But there is one more thing to try. For some reason, the compiler is looking for Form1 in mydatabase.mydatabase, not just mydatabase. I’m not sure why it’s doing this, but you could try removing the qualification from the line with the error.

    Form1 frm = new Form1();
    frm.Show();

    That qualification shouldn’t be necessary anyway, because you have a ‘using’ statement at the top of the file for mydatabase.

    Edit: Drat. You don’t have a using statement. I wasn’t looking closely. But you are inside that namespace, which has (more or less) the same effect.

    • Edited by
      Ante Meridian
      Friday, May 24, 2019 3:53 AM
      Wasn’t paying attention.
    • Marked as answer by
      wirejp
      Friday, May 24, 2019 4:42 AM

23 / 10 / 1

Регистрация: 08.10.2015

Сообщений: 384

1

07.08.2018, 10:44. Показов 4778. Ответов 6


Студворк — интернет-сервис помощи студентам

Здравствуйте!
При добавлении строки кода:»using System.Text.RegularExpressions;», в проект, возникает ошибка:
CS0234 Тип или имя пространства имен «RegularExpressions» не существует в пространстве имен «System.Text» (возможно, отсутствует ссылка на сборку).
Подскажите, пожалуйста, как это исправить?



0



910 / 795 / 329

Регистрация: 08.02.2014

Сообщений: 2,391

07.08.2018, 11:03

2

1) Версия .net какая у Вас стоит?
2) System.dll подключена в проекте?



0



23 / 10 / 1

Регистрация: 08.10.2015

Сообщений: 384

07.08.2018, 11:14

 [ТС]

3

SeIZVeIZ,
1) VS 2015 4.5.2
2) Как её подключить?



0



910 / 795 / 329

Регистрация: 08.02.2014

Сообщений: 2,391

07.08.2018, 11:19

4

Лучший ответ Сообщение было отмечено HitGirl как решение

Решение

В Solution Explorer(Обозреватель решений), есть папка Reference(ссылки), нажимаете правой кнопкой -> Добавить -> Там Assemblies (не знаю как в русской локализации будет там может Сборки) -> и в списке выбираете System



1



0 / 0 / 0

Регистрация: 17.07.2021

Сообщений: 9

20.07.2021, 19:02

5

Нужно, чтобы работала команда using Systeam.Windows.Froms
Но нужно, как я понял подключать какие-то ссылки или сборки, пишут как это сделать и в конце выбирайте нужны файл, а какой нужен то??? и где его искать



0



Эксперт по электронике

2413 / 1651 / 490

Регистрация: 04.09.2018

Сообщений: 5,748

Записей в блоге: 3

20.07.2021, 19:09

6

Код покажите свой. Ошибка CS0234 может возникать и в случае синтаксической ошибки.



0



0 / 0 / 0

Регистрация: 17.07.2021

Сообщений: 9

20.07.2021, 19:42

7

Ошибkа — CS0234, что-то попытался добавить , теперь ошибка еще эта — MSB3290
мне нужно , чтобы работало using System.Windows.Forms, но как я понял сначала нужна ссылка на сборку (Где эту ссылку искать я не знаю)



0



Понравилась статья? Поделить с друзьями:
  • Сообщение об ошибке для сайта
  • Солярис плавают обороты на холостых ошибок нет
  • Сони вегас 13 выдает ошибку при запуске
  • Сообщение об ошибке windows form
  • Сони альфа 33 ошибка фотоаппарата