小编mhe*_*384的帖子

在ASP.NET中使用<%=%>或<%#%>和runat = server

我有一个看起来像这样的Web控件

public class Foo : WebControl
{
  [Bindable(true)]
  [Category("Default")]
  [DefaultValue("")]
  [Localizable(true)]
  public string Bar { get; set; }

  protected override void Render(HtmlTextWriter output)
  {
    output.WriteLine(Bar);
  }
}

我想把这个webcontrol放在我的aspx页面中,如下所示:

<cc1:Foo Bar="<%= Fa.La.La %>/otherstuff" runat="server" />

(显然这个代码被简化以显示问题)

在我的Render方法中,不评估变量Fa.La.La.它以原始文本"<%= Fa.La.La%>"的形式出现.如何评估它?

我并不特别说明如何传入变量.如果变量可以在<%#...%>传入时进行评估,那么工作正常.关键是我在调用Render()方法之前/我想要评估一些服务器端变量.

我唯一能想到的是使用正则表达式来获取<%= ...%>的内容并使用反射或其他东西,但必须有一种更优雅的方式来做到这一点.

这个问题非常类似于使用runat = server在href <%= xx%>中使用服务器变量,但它并不完全相同,因为没有任何答案有用.

asp.net asp.net-webcontrol

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

“ Visual Studio的许可证已过期。” 从TFS构建中使用Visual Studio编译时

我需要在构建服务器上构建SSIS项目(.dtproj)。msbuild不支持它们,因此我需要使用Visual Studio来实现。Stack Overflow的智慧表明,我不需要新的VS许可证即可执行此操作(构建计算机是否需要单独的Visual Studio许可证?)。我已经以自己的身份登录到构建服务器,并注册了Visual Studio。但是我不知道如何告诉构建代理使用我的Visual Studio许可证。使用TFS2015,vNext可以构建代理(不是XAML)。

我正在C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com blah.sln /build Release从TFS构建中打电话 。

2017-05-02T21:56:08.6745925Z Microsoft Visual Studio 2015 Version 14.0.25420.1.
2017-05-02T21:56:08.6745925Z Copyright (C) Microsoft Corp. All rights reserved.
2017-05-02T21:56:08.6745925Z The license for Visual Studio has expired.
2017-05-02T21:56:09.2986224Z The evaluation period for this product has ended.
Run Code Online (Sandbox Code Playgroud)

tfs ssis tfsbuild visual-studio-2015 tfs-2015

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

swprintf在8位范围之外的字符上扼流圈

这在OS X上发生,但我怀疑它适用于任何UNIX-y操作系统.我有两个字符串,如下所示:

const wchar_t *test1 = (const wchar_t *)"\x44\x00\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00";
const wchar_t *test2 = (const wchar_t *)"\x44\x00\x00\x00\x19\x20\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00";

在调试器中,test1看起来像"Ds",test2看起来像"D's"(带有撇号).然后我调用这段代码:

wchar_t buf1[100], buf2[100];
int ret1 = swprintf(buf1, 100, L"%ls", test1);
int ret2 = swprintf(buf2, 100, L"%ls", test2);

第一个swprintf调用工作正常.第二个返回-1(缓冲区不变).

我猜这个问题与locales有关,但谷歌搜索并没有给我提供任何有用的东西.这是重现我所看到的问题的最简单方法.我真正感兴趣的是vswprintf(),但我认为这是密切相关的.

为什么swprintf会阻塞8位范围之外的unicode字符?反正有解决这个问题吗?

c unicode macos wchar-t

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

Can't access ArtifactStagingDirectory variable in MSBuild

During my build process I'm trying to copy a folder to the artifacts folder (\myserver\d$\TFBuild-Agent01\66\a).

So I put this in the .csproj file:

<Target Name="BeforeBuild">
  <Exec 
    Command="xcopy.exe  Databases &quot;$(Build.ArtifactStagingDirectory)\Databases&quot; /i /e /y /d" />
</Target>
Run Code Online (Sandbox Code Playgroud)

This gets me

Error MSB4184: The expression """.ArtifactStagingDirectory" cannot be evaluated. Method 'System.String.ArtifactStagingDirectory' not found*

Everything I can find online says that $(Build.ArtifactStagingDirectory) is the way to do it. But it doesn't work.

Building with Visual Studio 2015 on TFS 2015

This doesn't work either: …

msbuild tfs csproj tfsbuild

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