Running VS 2015 RC on windows 7 64, for the asp.net projects, it looks like the screenshot below, there is also no intellisense, but the project can compile, something wrong?
the VS has resharper 9 and web essential extension installed as well
project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
//"Microsoft.AspNet.Mvc": "6.0.0-beta4"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
also, was keep getting the error message
the activitylog.xml
They aren't missing, they are just not used. If they were missing/unresolved, there would be a red squiggle. They are dimmed because you aren't using them.
See this: http://csharp.2000things.com/2014/10/28/1213-visual-studio-2014-unused-using-statements-greyed-out/
Try this for the other issues:
Run VS with /SafeMode switch (eliminates the extension issues and possible conflicts with VS)
Uncomment the "Microsoft.AspNet.Mvc": "6.0.0-beta4" line in the dependencies file
Related
I have built a relatively simple ASP.Net Core web application that uses Angular 2 & bootstrap for the front end and WebApi as the back end.
I am able to build and run my application locally (to IIS Express) and it works just fine, however, when I attempt to use the Build -> Publish menu I encounter a NullReferenceExceptionError that is terrible unhelpful. Here is the output when I run Publish:
1>------ Publish started: Project: MyProject, Configuration: Release Any CPU ------
Connecting to C:\ProjectDir\MyProject\./bin/Release/PublishTest...
rmdir /S /Q "C:\Users\UserName\AppData\Local\Temp\PublishTemp\MyProject86\"
Environment variables:
Path=%PATH%;.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe publish "C:\ProjectDir\MyProject" --framework net452 --output "C:\Users\UserName\AppData\Local\Temp\PublishTemp\MyProject86" --configuration Release --no-build
Publishing MyProject for .NETFramework,Version=v4.5.2/win7-x64
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : Object reference not set to an instance of an object.
1>Publish failed due to build errors. Check the error list for more details.
========== Build: 0 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I have attempted to do a FileSystem publish to both a directory on a server running IIS as well as just a local directory, and I get the same output in both of these instances.
I have cleaned my solution, rebuilt, and restarted Visual Studio just in case it had been in a bad state. I've created a few different publish profiles just to make certain that something wasn't misconfigured with that (some of them were created after the restart of VS2015, as well).
In addition I made sure to update VS2015 after I started having this problem, and I am now running version 14.0.25425.01 Update 3. I also have the latest web tools installed.
Here is my project.json file:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"net452": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
"aDependency": {
"target": "project"
}
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
I've been searching for anyone else having this issue and I believe I found one or two other places where this seems to have been encountered but I haven't found anyone that has replied with a solution or even a theory to what is happening exactly. Any help, theories, or leads would be appreciated.
Thanks for your time.
EDIT: As suggested in the comments I created a new ASP.NET Core application since 1.0.0 was released and took a look at the differences. It worked and I feel silly for missing this, anyway, for anyone else who runs into this (albeit temporally limited) issue, here's the fixed project.json file:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
"aDependency": {
"target": "project"
}
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
I think you should update your app from RC2 to 1.0.0 and you may want to create a new web app with 1.0.0 and the latest tooling/vs project templates from dot.net then compare the project.json and startup code to your existing app and update the existing app
So it sounds like a trivial task, I just want to use common code from my class library in both my web api and webapp but I am unable to reference the class library from my webapp projects, so I made a clean project to test it out.
I have 3 projects:ClassLib1, ClassLib2, WebApp
I am able to reference ClassLib1 From ClassLib2 but I cannot referance either Class librarys from the webapp project
Here are my project.json's
ClassLib1
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
}
}
}
ClassLib2 is exactly the same as ClassLib1
Web App
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"ClassLib1": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
SS showing using ClassLib1 in ClassLib2 successfully
SS showing error in webapp when trying to use ClassLib1
The error when moused over is `cannot resolve symbol 'ClassFromLib1'
Edit: I just noticed that if I change the web app to use netstandard1.5 from netcoreapp1.0 I can then referance code between the projects.
Should I do this? are there any downside by changing the framework in targeting?
So I figured out that the issue I was having was with Resharper. It was making the text red and giving me the errors, it did actually build and work fine but I just didn't see past the red text.
I created a brand new ASP.NET Web API project from scratch. I selected an ASP.NET v5 blank Template and added nothing. My default project.json file looked like so:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
I then went to the NuGET package installer and added Microsoft.AspNet.WebApi and straight away I am presented with errors in the compiler:
I am finding this is occurring for a lot of packages I am trying to install (even the Microsoft.AspNet.WebApi.HelpPage package gives me the same errors). I am also trying to add DbModelBuilder to my classes which throws similar results (which makes me think something is corrupt somewhere):
My updated project.json file now looks like this:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"EntityFramework.Core": "7.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.WebApi": "5.2.3"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.Data.Entity": "4.0.0.0"
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
As I am setting this up a a brand new project, I am a little confused as to what I am doing wrong or if my installation of Visual Studio is messed up. It's making it impossible to follow any tutorials online due to all the errors I'm faced with.
Any help would be greatly appreciated.
I'm trying to generate code from my database but i get errors : System.AggregateException: One or more errors occurred. ---> Method not found
this is my project.json:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"EntityFramework.SqlServer": "7.0.0-beta8-15797",
"EntityFramework.Commands": "7.0.0-beta8-15797",
"EntityFramework.SqlServer.Design": "7.0.0-beta8-15797",
"Remotion.Linq": "2.0.0-rc-001"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
How do i Generating code from an existing database EF7
I'm using this command :
dnx ef dbcontext scaffold "ConnectionString" EntityFramework.SqlServer
Thank you.
Upgrade all packages to be consistent. You have beta5 and beta 8 mixed. If you still experience errors, please check or file and issue to the appropriate repository. https://github.com/aspnet
We're working on our first ASP.NET 5 project with Visual Studio Code. We've installed DNVM and DNX. We've also checked out the NewMVC6Project from the ASP.NET's GitHub account. Further, we've configured our web server within project.json as follows.
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener" : "1.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"bundleExclude": [
"node_modules",
"bower_components",
"**.kproj",
"**.user",
"**.vspscc"
],
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001"
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
Also, when we run dnvm list we receive this output.
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
* 1.0.0-beta4 clr x86 C:\Users\BigFont\.dnx\runtimes default
Still, we receive this error when opening the project's folder in Visual Studio Code.
> The specified runtime path '1.0.0-beta3' does not exist. Searched locations %USERPROFILE%\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta3
Why is it looking for 1.0.0-beta3 instead of 1.0.0-beta4? How do we resolve this?
The problem was in our global.json file. The directory structure goes like this:
NewMVC6Project
src
NewMVC6Project
project.json
other-stuff-omitted
global.json
NewMvc6Project.sln
Even though the project.json was appropriately configured, the global.json need to change from this:
{
"sources": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta3"
}
}
... to this:
{
"sources": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta4"
}
}