情况是这样的。我在Visual中创建一个新的类库项目,添加一些类。然后,在某个时候,我决定需要用System.Runtime.Serialization.DataContractAttribute标记某个类,并编写如下代码:
[DataContract]
public class MyDataContractClass {}
当我点击编译时,我会看到以下错误:
error CS0246:无法找到类型或命名空间名称'DataMember‘(您是缺少一个使用指令还是程序集引用?)
好的,问题是我忘记添加using指令来使类可见。我补充说
using System.Runtime.Ser
我正在运行Visual 2015和Windows8.1。我正在为一个控制台应用程序项目而挣扎。
该解决方案在Visual 2015中运行良好,但是当我尝试用mcs编译器编译它时,我会得到两个错误(Kattis代码测试使用)。找不到两个外部类。
我得到了以下错误:
Program.cs(28,13):错误CS0246:无法找到类型或名称空间名称Graph' could not be found. Are you missing an assembly reference? Program.cs(58,34): error CS0246: The type or namespac
我正在尝试使用CICD从多项目.net解决方案构建单个cs项目,但在MSBuild中给出了错误。我正在使用boilerplate。下面是我的流水线的步骤:
在构建过程中,我得到了一些程序集引用错误,比如
Error CS0246: The type or namespace name 'Abp' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246: The type or namespace name 'FullAudi
我试着制作一个弹药计数系统,里面有子弹的图像,当人物发射子弹时,子弹就消失了。我在跟踪
这似乎没问题,但现在我看到了这个错误:
资产\脚本\ GameFlow.cs (72,28):错误CS0246:无法找到类型或名称空间名称‘映像’(您是缺少指令还是程序集引用?)
我看不出这个问题。我想我可以通过添加"using UnityEngine.UI;“来解决问题,但问题依然存在。有人知道我怎么解决的吗?谢谢。
脚本中的代码是:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
我们在本地使用ADO 2019,我们有一个构建服务器,我们在其中构建一切。我有一个ASPNet网页,开发人员已经添加了第二个项目到SLN测试。
我得到了以下错误
XYZ.Tests\Properties\PexAssemblyInfo.cs(15,12): Error CS0246: The type or namespace name 'PexAssemblySettingsAttribute' could not be found (are you missing a using directive or an assembly reference?)
XYZ.Tests\
我按照回购中的指示添加了google核心包,并根据文档添加了代码。
我收到以下错误:CS0246: The type or namespace name 'PlayAsyncOperation<,>' could not be found (are you missing a using directive or an assembly reference?)
此错误显示在_reviewManager.RequestReviewFlow();和_reviewManager.LaunchReviewFlow(_playReviewInfo)上。
知道会有什么问题吗?
我正在尝试在C#程序的顶部定义一对类型别名。这是我想要做的一个简短的例子:
using System;
using System.Collections.Generic;
namespace Foo {
using TsvEntry = Dictionary<string, string>;
using Tsv = List<TsvEntry>;
}
当我尝试使用mcs 3.2.8.0编译它时,我得到以下错误消息:
foo.cs(6,19): error CS0246: The type or namespace name `TsvEntry'
我是Linux、dotnet和postgres的新手。我正试图在C#中为数据库连接编写代码。但我错了
“无法找到类型或命名空间名称‘CS0246’(您是缺少使用指令还是程序集引用)。”
我使用的是ubuntu 14.04 64位,dnxcore版本5.0,postgresql,npgsql 3.1.0-alpha6 6。我在project.jason中将依赖项定义为"Npgsql":“3.1.0-alpha 6”。我的代码是,
using System;
using npgsql;
namespace testdbconn
{
public class tstdb
所以我在第8行乱搞我的代码
public GameObject GetEnemyPrefab()
{
return enemyPrefab;
}
我想做的只是调用Prefab的sprite呈现器,我得到这个错误“缺少一个使用指令或程序集引用”。
我在想,我如何才能只调用精灵渲染器,以及是否有人能向我解释“缺少指令或程序集”。比如指令和装配意味着什么?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Ene
我为我的xamarin应用程序尝试了这个,使用了这个代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace XamarinLogin.Controllers
{
public class ControllerNameController : ApiController
{
// GET: api/ControllerName
在这个 on ASP.NET核心web应用程序之后,我得到了以下错误:
The type or namespace name 'EFGetStarted.AspNetCore.NewDb' could not be found (are you missing a using directive or an assembly reference?)
备注:EFGetStarted.AspNetCore.NewDb是项目的名称,它显示在intellisense中,但.Models.Blog部件没有出现在intellisense中。
视图的一部分如下所示。整个视图可以在上面的链接中
我正在尝试创建一个web应用程序来读取所有的windows事件日志和显示到网页中。我尝试在asp.net MVC5中运行它,但当我尝试在asp.net MVC6应用程序中执行它时,它显示错误。
控制器
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplication1.Models;
using WebApplication1.Models.Paginat
我在TransactionScope()和datacontext上得到一个错误,如下所示。
找不到类型或命名空间名称“TransactioScope”(是否缺少using指令或程序集引用?)
找不到类型或命名空间名称“HRPaidTimeOffDataContext”(是否缺少using指令或程序集引用?)
在下面的代码中,我必须做些什么来解决这个问题。
using ( TransactioScope ts = new TransactionScope())
{
// Create the data context
using
Where扩展方法必须包含的程序集的名称是什么?我在谷歌上找不到它的名字,显然它不是其中之一:
using System;
using System.Collections.Specialized;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
非常基本的问题--但我找不到答案。我有一个asp.net web服务,它位于一个asmx文件中。这应该从助手库中调用一个函数。在Visual中使用不同的asmx文件,一切正常--我只需将程序集添加到该项目的依赖项中即可。
虽然我已经将程序集复制到了webserver上的bin子目录(我认为这就是我所读到的描述),但它返回了以下错误消息:
“/”应用程序CS0246中的“CS0246服务器错误:无法找到类型或命名空间名称XXXFunctions' could not be found. Are you missing a using directive or an assembl
我试图查看在模型中循环的非常基本的代码。但是,每次我运行VS代码控制台应用程序时,我都会得到这个错误。
无法找到类型或命名空间名称'List<>‘(您是缺少使用指令还是程序集引用?)
构建失败了。修复构建错误并再次运行。
我使用以下命令运行该应用程序
dotnet run // to reun console application
密码怎么了!!
using System;
class Program
{
static void Main(string[] args)
{
List<int> list
嗨,我正在尝试创建一个azure定时器触发器c#函数,它每5分钟执行一次(只是为了测试-将更改为每天),以更新SQL数据库列。以下是我在TimerTriggerCSharp1函数应用程序中的代码
using System;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using Microsoft.SqlServer.Server;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C
我愚蠢地决定在周五的工作中尝试一些新的东西!
因此,我使用NuGet将Ninject.Web.Mvc 2.2.x.x添加到我的.Net MVC2项目中。
我修改了我的Global.asax.cs
using System.Web.Mvc;
using System.Web.Routing;
using IntegraRecipients;
using Mailer;
using Ninject;
using Ninject.Web.Mvc;
using Ninject.Modules;
namespace WebMailer
{
public class MvcApplication :
我试图通过使用另一个类型别名来定义类型别名,如下所示:
using pairs = Dictionary<string, int>;
using allPairs = Dictionary<string, pairs>;
并得到以下错误消息:
error CS0246: The type or namespace name 'pairs' could not be found (are you missing a using directive or an assembly reference?
为什么这是一个错误,并有一个解决办法?
List<Story>中有一个错误
无法找到类型或命名空间名称'List<>‘(您是缺少使用指令还是程序集引用?)(CS0246)项目
using System;
using project.Models;
namespace project.Models
{
public class Genre
{
public int GenreId { get; set; }
public string Name { get; set; }
public List<Story> Sto
我尝试了以下几点:
using System;
using Newtonsoft.Json
using Newtonsoft.Linq
public static void Run(string myEventHubMessage, out string document, TraceWriter log)
{
log.Verbose($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
dynamic jsonData = JObject.Parse(myEve
我可以在本地构建我的分支,没有任何问题,但是当我试图通过团队基础构建时,我会得到两个错误。这些错误是在我最近添加到解决方案中的一个项目上生成的。
这些错误是:
EnvoyClient.cs(3,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [c:\TF-Agents\Agent2017-002\_work\2\s\System\Envoy.Conne
我试图实现的是从我生成的c#类动态生成一个项目。该类的内容类似于代码的内容--实体framework.The内容的第一代码生成如下所示:
namespace ElasticTables
{
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.K
如果这个问题已经被问过了,很抱歉。我开始研究C#,并注意到C#不会自动导入嵌套名称空间。我不明白:
using System;
是否应该自动导入System名称空间中包含的所有类,对吗?所以我不需要写
using System.Windows.Form;
如果using Windows.Form还能工作,我会理解的。但是编译器无法解析它!那么,在它之前的using System;有什么意义呢?那么,为什么using System;不能自动导入System.Windows和System.Windows.Forms呢-如果这里的导入一词有误,很抱歉。也许迁移到全局命名空间是正确的术语。
我有一个名为Tools.cs的文件,里面有一个类Tools。我使用另一个文件Default.cs作为我的Default.aspx的代码后台。我已经尝试了以下所有方法来使用默认文件中的工具文件,但都不起作用。我该怎么做呢?
using Tools;
using Global.Tools; //Added namespace Global to my tools class
using Global;
编辑:更详细地说,这里有一些代码。
//Tools.cs
namespace Global{
public sealed class Tools{
//Tools stuff
我正在维护一个visual studio 2008应用程序(网站项目)。没有机会升级到更高版本的of.net框架或更高版本的实体框架。像许多IT商店一样,除非出现重大问题,否则人们不会允许我对系统进行重大升级。
.net框架是3.5。EF版本为1.0
我需要修改我的程序,这样我的select linq语句才能工作
如您所知,我需要将存储函数作为select语句的一部分
所以我复制了这份声明。
我已经挣扎了几个小时,但我一直在编译。
//..various using statement
using System.Data.Objects.DataClasses;
using System.D
我有一个asp.net网站,我做了一个数据库服务库,为它制作了一个动态链接库文件,并将其导入到website.it中,在本地运行良好,但当我将其上传到主机上时,我遇到了一个错误,即使文件在bin文件夹中,也无法精细组装。
Line 5: using System.Web.UI;
Line 6: using System.Web.UI.WebControls;
Line 7: using my.LinqClasses;
Line 8:
Line 9: public partial class Webcontrols_Sidemenu : System.Web.UI.UserContr
我有我的c#类库。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Keyence.IV.Sdk;
using System.Reflection;
namespace JavaKameraSchnittstelle
{
public class KeyenceKameraSchnittstellen
{
我已经在Microsoft Visual Studio Enterprise 2015版本14.0.25123.00更新2中创建了一个新的'Blank Xaml App (Xamarin.Forms Shared)‘应用程序。
在创建项目后,我立即收到217个错误。重新启动Visual Studio删除了其中的大部分,但仍保留了35个。
前两个错误是关于找不到Foundation和UIKit。我认为这两个也可能导致其余的错误。
有没有人有办法解决这些问题?
Error CS0246 The type or namespace name 'Foundation' coul