내 Windows 하드 드라이브는 최근에 .net 코어 1.1을 사용하여 2015와 각도 2 .net 코어 응용 프로그램에서 최근에 발생한 먼지를 비트합니다. 나는 우분투가있는 컴퓨터를 가지고 있기 때문에 코드를 다운로드하고 프로젝트를 복제하고 제대로 작동하지 않는 이유는 무엇입니까? 그렇습니다. 문제가 생겨서 누군가 도움을 줄 수 있습니다.내 .net 핵심 응용 프로그램을 Visual Studio 코드에서 실행하려고 시도했습니다.
C#을 설치합니다. C# 확장을 설치합니다. 그러나 이것은 내가 얻는 오류이다.
Build FAILED. /home/deshazer/Documents/code/HannaOilGas2/HannaOilAndGas2/project.json(1,1) : 오류 MSB4025 : 프로젝트 파일을로드 할 수 없습니다. 루트 수준의 데이터가 유효하지 않습니다. 1 호선, 위치 1. 0 경고 (들) 1 오류 (들) 시간 경과 00 : 00 : 00.06
지금 내 project.json 파일이 내가이
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore": "1.1.0",
"Microsoft.AspNetCore.Mvc.Core": "1.1.1",
"Microsoft.AspNetCore.AngularServices": "1.0.0-*",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"appsettings.json",
"ClientApp/dist",
"node_modules",
"Views",
"web.config",
"wwwroot"
]
},
"scripts": {
"prepublish": [
"npm install",
"node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod",
"node node_modules/webpack/bin/webpack.js --env.prod"
],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "HannaOilAndGas2"
}
}
처럼 보인다 또한 내 모델 및 내 컨트롤러에서 웹 API를 사용하여 문제가 발생하면 누구나 코드 대에서이 문제를 해결할 수 있습니까?
using System;
using System.Collections.Generic;
namespace HannaOilAndGas2.Data
{
public partial class MainView
{
public int RecId { get; set; }
public string Location { get; set; }
public double? SpotFlowRate { get; set; }
public double? PreviousDayVolume { get; set; }
public double? LinePressure { get; set; }
public double? DifferentialPressure { get; set; }
public double? Temperature { get; set; }
public double? BatteryVoltage { get; set; }
public double? Fcp { get; set; }
public double? Ftp { get; set; }
public DateTime? Timestamp { get; set; }
public string LastCommunicationMethod { get; set; }
public string MeterId { get; set; }
public string ImportMethod { get; set; }
public int HannaDeviceId { get; set; }
}
}
타입 시스템을 찾을 수 없다는 것을 말하면서 메소드에 int를 넣으라고합니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HannaOilAndGas2.Data;
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace HannaOilAndGas2.Controllers
{
[Produces("application/json")]
[Route("api/mainview")]
public class MainViewApi : Controller
{
private readonly ScadaContext _context;
public MainViewApi(ScadaContext context)
{
_context = context;
}
// GET: api/values
[HttpGet]
[Route("allmainview")] //front end - done
public IEnumerable<MainView> GetAllMainView()
{
return _context.Main_View.Where(x => !x.MeterId.StartsWith("HOGC"));
}
[HttpGet]
[Route("allwinccuview")] //front end - done
public IEnumerable<MainView> GetAllWinccuView()
{
return _context.Main_View.Where(x => x.ImportMethod == "WINCCU");
}
[HttpGet]
[Route("allmanualview")] //front end - done
public IEnumerable<MainView> GetAllManualView()
{
return _context.Main_View.Where(x => x.ImportMethod == "SPREADSHEET");
}
[HttpGet]
[Route("allservicestarview")] //front end - done
public IEnumerable<MainView> GetAllServiceStarView()
{
return _context.Main_View.Where(x => x.ImportMethod == "SERVICESTAR-POLL");
}
[Route("allcanadaview")] //front end - done
public IEnumerable<MainView> GetAllCanadaView()
{
return _context.Main_View.Where(x => x.MeterId.StartsWith("HOGC"));
}
// GET api/values/5
[HttpGet("{id}")]
public IEnumerable<MainView> GetMainViewDataById(int id)
{
return _context.Main_View.Where(x => x.RecId == id);
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
이 미리 정의 된 타입 시스템 문자열을 정의하거나 내 project.json에 어떤 도움을 주시면 감사하겠습니다 부디 다시 netcoreapp1.1를 가져올 수 없습니다 말하고있다.
우분투에서 최신 .NET Core SDK를 사용하고 있습니까? 터미널에서'dotnet --version'을 실행하면 어떻게됩니까? 문제는 앱이'project.json'을 사용하고 있지만 .NET Core SDK 버전이 MSBuild 변환이 필요한 .csproj를 찾고있을 수 있습니다. – kimbaudi
@set 나는 도트 네트 1.0.1을 가지고 있습니다. –
.csproj를 생성했는데 MSBUILD가 나타납니다 : error MSB1009 : 프로젝트 파일이 존재하지 않습니다. 그것은 런타임 프레임 워크 버전 1.1.1 RuntimeFrameworkVersion> –