我似乎無法找到任何人有這個相同的問題,它讓我拉出頭髮好幾個小時。我正在與一羣人一起開展.net核心項目。我意識到我的版本已經過時了很多,並升級到版本1.0.4。但是,自更新以來,我無法再無錯地構建或運行項目。更新後不能構建.NET Core項目
C:\ PROGRAM 文件\ DOTNET \ SDK \ 1.0.4 \的SDK \ Microsoft.NET.Sdk \建立\ Microsoft.PackageDependancyResolution.targets(154,5): 錯誤:資產文件 「C :\ Users \ ZL \ Documents \ lynx \ lynx%20project \ src \ Lynx.Web \ obj \ project.assets.json' 找不到。運行一個NuGet包恢復來生成這個文件。 [C:\ Users \ ZL \ Documents \ lynx \ lynx%20project \ src \ Lynx.Web \ Lynx.Web.csproj] obj \ Debug \ netcoreapp1.1 \ Lynx.Web.AssembleyInfo.cs(6,12) :錯誤CS0246: 類型或命名空間名稱「系統」找不到(你 缺少指令或程序集引用?)
[C:\用戶\ ZL \文檔\猞猁\猞猁%20project \ src \ Lynx.Web \ Lynx.Web.csproj]
這些文件存在,看起來很好。我運行了一個dotnet restore
和dotnet clean
。我試圖擦掉obj和bin文件夾並重新生成它們。我擦乾淨了我們的NuGet緩存。我嘗試卸載.NET Core並重新安裝它。我甚至徹底拋棄了我的代碼,並從git中取出了新的版本。其他團隊成員可以建立良好的代碼,它可以在其他機器上工作,而不是我的Windows 10機器。看起來像dotnet恢復應該修復它,並且在我研究類似問題時發現的任何地方都是修復。某種形式的東西不是怪人,但我無法弄清楚。有什麼我需要更新,我失蹤了?
**編輯補充的csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>Lynx.Web</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Lynx.Web</PackageId>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<Compile Remove="node_modules\**\*" />
<None Update="ClientApp\dist\**\*;Views\**\*;wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="wwwroot\dist\*.map">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="1.1.0-*" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.0.2" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="1.0.0" />
<PackageReference Include="IdentityServer4" Version="1.2.0" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
</Target>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
在此先感謝。
有跑了NuGet包還原嗎? – Liam
是您的其他團隊成員在CLI的相同'1.0.4'版本上嗎?你可以分享'.csproj'文件嗎? –
@Liam當運行'nuget restore'時,我收到消息''nuget'不被識別爲內部或外部命令,可操作程序或批處理文件。「 @MartinUllrich,我已經添加了csproj。我相信,我昨天晚上和他談的是v1.0.3。 –