I'm getting this error. While opening classdiagram.cd file
使用以下方法手动创建的classdiagram.cd文件:
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
在vs 2017社区
Microsoft.CSharp.DesignTime.targets文件 (C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ MSBuild \ Microsoft \ VisualStudio \ Managed \ Microsoft.CSharp.DesignTime.targets):
<!--
This file contains Visual Studio and designer-related properties and items for C# projects.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.Managed.DesignTime.targets" />
<!-- Properties -->
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<AppDesignerFolder Condition="'$(AppDesignerFolder)' == ''">Properties</AppDesignerFolder>
<AppDesignerFolderContentsVisibleOnlyInShowAllFiles Condition="'$(AppDesignerFolderContentsVisibleOnlyInShowAllFiles)' == ''">false</AppDesignerFolderContentsVisibleOnlyInShowAllFiles>
<LanguageServiceName Condition="'$(LanguageServiceName)' == ''">C#</LanguageServiceName>
<LanguageServiceId Condition="'$(LanguageServiceId)'==''">{694DD9B6-B865-4C5B-AD85-86356E9C88DC}</LanguageServiceId>
<TemplateLanguage Condition="'$(TemplateLanguage)' == ''">CSharp</TemplateLanguage>
<AddItemTemplatesGuid Condition="'$(AddItemTemplatesGuid)' == ''">{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}</AddItemTemplatesGuid>
<!-- Turn off rules and capabilities that are defined in MSBuild so that we can import our own below -->
<DefineCSharpItemSchemas>false</DefineCSharpItemSchemas>
</PropertyGroup>
<ItemGroup>
<PropertyPageSchema Include="$(ManagedXamlResourcesDirectory)CSharp.ProjectItemsSchema.xaml;"/>
<ProjectCapability Include="CSharp;Managed;ClassDesigner"/>
</ItemGroup>
<!-- Targets -->
<!-- Returns Csc command-line arguments for the language service -->
<Target Name="CompileDesignTime"
Returns="@(_CompilerCommandLineArgs)"
DependsOnTargets="_CheckCompileDesignTimePrerequisite;Compile"
Condition="'$(IsCrossTargetingBuild)' != 'true'">
<ItemGroup>
<_CompilerCommandLineArgs Include="@(CscCommandLineArgs)"/>
</ItemGroup>
</Target>
</Project>
答案 0 :(得分:4)
有bug in one of the files阻止您在.Net Core项目中使用类图。您现在可以应用手动修复。打开文件C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets
(或安装它的任何位置)并更改此行:
<ProjectCapability Include="CSharp;Managed"/>
到此:
<ProjectCapability Include="CSharp;Managed;ClassDesigner"/>
现在重新启动Visual Studio并重试。