question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet run not updating changed files in wwwroot to bin\Debug\net452\win7-x64\wwwroot folder

See original GitHub issue

Steps to reproduce

  1. ASP.Net Core RC2 App with below project.json.
  2. use dotnet restore and then dotnet run. Check wwwroot under bin folder, all files are copied…
  3. Now change a file in wwwrooot or appsettings..json. Repeat dotnet run.
  4. Check wwwroot folder for Updated files. They are not updated.

Observation: C# code is getting updates, I mean DLL’s are getting updared. Only files are not getting updated.

{
  "userSecretsId": "aspnet5-Idp-149e9283-fb72-416b-bf12",
  "version": "1.0.0-*",
  "description": "My.Web Project",
  "authors": [ "IPPCS" ],
  "commands": {
    "web": "My.Web",
    "ef": "EntityFrameworkCore.Commands"
  },
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "copyToOutput": {
      "include": [ "wwwroot" ],
      "includeFiles": [ "appsettings.json", "web.config" ]
    },
    "compile": [
      "wwwroot",
      "node_modules"
    ]
  },
  "publishOptions": {
    "include": [ "wwwroot" ],
    "includeFiles": [ "appsettings.json", "web.config" ]
  },
  "dependencies": {
    "My.Repository": "1.0.0-*",
    "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-*",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-*",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-*",
    "Microsoft.NETCore.DotNetHostPolicy": "1.0.1-*",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0-rc2-*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-*",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-*",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-*",
    "Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-*",
    "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc2-*"
  },
  "frameworks": {
    "net452": { }
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-*",
      "imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
    }
  },
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  }
}

Expected behavior

On dotnet run Updated files in project’s wwwroot should be moved to bin\Debug\net452\win7-x64\wwwroot folder.

Actual behavior

Only old files are still persisting in bin\Debug\net452\win7-x64\wwwroot folder.

Environment data

Running on Win 10 machine with VS Community Update 2. Installed latest .Net Core from https://www.microsoft.com/net/core#windows

dotnet --info .NET Command Line Tools (1.0.0-preview1-002702)

Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e

Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
guardrexcommented, Jul 20, 2016

Indeed! https://github.com/dotnet/cli/issues/1614 is one of the most annoying problems in all of ASP.NET to me (#1614 is a 1.0.0-rtm bug that didn’t make the cut). If I change a view and I’m going to test published output, I have to open a .cs file and change a character in the file to force a compliation and thus force it to move the view into output so it will get picked up. Since they are moving to MSBuild/csproj fairly soon (within six months), I don’t see this getting fixed right now. I think we’ll have to wait for 1.0.2 or 1.1.0 or whatever they plan to call that release (the .NET Blog post isn’t clear on the version number, just the time-frame https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/ ).

The only other thing I can think of would be a Gulp watch task. That would keep an eye on files/folders and immediately move them when they are saved. That’s what I’m going to do next. I’m just going to put a Gulp watch on my Views folder. If I change a file there, Gulp will shoot it right into the published output for me.

0reactions
blackdwarfcommented, Jan 12, 2017

Just checked this against preview 4 tooling. Took the above project.json, fixed up the references and then migrated it over to csproj. Ran dotnet run and modified the CSS file and appsettings.json and after re-running dotnet run, both changes are available in the output folder.

With this, I will close this change. If this behavior repros on latest tooling, please reopen. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet run not updating changed files in wwwroot to bin\ ...
On dotnet run Updated files in project's wwwroot should be moved to bin\Debug\net452\win7-x64\wwwroot folder. Actual behavior. Only old files ...
Read more >
c# - .Net Core dotnet run is not running the last modified ...
I am working on Asp.Net Mvc project with .Net Core 2.2. I can not run the last modified source code from command line/powershell....
Read more >
static files in wwwroot is not served in asp.net core mvc 6
The files are in the build directory. This is weird as I assume all files in wwwroot folder should be served to public....
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code.
Read more >
dotnet watch command - .NET CLI
The dotnet watch command is a file watcher that runs a dotnet command when changes in source code are detected.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found