所以,我正在我的笔记本电脑和桌面之间进行这个项目.
该项目在笔记本电脑上运行,但现在已将更新后的源代码复制到桌面上,我在项目中有500多个错误,所有错误都是......
该名称在当前上下文中不存在
这是一个例子......
Jobs.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Members/Members.master" AutoEventWireup="true" CodeFile="Jobs.aspx.cs" Inherits="Members_Jobs" %>
<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="aj" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel runat="server" ID="upJobs">
<ContentTemplate>
<!-- page content goes here -->
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)
Jobs.aspx.cs
public partial class Members_Jobs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
loadJobs();
gvItems.Visible = false;
loadComplexes();
loadBusinesses();
loadSubcontractors();
loadInsurers();
pnlCallback.Visible = false;
pnlInsurer.Visible = false;
}
}
// more goes down …Run Code Online (Sandbox Code Playgroud) 在解决方案中构建MVC项目时出现此错误.在我的解决方案中根本不存在对这些文件的引用.
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4105,5): error MSB3030: Could not copy the file "D:\bootmgr" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4105,5): error MSB3030: Could not copy the file "D:\BOOTNXT" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4105,5): error MSB3030: Could not copy the file "D:\pagefile.sys" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4105,5): error MSB3030: Could not copy the file "D:\swapfile.sys" because it was not found.
Run Code Online (Sandbox Code Playgroud)
我的同事可以毫无错误地建立.
我最近下载了VS2017并且已经尝试了一些新的C#7功能.然而,一个让我困惑的是因为它并不总是有效.
本地功能......
这些应该在MVC Web应用程序中工作吗?我已经创建了一个全新的WPF桌面应用程序并且它可以工作,但是当我创建一个全新的MVC Web应用程序时,以下代码不起作用(是的,我知道它没有意义).
public ActionResult Index()
{
void TestMethod(string message)
{
Console.WriteLine(message);
}
TestMethod("Why isn't this working?");
return View();
}
Run Code Online (Sandbox Code Playgroud)
IDE没有显示错误,但是当我编译它时,它会生成一个错误列表:
HomeController.cs(13,13,13,17): error CS1547: Keyword 'void' cannot be used in this context
HomeController.cs(13,28,13,43): error CS1528: Expected; or = (cannot specify constructor arguments in declaration)
HomeController.cs(13,28,13,29): error CS1003: Syntax error, '[' expected
HomeController.cs(13,29,13,35): error CS1525: Invalid expression term 'string'
HomeController.cs(13,36,13,43): error CS1026: ) expected
HomeController.cs(13,36,13,43): error CS1003: Syntax error, ',' expected
HomeController.cs(13,43,13,44): error CS1003: Syntax error, ']' expected
HomeController.cs(13,43,13,44): …Run Code Online (Sandbox Code Playgroud)