我正在尝试从命令行发布dotnet核心2.0.0(发行版)项目。 我收到如下错误。
EXEC(1,1):错误CS8301:预处理符号的名称无效; ''不是有效的标识符[C:\ Work \ FloAppGit \ FloAppStpl \ FloMa nufacturer \ FloManufacturer.fsproj] C:\ Program Files \ dotnet \ sdk \ NuGetFallbackFolder \ microsoft.aspnetcore.mvc.razor.viewcompilation \ 2.0.0 \ build \ netstandard2.0 \ Microsof t.AspNetCore.Mvc.Razor.ViewCompilation.targets(60,5):错误MSB3073:命令“”C:\ Program Files \ dotnet \ dotnet.exe“exec --runt imeconfig“C:\ Work \ FloAppGit \ FloAppStpl \ FloManufacturer \ bin \ Debug \ netcoreapp2.0 \ FloManufacturer.runtimeconfig.json”--depsfile“C: \ Work \ FloAppGit \ FloAppStpl \ FloManufacturer \ bin \ Debug \ netcoreapp2.0 \ FloManufacturer.deps.json“”C:\ Program Files \ dotnet \ sdk \ NuGetFa llbackFolder \ microsoft.aspnetcore.mvc.razor.viewcompilation \ 2.0.0 \编译\ netstandard2.0 \ Microsoft.AspNetCore.Mvc.Razor.ViewCompilat ion.dll“@”obj \ Debug \ netcoreapp2.0 \ microsoft.aspnetcore.mvc.razor.viewcompilation.rsp“”退出代码1. [C:\ Work \ FloAppGit \ Flo AppStpl \ FloManufacturer \ FloManufacturer.fsproj]
我的项目文件如下。
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk.Web">
<PropertyGroup>
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="Controllers/*.fs" />
<Compile Include="FloLogger.fs" />
<Compile Include="Restful.fs"/>
<Compile Include="AppSettingsHelper.fs" />
<Compile Include="DataRecords/BusinessRecords.fs"/>
<Compile Include="DAL/ManufacturerDAL.fs"/>
<Compile Include="DAL/ItemManufacturerDAL.fs"/>
<Compile Include="BAL/ItemManufacturerBAL.fs"/>
<Compile Include="BAL/ManufacturerBAL.fs"/>
<Compile Include="Manufacturer.fs" />
<Compile Include="ItemManufacturer.fs" />
<Compile Include="Startup.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="RavenDB.Client" Version="4.0.0-beta-40016" />
<PackageReference Include="Polly" Version="5.1.0" />
<PackageReference Include="Suave" Version="2.0.3.0" />
<PackageReference Include="Suave.AspNetCore" Version="0.3.0" />
<PackageReference Include="Suave.DotLiquid" Version="2.0.3" />
<PackageReference Include="xunit" Version="2.2.0" />
</ItemGroup>
因为我被困住了,请帮我解决这个问题。
答案 0 :(得分:2)
我能够通过在项目文件中注释这些行来解决问题。
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
此外,我不得不像这样更改项目文件的标题。
<Project Sdk="Microsoft.NET.Sdk.Web">
删除obj和bin文件夹。做一个dotnet clean然后dotnet恢复。 我能够成功发布dotnet core 2.0.0发行版的代码。