C# csproj中引用外部文件的方法
在添加现有项对话框中,选中文件后,不要直接点击“添加”,可以注意看,添加 按钮旁边有个小三角下拉菜单,选择其中的添加为链接即可:
在csproj文件中,大概是下面这样,因此也可以手动编辑csproj添加:
<ItemGroup> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\BooleanExtensionObject.cs" Link="Models\BooleanExtensionObject.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\DynamicVisibilityObject.cs" Link="Models\DynamicVisibilityObject.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\LoginInfo.cs" Link="Models\LoginInfo.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\ScriptableObject.cs" Link="Models\ScriptableObject.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\ScriptableOptions.cs" Link="Models\ScriptableOptions.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\SimpleObject.cs" Link="Models\SimpleObject.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\TestObject.cs" Link="Models\TestObject.cs" /> <Compile Include="..\Avalonia.PropertyGrid.Samples\Models\Vector3.cs" Link="Models\Vector3.cs" /> </ItemGroup>