无法在VS 2017 RC中构建aspnetcore应用程序

时间:2017-01-03 02:35:48

标签: asp.net-core visual-studio-2017

安装新VS 2017 RC后,我遇到构建asnetcore应用程序的问题,这是我收到的错误:

  

MSB4131不支持“FilesWritten”参数   “GenerateRuntimeConfigurationFiles”任务。验证参数是否存在   在任务上,它是一个可获取的公共实例属性。

这是我的.csproj文件:

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net462</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
  </PropertyGroup>
  <PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
  </PropertyGroup>
  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>
  <PropertyGroup>
    <UserSecretsId>aspnet-HobbyQuarters.Web-e309acfb-31ce-4333-a350-edb5d1c073d3</UserSecretsId>
  </PropertyGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
    <PackageReference Include="Microsoft.NETCore.App">
      <Version>1.0.1</Version>
    </PackageReference>
    <PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Owin" Version="1.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
    <PackageReference Include="Nancy">
      <Version>2.0.0-barneyrubble</Version>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild2-final" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-final" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild2-final" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Tasks\" />
  </ItemGroup>
</Project>

2 个答案:

答案 0 :(得分:1)

  1. 启动任务管理器
  2. 结束所有现有的MSBuild任务。
  3. 重建您的项目。它应该工作得很好。
  4. 旁边。你的.csproj对我来说很好看;但是,看起来它的设置可以在两个不同的环境中运行,可能是console和aspcore 1.0

答案 1 :(得分:0)

所以看起来这与多个具有不同msbuild工具版本的项目有关。

我的旧项目没有使用引用工具的新约定:ToolsVersion =“15.0”Sdk =“Microsoft.NET.Sdk.Web”......

一旦我改变它们以使用这个约定,一切都开始起作用了。