7
votes

I have a very simple .NET Core Web Application (.NET Framework) created with Visual Studio 2015 Update 3 that builds without errors.

I can publish on file system with x64 profile. However when trying to publish with target runtime "win7-x86" gives de following error:

Could not find a part of the path 'c:\Users\Developer\Documents\Visual Studio 2015\Projects\SelfHostTest\src\SelfHostTest\bin\Release\net452\win7-x86\SelfHostTest.exe'

I use a Windows 8.1 x64 machine. I went to "Configuration Manager" and changed "Platform" from "Any CPU" to "x86" but didn't work.

I noticed there's a folder "src\SelfHost2\bin\Debug\net452\win7-x64" but nothing I do creates a structure for x86.

This publish works:

enter image description here

This publish does not work:

enter image description here

Here's my project.json in order to help someone helps me.

{
  "dependencies": {
    "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.Server.WebListener": "0.1.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"
  },

  "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": {
    "net452": {
      "dependencies": {
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimes": {
    "win7-x64": {},
    "win7-x86": {}
  },

  "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%" ]
  },

  "commands": {
    "http": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
  }
}
1

1 Answers

9
votes

This is a bug in tooling. It will always build for the default RID (and AFAIK there is no way to change it) but then in the publish dialog you see all the RIDs from the project.json and if you select a non-default one publishing will fail since the project was not build for this RID. Try building from command line using the RID you want to publish. This way when you are publishing VS will be able to find binaries and publish should work.