I have a ASP.Core RC2 project (.NET 4.5.1 framework is used) that should be deployed on Azure as x86 Web-Site.
On Publish Setting tab in VS there are the following values:
Target Framework: .NET Framework 4.5.1
Target Runtime: Inferred Runtime (win7-x64)
What I want to change is the value of "Target Runtime" to x86 platform, but this combobox is inactive (grey).
Current project.json:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"buildOptions": {
"emitEntryPoint": true
},
"frameworks": {
"net451": { }
},
"publishOptions": {
"include": [
"appsettings.json",
"project.json",
"web.config",
"NlogWeb.config"
]
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-*",
"imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
}
},
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
}
When you're developing self-contained applications, you have to add all required runtimes to the project.json file, so that nuget/dotnet restore can download the runtime files on restore.
Adding the win7-x86 runtime to the project.json should do the trick.
"runtimes": {
"win7-x64": { },
"win7-x86": { }
}
When you target portable apps, you don't need the runtimes section but you have to install the runtime yourself on the target machine. See .NET Core App Types documentation for a more detailed description on how portability types work and are configured.
Related
My VSCode settings (workspace settings in my case) are setup to use bash as the default terminal:
{
"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\bash.exe"
}
I need this to be able to debug my app.
My tasks.json looks like that:
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "./tsconfig.json",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
So when I try to build my project / run the build task (i.e. Ctrl + B), I get the following error:
> Executing task: tsc -p "c:\PATH_TO_MY_PROJECT\tsconfig.json" <
error TS5058: The specified path does not exist: 'c:\PATH_TO_MY_PROJECT\tsconfig.json'.
The terminal process terminated with exit code: 1
If I disable bash in my settings an use the default Windows terminal, the build works fine.
I remember it working few VSCode updates ago, but it stopped working in the latest VSCode versions. Not sure how that's related.
I tried to fix this for a while, but finally gave up on the built-in Typescript task and instead just used a custom task:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Typescript watch",
"type": "shell",
"command": "tsc --watch",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
"$tsc"
]
}
]
}
Description
I want to run a .net core NUnit test with the vstest.console.
This is working fine but I want to pass to the "dotnet test" execution a parameter, in my case "--no-build"
How I can parse this parameter to the dotnet execution? I have not found the right runsettings variable
Steps to reproduce
vstest.console.exe " "project.json" /UseVsixExtensions:true /Settings:settings.runsettings
Expected behavior
["C:\Program Files\dotnet\dotnet.exe" test "project.json" --port 55307 --no-build]
Actual behavior
["C:\Program Files\dotnet\dotnet.exe" test "project.json" --port 55307 ]
Environment
windows 7
project.json
{
"version": "1.0.0-*",
"dependencies": {
"NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3"
},
"testRunner": "nunit",
"frameworks": {
"netcoreapp1.0": {
"imports": "portable-net45+win8",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
}
}
}
}
}`
This was the answer from the vstudio develoment team
https://github.com/Microsoft/vstest/issues/383
I wanted to build a simple .net core MVC app with a single class library for data access, to get an idea of what it takes to build/deploy/run Core on Linux. Not nearly as simple as I had hoped!
EDIT: Here's a copy of the solution, if anyone is interested:
https://s3.amazonaws.com/kilonova-public/code/CoreCrossPlatform.zip
I threw together a VirtualBox VM w/ Ubuntu Server 16.04 and installed dotnet core per these instructions:
https://www.microsoft.com/net/core#ubuntu
I installed all the latest, necessary bits on the host (Win10) for VS 2015 and created a solution with an MVC app and single class library called "DataAccess". It's EF Core talking to MySQL using their latest core provider. It all runs flawlessly on the Win10 host when I run/debug it. Pulls up data and looks great.
"dotnet --version" on both the host and the VM gives me:
1.0.0-preview2-003121
However, when I deploy it to the Ubuntu VM, I get the following error on the class library dependency:
Project corecrossplatform (.NETCoreApp,Version=v1.0) will be compiled because the version or bitness of the CLI changed since the last build
Compiling corecrossplatform for .NETCoreApp,Version=v1.0
/opt/dotnet/corecrossplatform/project.json(24,23): error NU1002: The dependency DataAccess does not support framework .NETCoreApp,Version=v1.0.
Compilation failed.
0 Warning(s)
1 Error(s)
Time elapsed 00:00:00.0187782
This happens whether I run "dotnet restore" or "dotnet run". To be perfectly honest, I'm not even sure I'm deploying this thing correctly. Documentation is spotty and I'm making some guesses. I copied everything from the project folder "src\CoreCrossPlatform" (contains bin, Program.cs, appsettings.json, etc.) onto the VM and this is where I'm executing the "dotnet" commands from, in the VM.
The DataAccess .json file:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.0.0",
"MySql.Data.Core": "7.0.4-IR-191",
"MySql.Data.EntityFrameworkCore": "7.0.4-IR-191",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
}
}
The MVC project.json:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"DataAccess": "1.0.0-*"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Something to note: When I run the sample project using "dotnet new" and restore, run vis the tutorial link above, it runs fine.
What am I missing? Another side question: What's the best way to publish this type of app to a Linux box? Am I even close on that part?
Thanks much.
EDIT: While kicking this dead horse all afternoon, I compared some notes I found online, related to this "NU1002" error, and the sample project "dotnet new" generates. I tried changing the "framework" section of both project.json files (MVC and classlib) to the following, with no success...same error:
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": [
"dnxcore50",
"dotnet5.6",
"portable-net45+win8"
]
}
}
EDIT: Much thanks to goaty: As he pointed out in the comments, copying over the entire solution and building it, results in a successful build. However, I cannot run it without an error. It doesn't seem to restore the MySQL EF Core dependency:
Project CoreCrossPlatformFlat (.NETCoreApp,Version=v1.0) will be compiled because the version or bitness of the CLI changed since the last build
Compiling CoreCrossPlatformFlat for .NETCoreApp,Version=v1.0
/opt/dotnet/corecrossplatform/src/CoreCrossPlatformFlat/project.json(25,52): error NU1001: The dependency MySql.Data.EntityFrameworkCore >= 7.0.4-IR-191 could not be resolved.
Compilation failed.
0 Warning(s)
1 Error(s)
The DataAccess library exists outside of your src/ directory. Therefore the web project could not find the reference.
I recommend this structure
src/
|---DataAccess/
|---CoreCrossPlatform/
Hope that helps :)
I have an ASP.NET Core app which is running fine locally.
However, when I publish (Web Deploy) the site to Azure, I get a 403: You do not have permission to view this directory or page.
I have a default controller and a route defined in Startup.cs:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}",
defaults: new { controller = "Home", action = "Index" });
});
The folder structure after web deploy to Azure looks like:
|_ home
|_ site
|_ wwwroot (contains DLL's and files specified through 'publishOptions' in project.json)
|_ wwwroot (the contents of the 'wwwroot' folder I have in Visual Studio)
|_ Views (contains MVC views)
|_ refs (contains referenced DLLs, I think?)
Any idea of what I should look for in project.json or the Kudu portal to figure out what's wrong?
My project.json file:
{
"title": "My Web App",
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": [ "bin/**", "obj/**", "node_modules/" ]
}
},
"publishOptions": {
"include": [ "wwwroot", "Views", "appsettings.json", "appsettings.*.json" ]
},
"scripts": {
"prepublish": [ "jspm install", "gulp build" ]
},
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"System.IO.FileSystem": "4.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
},
"imports": "dnxcore50"
}
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://*:8000/"
}
}
Edit:
For one, I was missing the Microsoft.AspNetCore.Server.IISIntegration NuGet package. When I added it, I also got a web.config file in the site root (which I included through project.json).
I also added .UseIISIntegration() to my WebHostBuilder in Startup.cs:
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseIISIntegration() // This was missing
.Build()
.Run();
}
I can now run it on IIS Express locally (although I guess it's IIS fronting Kestrel?), but when published to Azure I get error:
HTTP Error 502.5 - Process Failure
The event log in Azure states: Failed to start process with commandline '"%LAUNCHER_PATH%" %LAUNCHER_ARGS%', ErrorCode = '0x80070002'.
According to the documentation, the troubleshooting step is:
If the server does not have Internet access while installing the server hosting bundle, this exception will ensue when the installer is prevented from obtaining the Microsoft Visual C++ 2015 Redistributable (x64) packages online. You may obtain an installer for the packages from the Microsoft Download Center.
Not sure how this applies to Azure, though?
The problem came from insufficient IIS integration/configuration.
I had to add the following to project.json:
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
}
I also added a postPublish script for IIS publishing:
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
I also added the Microsoft.AspNetCore.Server.IISIntegration NuGet package:
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0"
}
This created a web.config file, which I had to modify as:
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\My.Web.App.dll" arguments="" forwardWindowsAuthToken="false" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" />
</system.webServer>
</configuration>
Finally I added UseIISIntegration to my WebHostBuilder:
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseIISIntegration() // This was missing
.Build()
.Run();
}
A standard Publish (Web Deploy) from Visual Studio and the website started just fine on Azure (although in my case I also had to add a prepublish script for some Gulp tasks).
I can't seem to be able to deploy my asp.net core RC2 app to Azure when I target the net451 or net46 framework.
When I try to reach my application I get the following error
The specified CGI application encountered an error and the server terminated the process.
Everything works when I deploy to my local IIS.
The Azure logger gives me
Failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%', Error Code = '0x80070002'.
I tried replacing %LAUNCHER_PATH% for dotnet and %LAUNCHER_ARGS% for myapp.exe in the web.config but still the same error occur.
Here is my project.json
{
"dependencies": {
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
},
"frameworks": {
"net46": {}
},
"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%" ]
}
}
Thanks
It seems that updating my web.config to specify the processPath did the trick.
I also had to delete the previous publish attempts for it to work properly.
<aspNetCore processPath=".\myapp.exe" arguments="" forwardWindowsAuthToken="false" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout"/>
With the same symptoms I checked the logs as #Pawel suggested.
The logs contained FileNotFoundException which was resolved by adding two dependencies to project.json.
"dependencies": {
...
"System.IO.FileSystem.Watcher": "4.0.0-rc2-24027",
"System.IO.FileSystem": "4.0.1-rc2-24027"
},
The issue is reported here
Azure doesn't support net461 and use better net451.
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
Publishing SkyIsTheLimit for .NETFramework,Version=v4.5.1/win7-x64