2017-11-11 333 views
0

我們正在嘗試構建xproj項目以及有關無法找到Microsoft.DotNet.Props文件的錯誤,因爲它看起來像是在查看錯誤的目錄。Microsoft.DotNet.Props目錄不存在,用於構建xproj

考慮看看MSBuildExtensionsPath32引用C:\Program Files\dotnet\sdk\1.1.4\所在目錄Microsoft\VisualStudio\..不存在XML ...但正常的MSBuild目錄C:\Program Files (x86)\MSBuild確實有Microsoft.DotNet.Props文件的目錄C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props

下面是部分在XML

<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> 

<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> 

我看,而建築是錯誤:

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.1.4\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. 

如果任何人有任何想法發生了什麼事,幫助將是巨大

編輯:

  • 構建從詹金斯項目調用Windows Server 2012中R2上。
  • VM映像來自Azure市場「MicrosoftVisualStudio/VisualStudio/VS-2015-Comm-VSU3-AzureSDK-29-WS2012R2/2017.10.12」 - 隨Visual Studio 2015社區版附帶更新3一起提供。 Azure SDK 2.9。從舊v0.12升級到v8.x.升級的.NET核心不知道什麼是安裝到1.1.4。
  • xproj本身沒有代碼 - 除了Startup.cs中用於提供靜態文件(代碼位於底部的代碼)的少量代碼外。
  • 該應用程序還用於Service Fabric項目。這個錯誤並不是來自構建.sln,而是在打包.sfproj(它可能不是構建在sln中,但打包需要構建它)。

Jenkins build steps

Startup.cs:

using System.IO; 
using Microsoft.AspNetCore.Builder; 
using Microsoft.AspNetCore.Hosting; 
using Microsoft.Extensions.Configuration; 
using Microsoft.Extensions.DependencyInjection; 
using Microsoft.Extensions.Logging; 

namespace Website 
{ 
    public class Startup 
    { 
     public Startup(IHostingEnvironment env) 
     { 
      var builder = new ConfigurationBuilder() 
       .SetBasePath(env.ContentRootPath) 
       .AddJsonFile("appsettings.json", true, true) 
       .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true) 
       .AddEnvironmentVariables(); 
      Configuration = builder.Build(); 
     } 

     public IConfigurationRoot Configuration { get; } 

     // This method gets called by the runtime. Use this method to add services to the container. 
     public void ConfigureServices(IServiceCollection services) 
     { 
      // Add framework services. 
      services.AddMvc(); 
     } 

     // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
     public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 
     { 
      loggerFactory.AddConsole(Configuration.GetSection("Logging")); 
      loggerFactory.AddDebug(); 

      if (env.IsDevelopment()) 
      { 
       app.UseDeveloperExceptionPage(); 
      } 
      else 
      { 
       app.UseExceptionHandler("/Home/Error"); 
      } 

      app.Use(async (context, next) => 
      { 
       await next(); 
       if (context.Response.StatusCode == 404 
        && !Path.HasExtension(context.Request.Path.Value)) 
       { 
        context.Request.Path = "/index.html"; 
        await next(); 
       } 
      }); 

      app.UseStaticFiles(); 
     } 
    } 
} 

編輯:這裏是整個xproj XML

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> 
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> 
    </PropertyGroup> 
    <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> 
    <PropertyGroup Label="Globals"> 
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> 
    <ProjectGuid>17107df8-0cfa-6946-917a-a9b8765cf9ea</ProjectGuid> 
    <RootNamespace>Website</RootNamespace> 
    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> 
    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> 
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 
    </PropertyGroup> 
    <PropertyGroup> 
    <SchemaVersion>2.0</SchemaVersion> 
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject> 
    </PropertyGroup> 
    <ItemGroup> 
    <DnxInvisibleContent Include="bower.json" /> 
    <DnxInvisibleContent Include=".bowerrc" /> 
    </ItemGroup> 
    <ItemGroup> 
    <DnxInvisibleFolder Include="wwwroot\Angular\dist\" /> 
    </ItemGroup> 
    <ItemGroup> 
    <Service Include="{82a7f48d-3b69-4b1e-b82e-3ada8210c987}" /> 
    </ItemGroup> 
    <Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" /> 
</Project> 
+0

問題沒有足夠的信息來重現錯誤。你能發佈最少的代碼,這將允許重現你的問題,此外請提供關於如何構建被調用,平臺,安裝sdks,VS等信息。 –

+0

@JacekBlaszczynski我已經更新了原來的帖子 – Jjj

+0

感謝發佈代碼。你可以發佈整個項目的XML和pkgproj或任何相當於什麼可以用來建立你的項目?有時調試msbuild項目是非常困難和不重要的,尤其是當錯誤埋藏得很深並且缺少信息錯誤信息時。我要去睡了,所以明天會回答:) –

回答

1

您正在嘗試使用預覽工具(xproj)與.NET Core Sdk的1.1.4版本。 VS 2015中提供的預覽工具不適用於.NET Core的1.0+穩定工具。

請確保您的開發機器和Jenkins服務器上都安裝了.NET Core SDK的preview2版本 - 例如, 1.0.0-preview2-003156 - 這一個global.json文件存在於您的解決方案目錄告訴VS使用SDK的這個預覽版本:

{ 
    "sdk": { 
    "version": "1.0.0-preview2-003156" 
    } 
} 

正如我建議通過遷移移動到穩定和支持.NET的核心工具一個長期的解決方案到VS 2017.