小编jos*_*lmt的帖子

将设置类添加到UWP应用程序

我正在开发通用Windows平台应用程序,但Visual Studio中没有设置模板.

如何实现一个简单,强类型和可观察的类,将我的设置存储在LocalSettings或RoamingSettings中?

c# settings appsettings win-universal-app windows-10-universal

42
推荐指数
1
解决办法
3275
查看次数

VS2015:与Muiload.lib链接时出现LNK2019错误

Visual Studio 2015中包含muiload.h和链接muiload.lib并调用时,我正在尝试下一个错误:LoadMUILibrary

Muiload.lib(muiload.obj):错误LNK2019:未解析的外部符号__vsnwprintf在函数"long __stdcall StringVPrintfWorkerW(unsigned short*,unsigned int,unsigned int*,unsigned short const*,char*)"中引用"(?StringVPrintfWorkerW @@ YGJPAGIPAIPBGPAD @Z)

也许有些不对劲muiload.lib

c++ mfc visual-studio-2015

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

从Visual Studio 2015 Update 1中的Post-Build事件执行AL.EXE时出现错误-1073741819(0xC0000005)

使用Visual Studio 2015年更新1,我尝试一个问题在Visual C++ CLR类库项目(即没有与Visual Studio 2015年发生的事情)(C++/CLI)运行在生成后事件的命令时Al.exe工具: AL.EXE应用程序崩溃,系统返回错误代码-1073741819(0xC0000005).

这里是构建后事件的内容:

sn -Rca "$(SolutionDir)bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt)" dwo
Resgen "$(ProjectDir)Recursos.es-ES.resx" "$(IntDir)$(ProjectName).Recursos.es-ES.resources"
Al.exe /t:lib /embed:"$(IntDir)$(ProjectName).Recursos.es-ES.resources",Recursos.es-ES.resources /version:15.0.0.0 /culture:es-ES /out:"$(OutDir)es-ES\$(TargetName).resources.dll" /keyname:dwo
Run Code Online (Sandbox Code Playgroud)

这里是一个事件查看器的剪辑,每次我从构建后事件(编译我的项目)运行它时都会显示AL.exe应用程序的错误.

在此输入图像描述

命令行是正确的,因为您可以看到我是否从控制台执行它:

在此输入图像描述

所以我确定问题不在于命令行.

此外,我尝试指定另一个AL.EXE命令的路径,因为Visual Studio 2015 Update 1使用路径:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools
Run Code Online (Sandbox Code Playgroud)

所以我尝试了

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
Run Code Online (Sandbox Code Playgroud)

但仍然没有工作.

您可以重现创建新的Visual C++的CLR类库以及在Post-build事件中添加对AL.exe的简单调用的问题.

你知道如何解决这个问题吗?

编辑:我也尝试使用这样的AfterBuild目标:

<Target Name="AfterBuild">
    <Exec Command="Al.exe /t:lib /embed:&quot;$(IntDir)$(ProjectName).Recursos.es-ES.resources&quot;,Recursos.es-ES.resources /version:15.0.0.0 /culture:es-ES /out:&quot;$(OutDir)es-ES\$(TargetName).resources.dll&quot; /keyname:dwo"/>
</Target>
Run Code Online (Sandbox Code Playgroud)

结果是一样的:Visual Studio尝试运行命令AL.EXE但它崩溃返回-1073741819.

crash c++-cli al.exe visual-studio-2015

5
推荐指数
1
解决办法
1383
查看次数

为什么"propdp"代码段不使用nameof运算符作为注册属性的名称?

如果您插入片段propdp,它不会在DepencendyProperty.Register方法的第一个参数中使用nameof运算符作为属性名称,它会创建如下所示的内容:

    public string Text
    {
        get { return (string)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty TextProperty =
        DependencyProperty.Register("Text", typeof(string), typeof(MyContentControl), new PropertyMetadata(""));
Run Code Online (Sandbox Code Playgroud)

如果你在下一个例子中使用运算符nameof,那么可能会更好:

    public string Text
    {
        get { return (string)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    // Using a DependencyProperty as the backing store for Text.  This enables animation, …
Run Code Online (Sandbox Code Playgroud)

c# dependency-properties code-snippets visual-studio-2015

5
推荐指数
1
解决办法
887
查看次数

为什么“propdp”代码片段没有在声明依赖属性的位置提供正确的类名称?

当您使用propdp代码片段创建依赖项属性时,它不会为您建议创建依赖项属性的类的正确名称,您必须手动键入它,如下例所示:

namespace YourApp.Controls
{
    public sealed class YourButton : Control
    {
        public YourButton()
        {
            this.DefaultStyleKey = typeof(YourButton);
        }

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
        DependencyProperty.Register("Text", typeof(string), typeof(ownerclass), new PropertyMetadata(0));
    }
}
Run Code Online (Sandbox Code Playgroud)

我不想作为默认值Ownerclass,在这种情况下我想要YourButton

如何修改代码片段以提出正确的名称?

c# visual-studio code-snippets visual-studio-2015

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

为什么我的UWP应用程序无法调用Type.GetProperties方法?

我需要在我的UWP平台中访问Type.GetProperties,但我的Type类滞后于该方法.

在我看来,这是因为我们在UWP中使用的子集方法,但是试图找到信息,我发现:Type.GetProperties()在Release中不起作用,因此该方法确实存在于UWP中.

如果我转到Type的定义,第一行是这样的:

#region Assembly System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Users\JoséÁngel\.nuget\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll
#endregion
Run Code Online (Sandbox Code Playgroud)

也许我的nuget配置有问题?

该项目的条件编译符号是:

NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS
Run Code Online (Sandbox Code Playgroud)

我尝试使用和不使用"使用.NET Native工具链编译"选项.

目标是通用Windows

目标版本是:Windows 10(10.0; Build 10586)最小版本是:Windows 10(10.0; Build 10240)

但我也试过Min版本:Windows 10(10.0; Build 10586)

在NuGET中,该项目只有Microsoft.NETCore.UniversalWindowsPlatform v5.0.0

c# reflection win-universal-app

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