Skip to content

View Components from a Class Library compilation after changes. #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
artiom-matusenco opened this issue Jan 18, 2017 · 14 comments
Closed

Comments

@artiom-matusenco
Copy link

Hi,
I have implemented embed view as is described in this article: http://www.davepaquette.com/archive/2016/07/16/loading-view-components-from-a-class-library-in-asp-net-core.aspx

The problem is that when I change embed view file .net compiler does not detect changes in the view.
The view is compliled only if I manually start rebuild process or do some changes in c# code (for example in controller).

@valentin78
Copy link

I have similar issue

@Tratcher
Copy link
Member

@NTaylorMullen

@dpaquette
Copy link
Contributor

dpaquette commented Jan 19, 2017

I do remember encountering a compiler bug where the compiler did not recognize changes to the view file and did not update the embedded resource. I had assumed this was fixed by now but I guess not.

@valentin78
Copy link

valentin78 commented Jan 19, 2017

I do remember encountering a compiler bug where the compiler did not recognize changes to the view file and did not update the embedded resource. I had assumed this was fixed by now but I guess not.

can you find this bug report?

@NTaylorMullen

what this meaning?

@dpaquette
Copy link
Contributor

@valentin78 The only but report I can find is this one aspnet/dnx#3396 but it is referencing the old dnx tooling which is no longer being used.

@Ponant
Copy link
Contributor

Ponant commented Jan 21, 2017

@dpaquette , I also looked at your blog and I like your suggestion about plugins. However, any idea on how to include the cshtml files as embedded resources in the class library with .Net Core 1.1 which has csproj instead of project.json? That will be great because I am blocked for now.

@Ponant
Copy link
Contributor

Ponant commented Jan 23, 2017

That worked with csproj
<EmbeddedResource Include="Views/**/*.cshtml" />

EDIT: The EmbededResource seems to be no more needed in the latest update as it is included by default.

@valentin78
Copy link

csproj

as I understand, by extension, you use VS2017 ? Possible this issue appears only in VS2015

@pranavkm
Copy link
Contributor

@dpaquette \ @valentin78, the CLI had a similar issue - https://github.com/dotnet/cli/issues/3176 where the application does not rebuild when content files change. According to the work item, the issue is no longer reproducible with the MSBuild tooling. So yes, the issue should not appear once the project retargets VS 2017.

@Ponant
Copy link
Contributor

Ponant commented Jan 24, 2017

@valentin78 , correct I am using VS 2017, buggy but funny IDE! However, I also need to recompile the project to make it work, but it works.

@valentin78
Copy link

valentin78 commented Jan 25, 2017

I understand, thank you all
for VS2015 now I made crutch, PS script, which watch for *.cshtml files changed, created and so on, and change LastWriteTime for project.json file, this will lead to recompile
I paste here my script, maybe someone will be useful


$global:Folder = "E:\Projects\MyProject"

### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "$global:Folder"
    $watcher.Filter = "*.cshtml"
    $watcher.IncludeSubdirectories = $true
    $watcher.EnableRaisingEvents = $true  

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
    $action = { 
				$file = "$global:Folder\project.json"
				(Get-Item -Path $file).LastWriteTime = Get-Date
              }    
### DECIDE WHICH EVENTS SHOULD BE WATCHED 
    Register-ObjectEvent $watcher "Created" -Action $action
    Register-ObjectEvent $watcher "Changed" -Action $action
    Register-ObjectEvent $watcher "Deleted" -Action $action
    Register-ObjectEvent $watcher "Renamed" -Action $action
	
    while ($true) {sleep 1}

my be someone can help me, how I can point multiple filters with one watcher?

@aspnet-hello
Copy link

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

@davidalpert
Copy link

davidalpert commented Dec 30, 2017 via email

@davidalpert
Copy link

davidalpert commented Dec 30, 2017 via email

@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants