小编T.S*_*.S.的帖子

如何在Visual Studio 2013中禁用调试版本的代码签名?

我们最近将Visual Studio从2010年升级到2013年,除了一件事以外,一切似乎都和以前一样.2010年,代码签名仅在发布项目时执行,但在2013年,它希望每次构建项目时都对输出程序集进行签名.

我在尝试在网上找到任何有关此问题的结果时遇到问题,一切只指向如何首先设置签名,而不是如何防止在正常调试版本中签名.


我创建了一个新项目并开始使用这些设置来确定在正常构建期间可能触发签名要求的单个设置.在"安全"选项卡下的项目属性页面中,如果选中"启用ClickOnce安全设置"复选框,则2013需要签名步骤,但2010似乎没有该要求.

我仍然需要确认这是否是这种行为的唯一决策点.


证实.

我用一个空的WinForms应用程序创建了两个解决方案.一个解决方案是在Visual Studio 2010中创建的,另一个是在Visual Studio 2013中创建的.我进入每个项目属性并通过签名选项卡启用签名,然后在"安全"选项卡中选中"启用ClickOnce安全设置".是一个完全信任的申请".请注意,项目正在使用启用了PIN的智能卡上的证书进行签名.

在调试模式下正常构建期间,VS 2013会提示输入智能卡PIN,而2010年则没有.现在的问题基本上是为什么两个版本之间存在差异,以及如何在2013年解决这个问题,以表现得像2010年.


我包含了我在下面创建的测试解决方案的项目文件.比较差异并不意味着任何明显不同的东西.我还尝试将VS 2013项目更改为与VS 2010项目相同的框架,以最大限度地减少项目之间的差异 - 这不会改变行为差异.

Visual Studio 2010项目文件

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E31DA60C-E444-4E34-AF6D-5B4588CC1F8E}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SigningTest1</RootNamespace>
    <AssemblyName>SigningTest1</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel> …
Run Code Online (Sandbox Code Playgroud)

clickonce code-signing visual-studio-2010 visual-studio-2013

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

MVC 4 Web API Action返回:Types vs HttpResponseMessage

返回类型有什么区别,例如

    public class MyController : ApiController
    {
        public IEnumerable<MyType> Get()...
Run Code Online (Sandbox Code Playgroud)

VS

返回HttpResponseMessage:

    public class MyController : ApiController
    {
        public HttpResponseMessage Get()...
Run Code Online (Sandbox Code Playgroud)

??

MVC是否将类型包装到HttpResponseMessage内容对象中?除非明确添加格式化程序,否则页面上的结果看起来相同.

客户有什么不同?

asp.net action asp.net-web-api

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

在Android上使用Visual Studio 2015进行调试停止工作

我使用Visual Studio 2015 RC在我的Samsung Galaxy S5上构建和调试Android应用程序.今天我从android 4.3更新到5.0,调试停止工作.这是我得到的信息:

在此输入图像描述

谁知道如何解决这个问题?

debugging android visual-studio android-debug vs-2015-preview

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

如何检测平板电脑模式

我正在使用以下代码来检测用户是否处于平板电脑模式.我在Surface Pro上,当我解除键盘并将PC变成平板电脑时,IsTabletMode返回true(应该这样.)当我使用"平板电脑模式"按钮而不解耦屏幕时,IsTabletMode总是返回false.有没有人经历过这个,我该如何解决?

/*
 * Credit to Cheese Lover
 * Retrieved From: http://stackoverflow.com/questions/31153664/how-can-i-detect-when-window-10-enters-tablet-mode-in-a-windows-forms-applicatio
 */
public static class TabletPCSupport
{
   private static readonly int SM_CONVERTIBLESLATEMODE = 0x2003;
   private static readonly int SM_TABLETPC = 0x56;

   private Boolean isTabletPC = false;

   public Boolean SupportsTabletMode { get { return isTabletPC; }}

   public Boolean IsTabletMode 
   {
       get
       {
           return QueryTabletMode();
       }
   }

   static TabletPCSupport ()
   {
        isTabletPC = (GetSystemMetrics(SM_TABLETPC) != 0);
   }

   [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "GetSystemMetrics")] …
Run Code Online (Sandbox Code Playgroud)

c# winforms

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

我可以修改Request.Form变量吗?

我尝试Request.Form.Set(k, v)但它抛出异常

集合是只读的

c# request.form

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

ODBC连接到Excel错误

我有一个ODBC连接的问题,该连接应该连接到Excel表并用它做一些事情.我已经在网上看了很多关于它的东西,但没有一个解决方案帮助了我(包括stackoverflow).

所以基本上我正处于试图打开表连接的地步.

private static SortedList<string, School> generateSchoolListExcel(string listFilePath)
{
    StringBuilder con = new StringBuilder();

    OdbcConnectionStringBuilder.AppendKeyValuePair(con, "Data Source", listFilePath);
    OdbcConnectionStringBuilder.AppendKeyValuePair(con, "HDR", "yes");
    OdbcConnectionStringBuilder.AppendKeyValuePair(con, "Format", "xlsx");
    OdbcConnectionStringBuilder.AppendKeyValuePair(con, "Driver", "{Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}");
   //I have tried to specify driver without parentheses {} but it's still the same

    List<School> schoolList = new List<School>();

    using (OdbcConnection excel = new OdbcConnection(con.ToString()))
    {
        excel.Open();
        //doing actuall stuff
    }

        return schoolList;
}
Run Code Online (Sandbox Code Playgroud)

当我调用该excel.Open()方法时,我收到OdbcException消息:

错误[IM002] [Microsoft] [ODBC驱动程序管理器]未找到数据源名称且未指定默认驱动程序",这很奇怪,因为我在名为con的字符串中指定了那些.

还值得一提的是,在ODBC数据源管理器中,我可以清楚地看到我已经安装并运行了这些驱动程序.

还有一个奇怪的部分.当我调用我在stackoverflow上找到的以下方法时,它返回以下驱动程序列表:

  • "驱动程序da Microsoft para …

.net c# excel odbc

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

TypeLoadException

我正在使用app.config文件来存储凭据,当我尝试检索它们时,我得到TypeLoadException如下:

无法从程序集'System.Configuration,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'加载类型'System.Configuration.DictionarySectionHandler'

这是一个.NET 4.5项目,我设置SystemSystem.Configuration Copy-Local属性true,我不明白问题的来源.我对.NET编程没有经验,所以对汇编的概念不太满意.

以下是代码片段:

的app.config

<configSections>
  <sectionGroup name="Credentials">
   <section name="Twitter" type="System.Configuration.DictionarySectionHandler"/>
  </sectionGroup>
</configSections>

<Credentials>
 <Twitter>
   <add key="****" value="*****"/>
   <add key="****" value="*****"/>
  </Twitter>
</Credentials>
Run Code Online (Sandbox Code Playgroud)

连接服务文件

var hashtable = (Hashtable)ConfigurationManager.GetSection("Credentials/Twitter");
Run Code Online (Sandbox Code Playgroud)

我知道这是一个常见的问题,我在发布之前用Google搜索了它.但到目前为止我发现的所有解决方案似乎都不起作用,或者我可能没有正确理解它们.

先感谢您.

c# exception system.configuration .net-assembly

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

没有匹配的绑定可用,并且该类型在Ninject中不可自绑定

我正在使用Ninjec,Ninject.Web.MVC和Ninject.Web.Common

当我启动我的mvc应用程序时,我收到此绑定错误:

我的绑定有什么问题?

激活DbConnection时出错

没有匹配的绑定可用,并且该类型不可自绑定.

激活路径:

4)将依赖关系DbConnection注入到DbContext类型的构造函数的参数existingConnection中

3)将依赖关系DbContext注入到GenericRepository类型的构造函数的参数dbContext中{User}

2)将依赖关系IGenericRepository {User}注入到HomeController类型的构造函数的参数repo中

1)请求HomeController

建议:

1)确保已为DbConnection定义了绑定.

2)如果在模块中定义了绑定,请确保已将模块加载到内核中.

3)确保您没有意外创建多个内核.

4)如果使用构造函数参数,请确保参数名称与构造函数参数名称匹配.

5)如果使用自动模块加载,请确保搜索路径和过滤器正确无误.

public interface IGenericRepository<T> where T : class
{
}

public class GenericRepository<T> : IGenericRepository<T> where T : class
{
        public GenericRepository(TLPContext dbContext)
        {
            DbContext = dbContext;
        }

        protected TLPContext DbContext { get; private set; }
}

[assembly: WebActivator.PreApplicationStartMethod(typeof(TLP.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(TLP.App_Start.NinjectWebCommon), "Stop")]

namespace TLP.App_Start
{
    using Microsoft.Web.Infrastructure.DynamicModuleHelper;
    using Ninject;
    using Ninject.Web.Common;
    using System;
    using System.Web;
    using TLP.DataAccess;
    using TLP.DataAccess.Contract;
    using TLP.DataAccess.Implementation;

    public static …
Run Code Online (Sandbox Code Playgroud)

c# ninject ninject.web.mvc

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

SQL Server应用程序角色,性能命中

我打算在我的应用程序中使用MS SQL Server 2005应用程序角色.我将sp_setapprole通过执行sp_unsetapproleSP来完成该任务,并通过执行SP来完成.该应用程序在ASP.NET中实现.

我已经读过"连接池不能正常工作"与应用程序池,并且无法对连接"断开事件"做出反应(sp_unsetapprole在断开连接之前执行).

我计划sp_setapprole在所有SP的开头打电话sp_unsetapprole,并在我所有的SP结束时打电话.

您是否使用过SQL应用程序角色?你的XP是什么?性能如何?

sql-server asp.net performance sql-server-2005

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

使用Json.Net序列化NameValueCollection的自定义子类

我有以下类我尝试序列化到Json失败了.

class HL7 : NameValueCollection
{
  public List<HL7> Children { get; set; }
  public HL7()
  {
    Children = new List<HL7>();
  }
}
Run Code Online (Sandbox Code Playgroud)

我已经创建了这样的对象并向其添加了数据:

HL7 hl7 = new HL7();
hl7.Add("a", "123");
hl7.Add("b", "456");
hl7.Children.Add(new HL7());
hl7.Children[0].Add("c", "123");
hl7.Children[0].Add("d", "456");
Run Code Online (Sandbox Code Playgroud)

我打电话的时候

JsonConvert.SerializeObject(hl7)
Run Code Online (Sandbox Code Playgroud)

我收到

["a","b"]
Run Code Online (Sandbox Code Playgroud)

我期待以下内容:

{
  "a": "123",
  "b": "456",
  "Children": [
    {
      "c": "123",
      "d": "456",
    }
  ]
} 
Run Code Online (Sandbox Code Playgroud)

json.net

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