Intellij Idea 无法找到要放入Rider Razor项目的声明

fquxozlt  于 2023-01-16  发布在  其他
关注(0)|答案(1)|浏览(221)

我克隆了一个包含. cshtml和DLL文件的存储库,但当右键单击+ctrl显示上面的消息时,很难产生效果,而且没有任何结果。
当试图从C#方法中获取建议时,智能感知也不起作用。
我曾尝试通过单击"使缓存无效"或删除. idea文件夹来清除缓存,但没有效果。
不知道我该怎么做才能让它工作。
谢谢你的帮忙
我尝试添加一个. csproj文件到项目,当构建解决方案时,我得到这个错误:
"前端模板. csproj:[MSB4057]项目中不存在目标"Build"。
在尝试构建所有内容之前,我将原始文件更改为最小文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')"/>
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<PropertyGroup>
    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    <RootNamespace>MyProject</RootNamespace>
    <AssemblyName>MyProject</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp"/>
<Reference Include="System"/>
<Reference Include="System.Data"/>
<Reference Include="System.Drawing"/>
<Reference Include="System.Web.DynamicData"/>
<Reference Include="System.Web.ApplicationServices"/>
<Reference Include="System.ComponentModel.DataAnnotations"/>
<Reference Include="System.Core"/>
<Reference Include="System.Data.DataSetExtensions"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Web"/>
<Reference Include="System.Web.Extensions"/>
<Reference Include="System.Web.Abstractions"/>
<Reference Include="System.Web.Routing"/>
<Reference Include="System.Xml"/>
<Reference Include="System.Configuration"/>
<Reference Include="System.Web.Services"/>
<Reference Include="System.EnterpriseServices"/>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
    <HintPath>packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
    <Private>True</Private>
    <HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
    <HintPath>packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
    <Private>True</Private>
    <HintPath>packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
    <Private>True</Private>
    
<HintPath>packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
    </Reference>
</ItemGroup>
<ItemGroup>
    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
    <HintPath>packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>

xsuvu9jc

xsuvu9jc1#

Workarounds from RIDER-87113中的一个是否有帮助?
第一个是简单地防止导入目标,如果他们不在. csproj文件:

<Import Project="..\..\Microsoft.WebApplication.targets" Condition="Exists('..\..\Microsoft.WebApplication.targets')" />

与上面的示例类似,但具有. targets的项目路径的特定。
另一种方法是尝试使用本机安装程序(以及workaround from RIDER-87113)从Visual Studio安装Web组件:
1.在VS安装程序中选择一个Visual Studio示例,点击"修改";
1.在打开的窗口中,选择"Workloads"选项卡中的"ASP.NET和Web开发"并安装;
1.安装后,在附件中的 * 设置下|构建、执行、部署|工具集和构建从安装此工作负载的Visual Studio中选择 * MSBuild;
1.尝试加载并生成项目。

相关问题