Automated runtime testing of software on clean environments? - environment

Recently I deployed some software onto a client's PC. The software built and ran correctly on my dev machine and passed all unit and code quality checks on the build server but it crashed explosively when run on the client's PC.
I narrowed the problem down to an external .NET library which referenced a native library that was only included in the .NET Framework 3.5, and the client's PC only had .NET Framework 4.0 installed. (The culprit was Sql Server CE 3.5).
What would be an effective way to detect this kind of issue proactively? I could use an automated UI testing framework running on a clean environment which could be remotely invoked by the build server. This could also be a segue into a set of GUI tests in addition to the goal of answering "Does it run on this environment?" but I'm concerned the two objectives should have clearer separation rather than being lumped together into one set of automated tests. Is there a better way? Also, is there a name for this kind of platform compatibility test?

Aparting from making sure that software is tested on the environment closing as closely as possible to the machines where software is going to be ultimately installed. Apart from that I doubt there is any magic pill which can solve these sort of issues.

I found it was overkill to automate the process of testing on a clean environment since it only has to be done once per public release. I settled for a Virtual PC image of my deployment environment with an "Undo disk" which can be reverted to a clean state after each test run.

Wrapping your install in an MSI using WiX or some such tool would allow you to test for pre-requisites such as .NET 3.5 etc.

Related

Does ASP. NET core still requires hosting with. NET support

I plan to develop website in ASP. NET core. In past i wrote few ASP. NET website but as far as i remember it requures to buy special hosting which needs to have. NET installed. I would like to know whether nowdays is it enough to have cheap hosting without. NET support to pubslih my ASP. NET core website or i still need to buy hosting which has. NET support?
ASP.NET Core can be published to either use an installed .NET Core runtime or self-contained, in which the required parts of the framework are actually published along with the app. In .NET Core 3.0, you can actually publish a .NET Core app as an entirely self-contained single executable file.
In either to publish self-contained (whether in a single executable or not), though, you must target a particular runtime environment when you publish (i.e. Win x64, Linux x64, etc.) You can then only put the app in that actual environment, i.e. if you publish for Windows, you can't deploy that to a Linux box. However, you could simply re-publish for Linux instead.
If you target an installed runtime, similar to how .NET Framework works, then you can publish once and deploy anywhere, assuming the destination has the .NET Core runtime installed.
Long and short, you are not locked into any one particular way of deploying. If you want a framework installation, you can do that. If you want self-contained, you can do that as well.
That said, you should still avoid shared hosting. They usually do not support .NET Core at all or don't keep up with deploying new versions. Additionally, deploying self-contained is generally going to be disallowed to prevent users uploading rogue things. You can get a VPS all to yourself for like $5/mo, so there's really no value proposition to shared hosting nowadays, anyhow.

Publishing from visual studio to windows server 2012

i have a Mvc 4 project i would like to publish on a windows server 2012. On the windows server 2012 i have setup IIS 8 and Sql express. Do you know of a good guide to set this up? My issue is that i can't get the database working. I would like to make it so i can easily publish changes to the website. Any ideas how to do this?
is it possible to setup Visual studios on the server for the nuget package console?
the only way i have got this working was to copy the entire database to sql express but if i change anything i have to do it agian. Not a very stable solution.
Best regards John,
It's not exactly clear what the problem is, but I'll try to give a couple of pointers.
First, nuget shouldn't be involved in the deployment per se; it's involved when building the project, but once you get a deployment package it should contain everything the project needs - look at setting up the deployment using the visual studio built in tools, i.e. see this MSDN link.
The database is a separate side of this. You say you can't 'get it working' which I can't really help with since there's no details - you need to be familiar with connection strings and change your connection string during the deployment so your app can connect to the right database. The publishing wizard linked above can help with this as well, or you can use config transforms, or any number of other mechanisms.
Documentation here has details about what you can do on the database side. The publishing wizard (when using web deploy) can read the database schema and even make schema comparisons so you can deploy schema updates, but I've never actually used that solution - I usually need more control over what happens so I manage my schema upgrade and downgrade scripts myself.
Since there are many problems compounded in this question I suggest you ask a separate, more focused, question about each one.

how to run SmartStore.NET in visual studio 2015?

how start smartstore.net in visual studio localhost without any error
i download github code and open project file from
SmartStoreNET-3.x\src\SmartStoreNET.sln
The download link https://github.com/smartstoreag/SmartStoreNET
I use visual studio 2015 enterprise edition and windows 10.
First, you must be change the "Solution Configuration" to Debug mode, and second change the "Solution Plataform" to Any CPU.
This work for me.
I recently went through this integration/configuration procedure trying to get a local instance of SmartStore.NET up and running with demo data. I was able to get there eventually, but the development environment setup was by far the most tricky.
I would suggest starting with these two links:
http://docs.smartstore.com/display/SMNET30/Installing+SmartStore.NET
http://docs.smartstore.com/display/SMNET30/How+to+build+SmartStore.NET
I have a hunch you're issue may be your development environment configuration is not fully correct. Check out this page for more details about requirements:
Technology and Prerequisites
http://docs.smartstore.com/pages/viewpage.action?pageId=35555597
*NOTE: they reference ASP.NET 4.5.1 but I had to use 4.61 to take advantage of some newer features in C# 7.0 - Tuples, and several others)
Probably the most significant discovery I found was their were dependency issues when trying to restore the NuGet packages referenced in the solution. I had to go through this process maybe 4 or 5 times to finally get the app running locally.
Once all of this was complete, getting it working in 2015 required little effort.
I would also suggest narrowing your question to more specific problems. (that's just me)

How do Bower, Grunt and Yeoman fit into a Visual Studio .NET workflow?

Tools such as Bower, Grunt and Yeoman have surged in popularity recently.
Whenever I've read about them or come across them in an article, I've dismissed them as tools used for Mac-based front-end devs or PC-based but not on the Microsoft stack - Sublime Text etc.
Visual Studio has NuGet, project templates, MSBuild, MSDeploy, TeamCity/TFS Azure etc. and I generally consider VS has being a very highly automated ecosystem (some say it makes us productive at a cost of understanding).
How are these tools being used by ASP.NET devs on VS?
Note: This is not an opinion-based question, I'm looking for real-world examples of how these tools are being used.
There is a Package Intellisense extension for Visual Studio which adds bower and npm package support
Grunt/Gulp launcher extension for launching grunt/gulp tasks
Read this awesome article written by Scott Hanselman for more info:
http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx
UPDATE:
These features are now fully integrated into Visual Studio 2015:
http://www.asp.net/vnext/overview/aspnet-vnext/grunt-and-bower-in-visual-studio-2015
Great tips from john papa:
http://www.johnpapa.net/get-up-and-running-with-node-and-visual-studio/
As per Scott Hanselman's blog posting, he says this about the reason why a VS dev might want support for these tools:
Some of you may ask, why not use NuGet for JavaScript? Why not extend
MSBuild for building CSS/JS? Simple. Because there's already a rich
ecosystem for this kind of thing. NuGet is great for server side
libraries (and some client-side) but there are so many more CSS and JS
libs on npm and bower. MSBuild is great for server-side builds but can
be overkill when building a client-side app.
So, use both. These are tools in your toolkit. Adding support for
Gulp, Grunt, Bower, npm (and other stuff, in the future if needed)
means a more familiar environment for front-end devs doing ASP.NET and
it opens the doors for ASP.NET devs to bring in the JS and CSS
libraries communities use every day.
Though I'd still be interested in other people's take on how these tools fit in to the 'workflow' of a VS developer. For example, "Before I installed Grunt, I wasn't able to easily... blah."
Update
I'll stick some updates in here as I learn things.
So, new learning no.1: Yeoman scaffolds front-end, client-side code. Whereas VS scaffolds server-side stuff and project templates (that don't change for months/years), Yeoman can help with boilerplate for fast-changing JS MV* frameworks, for example.
New learning no.2: the tooling is not ready for prime-time enterprise dev.
The first problem is that npm downloads dependent packages into nested subfolders and recurses this model exhaustively, so you end up with folder paths that are 100s of characters long. Windows and some tooling goes nuts. There are workarounds but its a serious flaw.
Latest Node and some added command line options now make this better behaved.
Developers running Windows are often in enterprise settings which means proxy filters and auth. For me, I needed to install Cntlm local proxy to get NPM and other tools to work via our proxy, which violates our IT policy, I just didn't tell them.
Some of NPMs packages seem to want to clone Git repos using SSH! Port 22 is not open; because the community is so Linux/Mac non-enterprise oriented, such issues arise because they're not a problem for so many creative-agency devs and then can hang around for months.
New learning no.3: how dynamically downloaded JS files end up as content in the project file and thus added to an MS Deploy package is still an unknown.
Update on learning 3, we created a build that just transformed the config files, then we used the MSDeploy command line to copy files individually to the destination server. Not something I'd do if I were working alone, it took weeks on and off, to automate all this.
With Bower updates are faster. Every time a new version or update is released we can easily find it in Bower. You no longer have to wait as we had to with NuGet.
So we could say that NuGet continues to be the king in the server side, but Bower is the new king of client-land.
Take a look in this post for more details and see a simple example:
http://nearsoft.com/blog/bower-and-asp-net-5-a-tutorial/
To answer the original question with a perspective from both enterprise and casual development...
History
Visual Studio has always been a standard development tool for efficiently building large-scale enterprise applications for Desktop, Mobile and Web. This included both client-side and server-side web applications built using Forms, MVC and the .NET Framework. Of course, what makes Visual Studio so appealing is the power behind it, which gives developers the ability to quickly generate, or scaffold, common solutions via project templates - allowing developers to focus on solving business problems.
For simple client-side web sites that use a few libraries and require minimal data interaction, a tool such as WebMatrix would often suffice due to being lightweight and able to serve up web sites with ease.
Many of those tools and technologies can be found at Microsoft /web.
Divergence
At the same time, there has existed a burgeoning Open Source community that has been developing many of the libraries and frameworks that have risen in popularity for building modern web sites and web applications.
For developers working with the "Microsoft Stack" of technologies, the gap was originally bridged by integrating NuGet into Visual Studio. Many, but not all, libraries and frameworks were available as NuGet packages; and there was plenty of support from Microsoft for working with these technologies. Microsoft had also created it's own open source mini-ecosystem called CodePlex to support development and sharing of projects, usually focused on their technology in some way.
Unfortunately, while the availability of technologies was fairly up to date for Microsoft developers, it had become more and more challenging to keep up because it wasn't just about the libraries and frameworks, but the workflow and the way these technologies were being made available, integrated and used.
Such workflows include:
client-side package management via Bower from Twitter
(Bootstrap, etc.)
node-based package management via NPM
client-side application scaffolding via Yeoman (e.g. generators for ASP.NET and knockout)
automated task running via Gulp and Grunt
pre-compiling CSS from either SASS or LESS
transpiling languages such as ES6 or TypeScript
testing (Jasmine, Karma, etc.)
bundling and deployment (Webpack, etc.)
Unfortunately, much of this is a manual process, such as identifying the right package for the job or writing different tasks that can eventually be run automatically. Each is truly a subject in and of itself! It's not uncommon to end up simply looking up a package or command for something that in the end could - and Visual Studio developers would say should - be automated.
Convergence
Microsoft has been slowly moving from not only supporting open source development but embracing it. It has made many of its core technologies available to the open source community via GitHub, as well as it's own .NET Foundation movement.
A major effort to converge by Microsoft was to introduce Visual Studio Code for multiple platforms - offering a simplified development experience that caters to the workflow that has become popular with the open source community.
Still, Visual Studio Code can be viewed as a major step back for developers used to much of the power and simplicity offered through Visual Studio through its automation of tasks and project templates. Microsoft introduced Web Essentials for 2010 and 2013 editions to keep up; but as many have observed, this was simply more of an effort to show support rather than a full integration into developer workflow.
Behind the scenes, Microsoft was looking to put it's .NET Framework on other platforms and established .NET Core. As of Visual Studio 2015 - specifically Update 3 and Node Tools - there is much deeper support for the open source development workflow with integration of NPM and Bower, as well as task running. These still require manual intervention but it's on par with the workflow outside of Visual Studio. It still feels foreign, but it's getting there.
The Future
With all that Microsoft has invested, it is clear that the next step is to bring together much of the steps taken to embrace open source development by providing a more visual and automated experience to Visual Studio Developers. This will include templates that generate rich web applications which not only have all of the necessary packages and dependencies defined, but the ability to bundle for distribution.
In the meantime, I think this is a great time for Visual Studio developers to get a feel for the current workflow, if just to appreciate how "the other guys" have been doing it. It won't be long before much of it will be simply a click away.

upgrading asp.net mvc apps

Upgrading MVC apps done with VS 2010 has been the biggest issue for me. I have an application that I use to run various websites and I maintain and develop this application separetely then upgrade the sites based on it. A lot of things might change during development of a new version - new Views, new Controllers, stuff added into JS files, updated stylesheets etc.
I've searched around the web but nothing useful came up besides this Haack's article but no source code is available.
I also tried making a Nuget package for the entire MVC app and while this works, it doesn't package up the resource files (an issue within Nuget itself) and my apps rely on those so until this is fixed I cannot use this method.
I checked how others do it and this pretty much summarizes Umbraco's way and it's the same painful way of a dozen of steps like I do it now.
Do you have any good advice on it?
You don't specify the target OS, but I create native packages, i.e. .deb for Ubuntu servers.
However this still means you need to specify all files, manage configuration, upgrade database schemes. But if you test this on a CI server it becomes more reliable, and you can do it iteratively. This is all part of good deployment practice. I can recommend the Continuous Delivery book.

Resources