Your official information source from the .NET Web Development and Tools group at Microsoft.
Today, the Visual Studio team announced the release of Visual Studio “14” CTP version 14.0.21730.1 DP. Our team added features to support ASP.NET vNext development. We will have future blogs to talk about some of the features in detail. Note, Visual Studio side by side support is not available on this early build. Do not install this CTP on a machine with any other version of Visual Studio installed.
ASP.NET vNext projects can be created using C# templates with “ASP.NET vNext” in the name.
To generate an MVC 6 project, select “ASP.NET vNext Web Application template” and click OK.
You can find the generated project file has a new extension “.kproj”. It looks like a normal “.csproj” file, but doesn’t contain any reference elements, and has a few other differences such as target file and project type. The project system gets most project information from the file and folder structure and the project.json file.
Checking the generated solution folder, we can see it has a packages folder containing all the packages needed for the project. It also contains a “<solutionName>.sln.ide” folder which is used by Roslyn Compiler engine to store temporary files. This folder should be excluded from the source control system normally.
The project’s property page can change the active target framework, between “.NET Framework 4.5” and “.NET Core Framework 4.5”. “.NET Core Framework 4.5” is the new cloud-optimized runtime.
Using the project’s reference tree, you can view the package dependencies clearly, under the active target framework.
For library projects, the build will create dlls targeting both “.NET Framework 4.5” and “.NET Core Framework 4.5”, generating corresponding NuGet packages in the output bin folder.
For web and console projects, the build will not generate any packages or dlls. When you deploy the project to the file system, you will see that the source code will be copied as well. The projects are compiled and run dynamically.
To ease project.json editing, we added IntelliSense support.
For the dependencies object, it provides IntelliSense options by searching the NuGet server to list all the available packages and their versions.
Thanks to the Rosyln compiler, if you change ".cs” files or project.json file and want to see the change in the browser, you don’t need to build the project any more. Just refresh the browser.
All the files and folders (except bin and obj folders) under the project folder are automatically included as project files. Any file system change under the project folder will be automatically picked up in Solution Explorer and IntelliSense get refreshed automatically.
If you change dependencies by modifying the project.json file, the packages are automatically restored, and IntelliSense get adjusted automatically. You can check the “Package Manager Log” output window to see the action.
You can publish your MVC 6 project to an Azure website or the file system with a similar publishing story as before.
The following screen shot shows file system publishing after you click Publish in the context menu for the project:
1. Choose “File System” or choose an existing file system publishing profile.
2. Set up a local folder:
3. Choose Publish, after it is finished, go to the published folder, run the web.cmd file.
4. Examine the project.json file’s “web” command to get the URL, which in our case is http://localhost:5000. Type this URL in your browser to see the running site.
There is no IIS express, nor IIS involved when you run from the command line. It means that you can publish your website to a USB drive, and run it by double clicking the web.cmd file!
You can find more tooling details in asp.net article Getting Started with ASP.NET vNext and Visual Studio "14".
With this new tooling you can now open the existing MVC Music Store and Bug Tracker sample projects on GitHub in Visual Studio and get a full development experience. You can find instructions on how to open, build, run and publish these sample ASP.NET vNext project in the documentation for the corresponding GitHub repos.
We’d love to hear your feedback. For VS tooling related, please submit bugs through Connect; send suggestions on UserVoice and quick thoughts via Send-a-Smile in the Visual Studio IDE. For ASP.NET vNext, please provide feedback in Github or the ASP.NET vNext forum. If you ask a question in Stack Overflow, use the asp.net-vnext tag. Thanks for being with us in this exciting time.
"It also contains a “<solutionName>.sln.ide” folder which is used by Roslyn Compiler engine" -- Since we already have a .git folder why not use the same naming convention and call it .ide or .sln.ide? (I think .ide would be nicer) Thanks.
Very exiting! Say, how does Project.json relate to msbuild and build servers that simply run msbuild with visual studio installed? Can use this infrastructure when you create reusable libraries?
best regards, Michael
@Peter, thanks for the suggestion, I'll forward your comment to the Roslyn team.
@Michael, check github.com/.../Command-Line to see how to use k build to build the project. The building itself is not tied to Visual Studio and msbuild.
The new Json intellisense support is cool. I hope however, that it has been improved compared to the support in "VS 2013 Update 2" where I've been experimenting with Json Schemas to create custom intellisense for a project where I want to switch from using XML to Json.
The main problem seems to be that documentation does not show up as often as it does for XML - eg. if you hover the mouse over "elements" you would expect the documentation from the schema to show up, as it does for XML.
Can you clarify if this is the case for VS 2014? Will json schemas be supported at the same level as XML schemas to provide intellisence and documentation support?
@Frenz, thanks for the suggestion. I forwarded your request to our tooling PM. I do suggest you open a UserVoice suggestion so that we can officially track your request. Thanks again!
What about in a production environment. Is it still feasible to deploy assemblies to the file system, either through a manual publish or a build server?
@Xinyang Qiu, thank you for the update. So, this means I will need to call the compilation of vNext projects from within my msbuild-scripts using commandline instead of the fully integrated msbuild calls csproj files. Is the k build intended to completely replace msbuild or is it just meant to define and compile the actual projects while scripting an entire build would continue to be done using msbuild? Is msbuild going to become legacy technology or is it still a solid investment? And is the project.json format only intended for asp.net vnext type projects or will it also be supported/recommended with the project types we have today, given how much cooler the nuget integration looks like?
best regards, Michael
@Ryan, good question. We'll have plan to support the pre-compiling to assembly feature in future release, so that you can still deploy assemblies to file system and in production.
@Michael, I don't think msbuild will be replaced by ASP.NET vNext project build system. Our VS tooling also uses msbuild target file to call the build action just as "k build" does. Right now, Project.json is intended for ASP.NET vNext projects. The ultimate goal is that you should be able to use any tools on any platform to edit the ASP.NET vNext project files and get it build and run, even without Visual Studio.
@Xinyang Qiu, thanks again!
Looks fantastic! Is there any guidance (or is it even possible) to upgrade an existing MVC5 application to use this (MVC6)?
Also, excellent work on having Azure support so early.
@Brendan Green, thanks! You can check David Fowler's response to this question in forums.asp.net/.../1989725.aspx . Basically, there will be guidance and tools that will aid in porting. But some project will require much more effort than the others.
@frenz, it's not in the CTP of VS '14', but it will be added later soon
@Michael regarding build support we are planning to be as consistent with existing projects as possible. When using Visual Studio a .kproj file is created. It's an MSBuild file like most other VS projects. You can think of the vNext compile/verify phase as a replacement for the CSC (C# compiler) MSBuild task. There may be some changes if you have customized the build/publish process but we are hoping to maintain as much consistency as we can. We will see some updates in the build/publish space coming later.
Tak Mads :)
The exciting part is the ability to change a .cs file an see the affects without rebuilding the project.