Create Integration Test Project into ASP.NET Core application - asp.net-core

I have created an ASP.NET Core WebApi project. Trying to add Integration Test Project following Integration tests in ASP.NET Core article.
According to the sample project, I have added another web application for the Test project and configured like the sample project. Then I deleted the program.cs and startup.cs files.
But when I build the project got the following error:
Error CS5001 Program does not contain a static 'Main' method suitable
for an entry point
My folder structure is like this:

Related

Unable to build .net core AspnetBoilerplate Starter Template

I have spent quite a time trying to load the Initial Project generated by the AspnetBoilerplate startup template all to no avail. This is a .net core template (JQuery with MVC) with Target Cross platform.
See error sample below
I installed the dotnet core 2 for VS 2017. The project won't just build. I can not see anything related to NetStandard, yet that seems to be what the project supports
Any help i can get will be appreciated

ASP.NET Core 1.1 Identity dependencies and all Data Access in a separate class library project

I have extracted most of the Database related code from an ASP.NET Core Web Application project with Individual User Accounts, ie. Identity into an ASP.NET Class Library project. I am now stuck in the final pieces which is to remove the concrete assignment to EF Core and moving the connection strings to the Data project.
Here is what I have done so far:
Created a blank solution
Created an ASP.NET Core web
application (TestPatterns.Web) with Individual User Accounts
Updated all the Nuget packages
Created a Class Library Core
package
In the Class Library Project (TestPatterns.Data) Nuget ->
Removed the NetStandard Library 1.6, replaced with
Microsoft.NetCore.App 1.1.0
In the Class Library Project (TestPatterns.Data), added all the EF and
Identity Nuget Packages
Moved over of the 'Data' folder from the
Web application to the class library project
Moved over the
ApplicationUser.cs file from the Web Application to the class
library project folder Models
I end up with a structure like this:
To run a migration I execute the following on the Data project folder:
dotnet ef --startup-project ../TestPatterns2.Web migrations add first
Looking for some help on removing all dependencies of EF Core 1.1 from the Web project and moving the connection strings over. Also, would the DI remain in the Web project or should that move to the Data project also? If so, how?

ASP.NET Core publish fails when referencing other project

I'm evaluating Visual Studio 2017 RC for our next project and ran into some issues. For the real project I have a web frontend and a Windows service which use the same shared library for database stuff (and more). All projects are based on the classic .NET Framework 4.6.2. Deployment will be on an on-premise Windows Server.
I created a minimal example as follows:
Create a solution with ASP.NET Core (.NET Framework) project MyTest.Web.
Add classic desktop class library MyTest.Shared.
Reference MyTest.Shared in projects MyTest.Web.
Add code reference to MyTest.Shared by adding something like var c = new MyTest.Shared.Class1() to the web project.
Developing works like a charm: Building, starting and debugging the project is no problem. But I just can't publish the project. If I use the Publish entry from the project's context menu, I get the following error:
Program.cs(7,21): Error CS0234: The type or namespace name 'Shared' does not exist in the namespace 'MyTest' (are you missing an assembly reference?)
According to the full console output, there is another build using csc, but apparently it doesn't know about my shared project.
If I use dotnet publish -c Release to publish the project, I get the following error:
error MSB4057: The target "GetCopyToPublishDirectoryItems" does not exist in the project.
So in this case, the library seems to be referenced and built correctly, but there is another error. (full console output)
I think referencing other projects is something very essential, so why doesn't it work? Did I forget something?
My .NET CLI version is 1.0.0-preview3-004056.

asp.net core project occurs MissingMethodException

I create a new project with ASP.NET Core Web Application(.NET Core).
And it can work after building and running it.
I create a class library with .NET Core and move the files under Service folder in the web project to the library, then add the reference and change namespace in the controllers.
It occurs MissingMethodException after registering a new user.
Asp.net core project seems not able to use class library outside the web project.
The detailed message is as the below.
In ASP.NET Core , everything is in form of nuget packages, hence you might have to create nuget package from the class library and then add it to the current solution.
Hope this information helps.

Minifying and Including js and css files on Azure Project

I'm using YUI Compressor as a MsBuild Task on my Azure project. It works well on locally but when I try to publish it I cannot insert minified packages to my azure application package. Although I have tried a lot of things about package modifying on my .csproj file I couldn't work it out. How can I do this?
Edit:
My project is not a MVC or Webforms application. Just HTML and Javascript inside of an ASP.NET project. My problem is not minification. It is just placing minified external files in Azure Package when publishing it but if there is any other method that solves this azure problem, I can change YUI Compressor with ajaxmin or google closure... doesn't matter.
I don't think modifying the service package is supported (you are also modifying the manifest). That's why I would look at it from an other perspective. I'm assuming you have such a setup:
Solution
Empty ASP.NET Project
Index.html
App.js
Now, after you compile (and the MSBuild task runs) you'll have something like this:
Solution
Empty ASP.NET Project
Index.html
App.js
App.min.js (not included in the project, but available on the file system)
Now, buy simply including the App.min.js file in the project, it will be included in the service package when packaging or publishing your application. And besides that, the MSBuild tasks runs each time you compile, meaning the file will be updated before each time the application is packaged.
As you haven't specified about about whether it is WebForms or MVC, I would like to point out the out of the box support for the bundling and minification in ASP.net MVC4. Scott Gu has explained it the MVC4 preview demo.
You can also tweek it to work a way for that in ASP.net MVC3 too. Once this is achieved, you can achieve that in Azure as well.
Additional Articles :
ASP.NET MVC4 bundling in ASP.NET MVC3
New in ASP.NET MVC4: Bundling and Minification