-
Notifications
You must be signed in to change notification settings - Fork 121
Class Libraries don't support new Razor in VS2017 #1013
Comments
This is now tracked in TFS 393058 https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=393058 |
As a temporary workaround, you can change the project Sdk to Web. Edit your .csproj within VS'17 and change Maintain your Target framework as .NETStandard 1.6 if you're using it and be sure to set the Output type to Class library. You will get tag helpers intellisense, despite no highlight as described in this known issue. |
I'd be curious to hear of people's success with @ByteNuts' workaround. I can foresee issues with class libraries that are only desktop but otherwise i'd think it'd work. |
@NTaylorMullen, I remember trying @ByteNuts's workaround before I landed on this issue but the compilation broke. As far as I can recall, it complained that a project using the Web SDK should contain a However, changing the Output Type to Class Library as per @ByteNuts's suggestion seems to have fixed that build-time exception. Out of curiosity, as you said, the workaround applies to web projects only and could cause issues with desktop-only libraries. Why would you use a library that implements Razor views for a desktop-only library? I am seriously asking to hear if there is a use case for that approach. |
In new world, not really a reason to have a desktop-only library. However, it happens, usually when migrating an old library to the new world. |
I see your point. Thank you. |
any update on this? I have updated to VS 2017 Preview 15.3 and .NET Core 2.0.0 preview 1. But it doesn't work. |
We're looking into this for 15.3 preview2 |
@NTaylorMullen fixed for preview2 right? |
Yup! |
Ok, thanks everyone for reporting this issue. This will be fixed in VS 2017 15.3-preview 2. If you have further issues with tooling for Razor please report them via VS Feedback or on aspnet/Razor |
I just have got version 15.3.2 and this is not fixed. |
The projects are not public. These are company projects and I cannot share
them. I can send you maybe a few screenshots of where the errors show up.
On Aug 23, 2017 6:22 PM, "alexgav" <notifications@github.com> wrote:
Hi Filip,
Do you have a repro project we could take a look at?
Thanks,
Alex
Sent from Outlook<http://aka.ms/weboutlook>
…________________________________
From: Filip Witkowski <notifications@github.com>
Sent: Wednesday, August 23, 2017 2:03:12 PM
To: aspnet/Tooling
Cc: Subscribed
Subject: Re: [aspnet/Tooling] Class Libraries don't support new Razor in
VS2017 (#1013)
I just have got version 15.3.2 and this is not fixed.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://na01.safelinks.
protection.outlook.com/?url=https%3A%2F%2Fgithub.com%
2Faspnet%2FTooling%2Fissues%2F1013%23issuecomment-324461744&data=02%7C01%
7Calexgav%40microsoft.com%7C29ee34ba73214a85afe908d4ea6a5e5e%
7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391189954097963&sdata=M2u82%
2BC48RizwcuZXz1nuahbkaAvzU7%2BnYn446lhPgM%3D&reserved=0>, or mute the
thread<https://na01.safelinks.protection.outlook.com/?url=
https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-
auth%2FABxv6H0f5DPznBe-zKYh6p6SiSvHQa7Pks5sbJOQgaJpZM
4MXQbE&data=02%7C01%7Calexgav%40microsoft.com%7C29ee34ba73214a85afe908d4ea6a
5e5e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391189954097963&sdata=
SqrQaiaIkSV3TagGfvRZT96NX8QPW7TrMV6A%2FKkGJQ4%3D&reserved=0>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1013 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABu1ddo9xNZpVhNAphnws8h3c1bk5aNAks5sbKYpgaJpZM4MXQbE>
.
|
Could you try creating a library project similar to your company ones? And/or taking one of the projects, deleting all files, adding a Razor view, and sharing that? The actual project file is pretty important and would be great to take a look at. The code in the project files doesn't matter that much.
Sent from Outlook<http://aka.ms/weboutlook>
…________________________________
From: Filip Witkowski <notifications@github.com>
Sent: Wednesday, August 23, 2017 5:18:11 PM
To: aspnet/Tooling
Cc: Alex Gavrilov; Comment
Subject: Re: [aspnet/Tooling] Class Libraries don't support new Razor in VS2017 (#1013)
The projects are not public. These are company projects and I cannot share
them. I can send you maybe a few screenshots of where the errors show up.
On Aug 23, 2017 6:22 PM, "alexgav" <notifications@github.com> wrote:
Hi Filip,
Do you have a repro project we could take a look at?
Thanks,
Alex
Sent from Outlook<http://aka.ms/weboutlook>
________________________________
From: Filip Witkowski <notifications@github.com>
Sent: Wednesday, August 23, 2017 2:03:12 PM
To: aspnet/Tooling
Cc: Subscribed
Subject: Re: [aspnet/Tooling] Class Libraries don't support new Razor in
VS2017 (#1013)
I just have got version 15.3.2 and this is not fixed.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://na01.safelinks.
protection.outlook.com/?url=https%3A%2F%2Fgithub.com%
2Faspnet%2FTooling%2Fissues%2F1013%23issuecomment-324461744&data=02%7C01%
7Calexgav%40microsoft.com%7C29ee34ba73214a85afe908d4ea6a5e5e%
7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391189954097963&sdata=M2u82%
2BC48RizwcuZXz1nuahbkaAvzU7%2BnYn446lhPgM%3D&reserved=0>, or mute the
thread<https://na01.safelinks.protection.outlook.com/?url=
https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-
auth%2FABxv6H0f5DPznBe-zKYh6p6SiSvHQa7Pks5sbJOQgaJpZM
4MXQbE&data=02%7C01%7Calexgav%40microsoft.com%7C29ee34ba73214a85afe908d4ea6a
5e5e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391189954097963&sdata=
SqrQaiaIkSV3TagGfvRZT96NX8QPW7TrMV6A%2FKkGJQ4%3D&reserved=0>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1013 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABu1ddo9xNZpVhNAphnws8h3c1bk5aNAks5sbKYpgaJpZM4MXQbE>
.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faspnet%2FTooling%2Fissues%2F1013%23issuecomment-324497503&data=02%7C01%7Calexgav%40microsoft.com%7C3ca7887a0e7449997ac708d4ea859b71%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391306942834314&sdata=0DZrmfXiSG7u800kpduxqirUVkaLWFH2Hm6auC%2BhwHk%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABxv6AFydonbIS091_xR17N8aZp2gmrqks5sbMFCgaJpZM4MXQbE&data=02%7C01%7Calexgav%40microsoft.com%7C3ca7887a0e7449997ac708d4ea859b71%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636391306942834314&sdata=a8%2BRJFfciNAb56fVHFAuVMvyvv0FZJpXrey5i9RoHFw%3D&reserved=0>.
|
I still see many errors in views (but no errors on build) Or many more. |
To report new issues, use the Report a Problem tool. The GitHub Issue Tracker for the aspnet/Tooling repo is now deprecated in favor of the Report a Problem tool. If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See here for more details. |
@NTaylorMullen @alexgav , is this a known issue? |
Looking at the above, my guess is that it's getting the wrong set of namespace imports, possibly because it's falling back to the Razor (non-core) editor. |
@fwitkowski could this be your issue? aspnet/Razor#1628 Are tag helpers working? |
Repro:
Clone https://github.com/OrchardCMS/Orchard2 on master
Open VS2017
Edit Orchard2\src\Orchard.Cms.Web\Modules\Orchard.Menu\Views_ViewImports.cshtml
Expected:
/cc
@NTaylorMullen
@BillHiebert
@ToddGrun
@DamianEdwards
The text was updated successfully, but these errors were encountered: