是否可以在声明后修改ItemGroup的元数据.
例如:
<ItemGroup>
<SolutionToBuild Include="$(BuildProjectFolderPath)\MySolution.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
</ItemGroup>
<Target Name="BuildNumberOverrideTarget">
<!--Code to get the version number from a file (removed)-->
<!--Begin Pseudo Code-->
<CodeToChangeItemGroupMetaData
ItemToChange="%(SolutionToBuild.Properties)"
Condition ="'%(SolutionToBuild.Identity)' ==
'$(BuildProjectFolderPath)\MySolution.sln'"
NewValue="Version=$(Version)" />
<!--End Pseudo Code-->
</Target>
Run Code Online (Sandbox Code Playgroud)
我希望有一种方法不要求我删除该项目然后重新声明它.
谢谢你的回答.Vaccano
我需要在TFS中的特定Changeset上创建一个分支.这可行吗?
例如,我有变更集1528,这是我项目的最后一次检查.但是我想从变更集1487中分支出来.可以这样做吗?
如果是这样,怎么样?
注意:我使用的是TFS 2008
我正在编写一个类来帮助我对代码进行单元测试.它看起来像这样:
/// <summary>
/// Wrapper for the LogManager class to allow us to stub the logger
/// </summary>
public class Logger
{
private static ILogger _logger = null;
/// <summary>
/// This should be called to get a valid logger.
/// </summary>
/// <returns>A valid logger to log issues to file.</returns>
public static ILogger GetLogger()
{
if (_logger == null)
_logger = LogManager.GetLogger("logger");
return _logger;
}
/// <summary>
/// This is used by unit tests to allow a stub to …Run Code Online (Sandbox Code Playgroud) 我有一个在服务器上运行的Windows服务(如果可以,我宁愿不重启).
这项服务的EXE已经消失(无法恢复),我没有副本(这是一个已经更新的调试版本).
反正有没有运行它的exe从服务列表中删除此服务?
我有一些类似于下面的代码.基本上它表示从Web服务获取数据并将其转换为客户端对象.
void Main()
{
Mapper.CreateMap<SomethingFromWebService, Something>();
Mapper.CreateMap<HasSomethingFromWebService, HasSomething>();
// Service side
var hasSomethingFromWeb = new HasSomethingFromWebService();
hasSomethingFromWeb.Something = new SomethingFromWebService
{ Name = "Whilly B. Goode" };
// Client Side
HasSomething hasSomething=Mapper.Map<HasSomething>(hasSomethingFromWeb);
}
// Client side objects
public interface ISomething
{
string Name {get; set;}
}
public class Something : ISomething
{
public string Name {get; set;}
}
public class HasSomething
{
public ISomething Something {get; set;}
}
// Server side objects
public class SomethingFromWebService
{
public string Name {get; …Run Code Online (Sandbox Code Playgroud) 我试图让我的Webpack项目有一个源映射文件.
我终于得到了正确的设置,所以它会这样做,但现在我收到此错误:
DevTools无法解析SourceMap:http://MyServer/MyApp/bundle.js.map
我转到它声明的URL,我找到了一个带有这些属性的json文件:
这一切似乎都是有效的json.不幸的是,Chrome没有理由无法解析源地图.
有没有办法让Chrome说出解析源地图失败的原因?
或者,如果不这样做,有谁知道为什么我的源地图会失败? (我的代码太大而无法发布,但这里是我的webpack.config.js和我的package.json文件.)
笔记:
当我尝试设置模拟时,我收到此错误PropertyBehavior():
System.InvalidOperationException:System.InvalidOperationException:无效调用,最后一次调用已被使用或未进行任何调用(请确保您正在调用虚拟(C#)/ Overridable(VB)方法).
我试图只使用Rhino Mocks 3.5(安排,行动,断言)
这是我的代码:
private IAddAddressForm form;
private AddAddressMediator mediator;
[TestInitialize()]
public void MyTestInitialize()
{
form = MockRepository.GenerateMock<IAddAddressForm>();
mediator = new AddAddressMediator(form);
// Make the properties work like a normal property
Expect.Call(form.OKButtonEnabled).PropertyBehavior();
//I tried this too. I still get the exception
//SetupResult.For(form.OKButtonEnabled).PropertyBehavior();
}
[TestMethod]
public void TestOKButtonEnabled()
{
form.OKButtonEnabled = true;
Assert.IsTrue(form.OKButtonEnabled);
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用存根(对于我应该使用的代码),但我正在尝试学习Rhino Mocks.
最终,我希望能够确保访问多个属性的值.(关于如何检查form.FirstName访问的任何提示(即调用getter)也将不胜感激.)
如果需要,以下代码IAddressForm:
namespace AddressBook
{
public interface IAddAddressForm
{
string FirstName { get; set; …Run Code Online (Sandbox Code Playgroud) c# rhino-mocks visual-studio-2008 visual-studio rhino-mocks-3.5
我正在尝试对CollectionViewSource进行基本使用,我必须遗漏一些东西,因为它不起作用.这是我的XAML:
<Window.Resources>
<CollectionViewSource Source="{Binding loc:MainVM.Instance.MapItems}" x:Key="MapCV">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="SourceProject" />
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>
Run Code Online (Sandbox Code Playgroud)
<ListBox ItemsSource="{StaticResource MapCV}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding SourceType, Converter={StaticResource WorkItemTypeToStringConverter}}"/>
<ComboBox Grid.Column="1" SelectedItem="{Binding DestType}" ItemsSource="{Binding WorkItemTypesForCurrentDestProject, Source={x:Static loc:MainMediator.Instance}, diagnostics:PresentationTraceSources.TraceLevel=High}" DisplayMemberPath="Name" />
<Button Grid.Column="2" Content="{Binding PercentMapped}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
这编译很好,但是当我运行应用程序时,我收到此错误:
Cannot convert the value in attribute 'ItemsSource' to object of type 'System.Collections.IEnumerable'. 'System.Windows.Data.CollectionViewSource' is not a valid value for property 'ItemsSource'. Error at object …
我有一个包含很多此类内容的文件:
<asp:TableCell ID="TableCell9" runat="server">Company
Organization:</asp:TableCell><asp:TableCell ID="TableCell10" runat="server">
Run Code Online (Sandbox Code Playgroud)
如何让格式化程序将其更改为如下所示的显示:
<asp:TableCell ID="TableCell9" runat="server">Company Organization:</asp:TableCell>
<asp:TableCell ID="TableCell10" runat="server">
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
我打开了工具 - >选项,然后浏览到文本编辑器.我有一份语言清单.我选择了HTML,因为这是控制aspx文件格式的语言.
我将"标签包装"更改为没有选中"超过指定长度时包装标签".
我然后按ctrl + k,ctrl + d(格式化文档).这并没有解决问题.
我不想做的事情:
手动编辑文件以修复所有标记.
有任何想法吗?
我有一些相当简单的状态需求(目前).我想我想使用Stateless api 对这些进行建模.(但我对国家机器并不是很了解,所以我错了.)
但是我被卷入了术语(特别是状态和触发器)
这是一个例子:我有一个订单类.它设置有几个状态.它们是:新的,填充的,装运的,已完成的,已取消的.
我想要的一些简单的状态规则是允许这些状态转换:
那么我在这里被绊倒的是我的"触发器"是什么?
如果需要更具体的示例,请说我想要一个这样的方法:
public bool UpdateOrderStatus(int OrderId, OrderStatusEnum NewOrderStatus)
Run Code Online (Sandbox Code Playgroud)
如果状态更新成功,则返回true.如何设置和使用Stateless来实现这一目标?
c# ×5
.net ×3
automapper ×1
branch ×1
formatting ×1
html ×1
javascript ×1
msbuild ×1
rhino-mocks ×1
state ×1
tfs ×1
tfs2008 ×1
unit-testing ×1
webpack ×1
webpack-2 ×1
wpf ×1
xml ×1