Microsoft.DotNet.Props目录不存在,用于构建xproj
问题描述:
我们正在尝试构建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中,但打包需要构建它)。
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>
答
您正在尝试使用预览工具(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.
问题没有足够的信息来重现错误。你能发布最少的代码,这将允许重现你的问题,此外请提供关于如何构建被调用,平台,安装sdks,VS等信息。 –
@JacekBlaszczynski我已经更新了原来的帖子 – Jjj
感谢发布代码。你可以发布整个项目的XML和pkgproj或任何相当于什么可以用来建立你的项目?有时调试msbuild项目是非常困难和不重要的,尤其是当错误埋藏得很深并且缺少信息错误信息时。我要去睡了,所以明天会回答:) –