无法恢复 ASP.NET Core 1.0 RTM 解决方案
Unable to restore a ASP.NET Core 1.0 RTM solution
我刚刚将一个可用的 RC2 Web 应用程序转换为 RTM,但我在 IIS 上发布时遇到了一些问题。
我找到的所有示例都是基于 NetCoreApp1.0 应用程序。由于某些要求,我们仅限于 "net46".
这是project.json
{
"version": "1.0.0-*",
"dependencies": {
"Domain": "1.0.0-*",
"Microsoft.AspNetCore.Authentication": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.DataProtection.SystemWeb": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.AspNetCore.Localization": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"PublicLib": "1.0.0-*",
"PublicLib.Imaging": "1.0.0-*",
"PublicLib.Interfaces": "1.0.0-*",
"Storage": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"net46": {
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"Views",
"appsettings.json",
"database.json",
"PublicWeb.nuspec"
]
},
"packOptions": {
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
这是我得到的错误
Errors in C:\Development\Path\To\Web\Application\project.json
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
如果我按如下方式更改 "tools" 部分,
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "net451"
}
},
我设法恢复了解决方案,但是当我尝试使用 dotnet publish .\Path\To\Web\Application\ -o .\tmp\public\
发布解决方案时,我得到以下输出
Publishing PublicWeb for .NETFramework,Version=v4.6/win7-x64
Project Domain (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Interfaces (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Imaging (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project Storage (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicWeb (.NETFramework,Version=v4.6) will be compiled because inputs were modified
Compiling PublicWeb for .NETFramework,Version=v4.6
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.8045183
Configuring the following project for use with IIS: '.\tmp\public\'
Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run()
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.<Main>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
publish: Published to .\tmp\public\
Published 1/1 projects successfully
事件如果说 Published 1/1 projects successfully
,.\tmp\public\web.config
包含以下行。
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
虽然它曾经包含
<aspNetCore processPath=".\PublicWeb.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
第二个是已部署服务器上 IIS 的工作配置。
关于如何解决这个问题有什么建议吗?
谢谢
我遇到了同样的问题,并且能够通过回滚 IISIntegration.Tools
到 1.0.0-preview1-final
再次发布
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
我可以通过安装 .NET Core SDK from the dot.net 网站来解决这个问题,请在此处查看有关此问题的讨论以获取更多详细信息。
这是帮助我的东西。
在 CMD 中输入 dotnet --version,如果它显示您使用版本 preview1,那么您需要执行以下操作以清理缓存并强制使用 preview2。
首先确保 preview2 在您的计算机中,在 windows 它应该在 C:\Program Files\dotnet\sdk 如果您的目录中有 1.0.0-preview2-003121,那么您是很好,否则先下载最新的 sdk,并确保你也安装了最新的 .Net 核心,并从你的系统中删除 dnx 文件夹,因为它不再相关(更改为 dotnet)。
从 dotnet sdk 目录中删除 preview1 sdk 版本。
在您的项目文件夹中编辑您的 global.json 文件应该是这样的。
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
现在重新启动您的电脑以确保所有服务和进程都已重新启动,
运行 dotnet restore 现在它可以工作了,它会首先 运行 对缓存进行一些更新,但不用担心需要一分钟或 2 分钟,具体取决于您的 OS 规格,然后它会执行恢复。
对我来说是 NuGet 相关的。
在我修复它之前,我一直收到错误:
Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
我发现我的机器上有一个 Visual Studio 版本的 NuGet 和一个命令行版本的 NuGet。我删除了较旧的命令行版本。
我通过进入命令行找到命令行版本,运行 NuGet
显示版本 2.8。 运行 Visual Studio 扩展管理器,报告的版本是 3.5。
我卸载了命令行NuGet版本
我还清除了 NuGet 缓存:
nuget locals -all clear
我不完全确定它是否有两个不同的版本,或者它是否正在清除缓存,但在完成这两个操作后,我不再收到 ProjectModel 错误。
从这里下载 NuGet.exe https://dist.nuget.org/index.html
打开命令提示符并转到目录并执行以下命令
例如:C:/Users/Username/Downloads> nuget.exe locals -Clear all
这解决了我的问题 System.IO.FileNotFoundException:无法加载文件或程序集 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'。系统找不到指定的文件。
我刚刚将一个可用的 RC2 Web 应用程序转换为 RTM,但我在 IIS 上发布时遇到了一些问题。
我找到的所有示例都是基于 NetCoreApp1.0 应用程序。由于某些要求,我们仅限于 "net46".
这是project.json
{
"version": "1.0.0-*",
"dependencies": {
"Domain": "1.0.0-*",
"Microsoft.AspNetCore.Authentication": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.DataProtection.SystemWeb": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.AspNetCore.Localization": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"PublicLib": "1.0.0-*",
"PublicLib.Imaging": "1.0.0-*",
"PublicLib.Interfaces": "1.0.0-*",
"Storage": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"net46": {
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"Views",
"appsettings.json",
"database.json",
"PublicWeb.nuspec"
]
},
"packOptions": {
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
这是我得到的错误
Errors in C:\Development\Path\To\Web\Application\project.json
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
如果我按如下方式更改 "tools" 部分,
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "net451"
}
},
我设法恢复了解决方案,但是当我尝试使用 dotnet publish .\Path\To\Web\Application\ -o .\tmp\public\
发布解决方案时,我得到以下输出
Publishing PublicWeb for .NETFramework,Version=v4.6/win7-x64
Project Domain (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Interfaces (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Imaging (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project Storage (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicWeb (.NETFramework,Version=v4.6) will be compiled because inputs were modified
Compiling PublicWeb for .NETFramework,Version=v4.6
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.8045183
Configuring the following project for use with IIS: '.\tmp\public\'
Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run()
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.<Main>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
publish: Published to .\tmp\public\
Published 1/1 projects successfully
事件如果说 Published 1/1 projects successfully
,.\tmp\public\web.config
包含以下行。
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
虽然它曾经包含
<aspNetCore processPath=".\PublicWeb.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
第二个是已部署服务器上 IIS 的工作配置。
关于如何解决这个问题有什么建议吗?
谢谢
我遇到了同样的问题,并且能够通过回滚 IISIntegration.Tools
到 1.0.0-preview1-final
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
我可以通过安装 .NET Core SDK from the dot.net 网站来解决这个问题,请在此处查看有关此问题的讨论以获取更多详细信息。
这是帮助我的东西。
在 CMD 中输入 dotnet --version,如果它显示您使用版本 preview1,那么您需要执行以下操作以清理缓存并强制使用 preview2。
首先确保 preview2 在您的计算机中,在 windows 它应该在 C:\Program Files\dotnet\sdk 如果您的目录中有 1.0.0-preview2-003121,那么您是很好,否则先下载最新的 sdk,并确保你也安装了最新的 .Net 核心,并从你的系统中删除 dnx 文件夹,因为它不再相关(更改为 dotnet)。
从 dotnet sdk 目录中删除 preview1 sdk 版本。
在您的项目文件夹中编辑您的 global.json 文件应该是这样的。
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
现在重新启动您的电脑以确保所有服务和进程都已重新启动, 运行 dotnet restore 现在它可以工作了,它会首先 运行 对缓存进行一些更新,但不用担心需要一分钟或 2 分钟,具体取决于您的 OS 规格,然后它会执行恢复。
对我来说是 NuGet 相关的。
在我修复它之前,我一直收到错误:
Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
我发现我的机器上有一个 Visual Studio 版本的 NuGet 和一个命令行版本的 NuGet。我删除了较旧的命令行版本。
我通过进入命令行找到命令行版本,运行 NuGet
显示版本 2.8。 运行 Visual Studio 扩展管理器,报告的版本是 3.5。
我卸载了命令行NuGet版本
我还清除了 NuGet 缓存:
nuget locals -all clear
我不完全确定它是否有两个不同的版本,或者它是否正在清除缓存,但在完成这两个操作后,我不再收到 ProjectModel 错误。
从这里下载 NuGet.exe https://dist.nuget.org/index.html
打开命令提示符并转到目录并执行以下命令 例如:C:/Users/Username/Downloads> nuget.exe locals -Clear all
这解决了我的问题 System.IO.FileNotFoundException:无法加载文件或程序集 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'。系统找不到指定的文件。