我正在使用Visual Studio 2005开发一些C#项目,我正在尝试将平台目标从x86更改为任何CPU.我已经完成了我所知道的所有依赖项,并确保它们也是使用corflags工具为任何CPU构建的.
当我在Visual Studio 2005中更改平台目标时,似乎它保存了更改,但是当我构建项目时,它仍然使用x86.下次打开项目时,平台目标已重置为x86.
这只发生在解决方案中的几个项目中,这是否意味着某处还有其他32位依赖项?
我可以在命令行上手动运行C#编译器/platform:anycpu,但我没有收到错误,但我不确定这是否正确,我希望能够在Visual Studio中构建.
我该怎么做才能解决这个问题?
我绑定enum到这样的属性网格:
public enum myEnum
{
Ethernet,
Wireless,
Bluetooth
}
public class MyClass
{
public MyClass()
{
MyProperty = MyEnum.Wireless;
}
[DefaultValue(MyEnum.Wireless)]
public MyEnum MyProperty { get; set; }
}
public Form1()
{
InitializeComponent();
PropertyGrid pg = new PropertyGrid();
pg.SelectedObject = new MyClass();
pg.Dock = DockStyle.Fill;
this.Controls.Add(pg);
}
Run Code Online (Sandbox Code Playgroud)
我的问题:我在程序运行时动态获取数据.我读了网络适配器然后存储适配器名称,myArray如下所示:
string[] myArray = new string[] { };
myArray[0] = "Ethernet";
myArray[1] = "Wireless";
myArray[2] = "Bluetooth";
Run Code Online (Sandbox Code Playgroud)
可以使用c#转换myArray为动态myEnum吗?谢谢.
我正在尝试使用Visual Studio 2012 Express为我的appx文件签署Windows应用商店应用程序,但是收到以下错误:
SignTool Error: The specified algorithm cannot be used or is invalid
Run Code Online (Sandbox Code Playgroud)
我正在通过STORE-> Create App Packages菜单运行该过程,因此我无法直接访问SignTool的参数.
起初我以为是因为它使用了我们其他开发人员的自签名证书,所以我改为使用我们的真实证书,但仍然遇到同样的问题.
什么可能导致这个以及如何解决它?
编辑:怀疑问题是我们的普通证书不支持SHA-256,所以我在Visual Studio中创建了一个新的测试证书,但得到了相同的结果.
EDIT2:验证我的appx包中的哈希算法是SHA256,尝试使用以下命令手动运行SignTool:
SignTool sign /a /f My_TemporaryKey.pfx /fd SHA256 /v /debug MyAppPackage.appx
Run Code Online (Sandbox Code Playgroud)
同样的错误,控制台消息中没有有用的信息.
有谁知道是否有办法了解加载app.config文件的过程?
我遇到过很多情况,在这个过程中出现问题(通常是配置文件中的错误值),但是需要大量的猜测或消除过程才能找到问题.
例如,以下某些方面给我带来了麻烦:
useLegacyV2RuntimeActivationPolicy和相关节点)这可能是一厢情愿的想法,但如果有一些秘密日志可以启用,或者某种方式迫使运行时在加载配置系统时提供更多信息,那将会很棒.
我很好奇,如果有背后为什么任何历史^人物是用来逃跑的特殊字符<,>,|,&,和^在Windows环境变量名称代替\,通常用于转义特殊字符的字符.
请注意,我意识到可能没有理由,但我有兴趣听听是否有原因.
我正在使用带有opencv库的visual c ++编写代码.我可以在灰度图像上做双倍阈值(如带通)吗?例如,我想在MaxValue中设置100到176之间的所有级别,并将所有剩余值设置为零.opencv有可能吗?提前致谢!
这可能是一个愚蠢的问题,但也许有人可以提供一些见解.
我在头文件中定义了一些全局变量(是的,我知道这很糟糕,但这只是一种假设情况).我将此头文件包含在两个源文件中,然后将这些文件编译为两个目标文件.全局符号不会在代码中的任何位置引用.
如果源文件是C,那么看起来编译器省略了全局符号,并且所有链接都没有错误.如果源文件是C++,则符号包含在两个目标文件中,然后我会收到链接器错误.对于C++,当我包含标题时,我使用extern"C".
我正在使用VS2005的Microsoft编译器.
这是我的代码:
头文件(test.h):
#ifndef __TEST_H
#define __TEST_H
/* declaration in header file */
void *ptr;
#endif
Run Code Online (Sandbox Code Playgroud)
C源文件:
test1.c
#include "test.h"
int main( ) {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
test2.c中
#include "test.h"
Run Code Online (Sandbox Code Playgroud)
C++源文件:
test1.cpp
extern "C" {
#include "test.h"
}
int main( ) {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
测试2.cpp
extern "C" {
#include "test.h"
}
Run Code Online (Sandbox Code Playgroud)
对于C,目标文件看起来像这样:
Dump of file test1.obj
File Type: COFF OBJECT
COFF SYMBOL TABLE
000 006DC627 ABS notype Static | @comp.id
001 00000001 ABS notype Static | …Run Code Online (Sandbox Code Playgroud) 我在C#中使用pinvoke调用_snwprintf时遇到了一个有趣的问题.它适用于整数类型,但不适用于浮点数.
这是在64位Windows上,它在32位上运行良好.
我的代码如下,请记住,这是一个人为的例子来展示我所看到的行为.
class Program
{
[DllImport("msvcrt.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern int _snwprintf([MarshalAs(UnmanagedType.LPWStr)] StringBuilder str, IntPtr length, String format, int p);
[DllImport("msvcrt.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
private static extern int _snwprintf([MarshalAs(UnmanagedType.LPWStr)] StringBuilder str, IntPtr length, String format, double p);
static void Main(string[] args)
{
Double d = 1.0f;
Int32 i = 1;
Object o = (object)d;
StringBuilder str = new StringBuilder(32);
_snwprintf(str, (IntPtr)str.Capacity, "%10.1lf", (Double)o);
Console.WriteLine(str.ToString());
o = (object)i;
_snwprintf(str, (IntPtr)str.Capacity, "%10d", (Int32)o); …Run Code Online (Sandbox Code Playgroud) c# ×3
.net ×1
64-bit ×1
app-config ×1
appsettings ×1
appx ×1
arrays ×1
c ×1
c++ ×1
compilation ×1
debugging ×1
enums ×1
history ×1
opencv ×1
pinvoke ×1
propertygrid ×1
signtool ×1
threshold ×1
visual-c++ ×1
windows ×1
winforms ×1