小编Ste*_*man的帖子

在不知道属性类型的情况下从属性和列表值中获取属性值

我想传递属性名称并返回值.这将是一个通用的util,它不会知道属性类型.

更新 如果有人需要这样做,这是实际的工作代码.我需要一种方法让核心代码解析属性而不知道它们是什么.

public void LoadPropertiesToGrid(BaseGridPropertyModel model)
{
    foreach (PropertyInfo prop in ReflectionUtil.FindPublicPropeties(model))
    {
        object editTyp = ReflectionUtil.GetPropertyAttributes(prop, "EditorType"); 
        object rowIdx = ReflectionUtil.GetPropertyAttributes(prop, "ColIndex");
        object name = ReflectionUtil.GetPropertyAttributes(prop, "Name");
        object visible = ReflectionUtil.GetPropertyAttributes(prop, "Visible");
        ConfigureColumn((string) name, (int) rowIdx, (bool) visible, (string) editTyp);
     }
}
[Serializable]
public class CanvasPropertiesViewModel : BaseGridPropertyModel
{
    [PropertiesGrid(Name = "TEsting Name 0", ColIndex = 0)]
    public string StringData1 { get; set; }

    [PropertiesGrid(Name = "TEsting Name 2", ColIndex = 2)]
    public string StringData2 { get; set; …
Run Code Online (Sandbox Code Playgroud)

c# reflection properties custom-attributes

8
推荐指数
1
解决办法
2万
查看次数

Azure DevOps VSTS .netcore构建失败,但在我的PC上运行正常

我在.net core2.1.1 MVC网站上不断收到依赖项错误。它可以从我的PC上正常运行。但是Azure DevOps无法正确编译参考。

添加一些图片以帮助解决此问题。 在此处输入图片说明 在此处输入图片说明

DevOps错误。在我将更新nuget添加到最新版本之后

抽象。直接从项目中引用该软件包即可解决此问题。CBW.Website(> = 1.0.0)-> Microsoft.VisualStudio.Web.CodeGeneration.Design(> = 2.1.5)-> Microsoft.VisualStudio.Web.CodeGenerators.Mvc(> = 2.1.5)-> Microsoft。 VisualStudio.Web.CodeGeneration(> = 2.1.5)-> Microsoft.Extensions.DependencyInjection(> = 2.1.1)-> Microsoft.Extensions.DependencyInjection.Abstractions(> = 2.1.1)CBW.Website(> = 1.0。 0)-> Microsoft.AspNetCore.App(> = 2.1.0)-> Microsoft.Extensions.DependencyInjection.Abstractions(> = 2.1.0)。)

软件包还原失败

***************编辑我在csproj中通过了基于nuget的错误并将所有内容都定位到2.1.5版。现在我回到还原错误。 在此处输入图片说明

我的Csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
     <RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
    <UserSecretsId>aspnet-AspNetCorePagesIdentity-***************-***-*******-</UserSecretsId>
    <TypeScriptToolsVersion>3.0</TypeScriptToolsVersion>
    <AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Client\assets\controlbyweb-logo.png" />
    <Content Include="Client\assets\webrelay_170.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.5" PrivateAssets="All" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Areas\Identity\Services\" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="Client\_ViewImports.cshtml">
      <Pack>$(IncludeRazorContentInPack)</Pack>
    </Content>
  </ItemGroup>


</Project>
Run Code Online (Sandbox Code Playgroud)

****错误**

2018-10-08T14:44:09.2159846Z   Restoring …
Run Code Online (Sandbox Code Playgroud)

c# azure-devops asp.net-core azure-pipelines

6
推荐指数
1
解决办法
2353
查看次数

Visual Studio架构比较找不到生成的脚本

我正在使用Visual Studio 2017执行SQL Server架构比较。按下Schema Compare实用工具的“生成脚本”按钮,然后看到消息

“更新脚本成功生成”

但是,我看不到生成的脚本。知道这样做的去向或是否失败了吗?

在此处输入图片说明

sql-server schema visual-studio schema-compare sql-server-data-tools

2
推荐指数
2
解决办法
3697
查看次数