Hello,
I am working on an ASP.NET Core 1.0 site that references a few class libraries that target .NET 4.5.1. Everything is working well locally, I can compile and run in IIS Express on localhost.
When I attempt to Publish, I get the error below:
C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Common\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Common does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed.
All of the Class Libraries target .NET 4.5.1, so I'm not sure why I'm getting the error "does not support framework .NETFramework,Version=v4.5". I have removed dnxcore* from project.json. I do reference some nuget packages from the 4.5.1 Class Libvraries.
Please find below the full output when I publish -
3>------ Publish started: Project: MyCompany.MyProject.FrontEnd.WebApp, Configuration: Debug Any CPU ------ Connecting to c:\temp\PublishOutput... rmdir /S /Q "C:\tmp\" Environment variables: Path=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\git C:\Users\myFirstName.myLasttName\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnu.cmd publish "C:\Code\Github\MyProject\src\MyCompany.MyProject.FrontEnd.WebApp" --out "C:\tmp" --configuration Debug --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --wwwroot "wwwroot" --wwwroot-out "wwwroot" --iis-command "web" --quiet Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231 Executing script 'prepublish' in project.json npm WARN package.json MyProjectfrontendwebapp@1.0.0 No description npm WARN package.json MyProjectfrontendwebapp@1.0.0 No repository field. npm WARN package.json MyProjectfrontendwebapp@1.0.0 No README data [22:02:40] Using gulpfile C:\Code\Github\MyProject\src\MyCompany.MyProject.FrontEnd.WebApp\gulpfile.js [22:02:40] Starting 'clean:js'... [22:02:40] Starting 'clean:css'... [22:02:40] Finished 'clean:js' after 1.9 ms [22:02:40] Finished 'clean:css' after 2.16 ms [22:02:40] Starting 'clean'... [22:02:40] Finished 'clean' after 6.32 μs [22:02:41] Using gulpfile C:\Code\Github\MyProject\src\MyCompany.MyProject.FrontEnd.WebApp\gulpfile.js [22:02:41] Starting 'min:js'... [22:02:41] Starting 'min:css'... [22:02:41] Finished 'min:js' after 32 ms [22:02:41] Finished 'min:css' after 41 ms [22:02:41] Starting 'min'... [22:02:41] Finished 'min' after 5.92 μs Copying to output path C:\tmp C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Common\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Common does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Configuration\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Configuration does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.MyFeature.Client\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.MyFeature.Client does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.MyFeature.Models\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.MyFeature.Models does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Models\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Models does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Tests.Models\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Tests.Models does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. C:\Code\Github\MyProject\src\wrap\MyCompany.MyProject.Tests.Storage\project.json(0,0): Error NU1002: The dependency Microsoft.AspNet.Razor 4.0.0-rc1-final in project MyCompany.MyProject.Tests.Storage does not support framework .NETFramework,Version=v4.5. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(152,5): Error : Build failed. Time elapsed 00:00:08.9518344 3>Publish failed due to build errors. Check the error list for more details. ========== Build: 2 succeeded, 0 failed, 5 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
Also here's my full project.json -
{"version": "1.0.0-*","compilationOptions": {"emitEntryPoint": true },"resource": ["../MyCompany.MyProject.Configuration/MyProjectEnvironment.resx" ],"dependencies": {"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final","Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final","Microsoft.AspNet.Mvc": "6.0.0-rc1-final","Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final","Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final","Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final","Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final","Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final","Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final","Microsoft.Extensions.Logging": "1.0.0-rc1-final","Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final","Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final","Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final" },"commands": {"web": "Microsoft.AspNet.Server.Kestrel" },"frameworks": {"dnx451": {"dependencies": {"MyCompany.MyProject.Tests.Models": "1.0.0-*","MyCompany.MyProject.Configuration": "1.0.0-*","MyCompany.MyProject.Common": "1.0.0-*","MyCompany.MyProject.Tests.Storage": "1.0.0-*","MyCompany.MyProject.MyFeature.Client": "1.0.0-*","MyCompany.MyProject.MyFeature.Models": "1.0.0-*" } } },"exclude": ["wwwroot","node_modules" ],"publishExclude": ["**.user","**.vspscc" ],"scripts": {"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] } }
I have tried Publish to File System or to an Azure Web App, and the same error occurs.
Does anyone know how to fix this?
Thanks,
@ehuna