我想我在某处读过它,但现在找不到来源并且无法确认它:当安装(主要升级)来自 MSI 的较新版本时,如果文件已被修改(由安装程序或用户),则默认规则是旧文件不会被新版本的相同文件替换吗?
我想我也观察到我之前编写的安装程序中的行为,但现在经过一些更改后,似乎它总是会替换旧的修改配置文件!
产品定义:
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Advanced Software Solution" UpgradeCode="$(var.UpgradeCode)">
<Package Id="*" InstallerVersion="200" Description="The web service installer" Compressed="yes"
InstallScope="perMachine"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
Run Code Online (Sandbox Code Playgroud)
组件定义:
<Component Id='WebConfigComp' Guid='GUID'>
<File Id='WebConfigFile' Name='Web.config' Source='$(var.TheWebService.WCF.TargetBinPath)\Web.Distribution.config'
KeyPath='yes'>
</File>
</Component>
Run Code Online (Sandbox Code Playgroud)
安装执行序列
FindRelatedProducts 25
AppSearch 50
LaunchConditions 100
ValidateProductID 700
myScripts_CA 799
CostInitialize 800
FileCost 900
CostFinalize 1000
MigrateFeatureStates 1200
InstallValidate 1400
RemoveExistingProducts 1401
InstallInitialize 1500
BackupCA Installed 1501
ProcessComponents 1600
UnpublishFeatures 1800
SchedSecureObjectsRollback_x64 VersionNT > 400 …Run Code Online (Sandbox Code Playgroud) 我的安装程序包在我的机器上工作,但在我同事的机器上失败。查看日志,我可以看到在 ExecuteAction 短语期间没有保留一些属性值:Ignoring disallowed property他的安装程序日志文件中有几行,并且这些属性在 UISequence 期间设置了正确的值。奇怪的是,我们都是本地机器上的管理员用户,他也是域管理员,而我不是,而且我们都在 Windows 7 64 位上。所以我不认为这是因为他没有管理员权限。
日志文件中的确切条目:
MSI (s) (3C:50) [09:14:16:583]: Ignoring disallowed property IISMAJORVERSION
MSI (s) (3C:50) [09:14:16:583]: Ignoring disallowed property IISMINORVERSION
MSI (s) (3C:50) [09:14:16:583]: Ignoring disallowed property WCF_SRV_INSTALL_FOLDER
MSI (s) (3C:50) [09:14:16:583]: Ignoring disallowed property TARGETDIR
Run Code Online (Sandbox Code Playgroud)
一个简单的解决方法是将所有这些属性标记为Secure,但IISMAJORVERSION我的代码中没有定义诸如此类的属性。我发现,我可以设置EnableUserControl以1使Ignoring disallowed property消失。另一种解决方案是创建我自己的安全属性并将我需要的任何忽略的属性值复制到我自己的属性中并读取它们而不是被忽略的属性。
那之后,我发现有一个条目Machine policy value 'EnableUserControl' is 0在他的安装程序日志,但不是在我的日志,这似乎设定点EnableUserControl到1大概是我所需要的。在那种情况下,问题是为什么这两台机器的值不同?
所以我的第一个问题是:是否EnableUserControl为我的解决方案设置了一个很好的解决方案,或者可能有更好/更安全的解决方案,因为我似乎只找到了症状但没有找到原因?
或者,如果EnableUserControl给出的信息看起来是一个合理的修复,任何建议都可以帮助我追踪问题的原因(管理员可能更改了注册表项值?)。
我不认为我的安装程序有什么特别之处,但如果有人想查看更多详细信息:
<Package Id="*" …Run Code Online (Sandbox Code Playgroud) 如果我compare像这样定义我的函数:
bool compare(Student& a, Student& b)
{
return a.n < b.n;
}
Run Code Online (Sandbox Code Playgroud)
g ++会抱怨:
g++ -Wall main.cpp -o main
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/algorithm:63:0,
from main.cpp:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_algo.h: In function ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Student*, std::vector<Student> >, _Tp = Student, _Compare = bool (*)(Student&, Student&)]’:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_algo.h:2261:78: instantiated from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Student*, std::vector<Student> >, _Compare = bool (*)(Student&, Student&)]’
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include/g++-v4/bits/stl_algo.h:2302:62: instantiated from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = …Run Code Online (Sandbox Code Playgroud) 我开始使用Entity Framework 4.1为以下类使用TDD:
public class Agent
{
// Primary key
public int ID { get; set; }
[Required]
public string Name { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Country { get; set; }
public string Phone1 { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的断言将失败:
/// <summary>
///A test for Agent Constructor need have name
///</summary>
[TestMethod()]
public void AgentConstructorTest()
{
Agent target = new Agent();
Assert.IsNull(target);
}
Run Code Online (Sandbox Code Playgroud)
当我查看生成的目标对象时,它是使用ID = …
我有点担心懒惰加载工作.
例如,如果我有供应商对象,其具有Address外部对象作为属性,如下所示:
public class Supplier
{
public int ID { get; set; }
[Required]
public string FullName { get; set; }
public string TaxNumber { get; set; }
public virtual Address DeliveryAddress { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当我把断点放在:
var suppliers = dbContext.Supplier.ToList();
Run Code Online (Sandbox Code Playgroud)
我可以看到var供应商等可以使用地址信息.当我使用DeliveryAddress属性时,它是可用的,这是否意味着所有FK对象都已加载?但另一方面,对于右侧的查询,我可以在断点处从Visual Studio查看,它就像这样:
{SELECT
[Extent1].[ID] AS [ID],
[Extent1].[FullName] AS [FullName],
[Extent1].[TaxNumber] AS [TaxNumber],
[Extent1].[DeliveryAddress_ID] AS [DeliveryAddress_ID]
FROM [dbo].[Suppliers] AS [Extent1]}
Run Code Online (Sandbox Code Playgroud)
这意味着查询本身根本不会加载Address对象?
那么谁在加载FK对象?ToList()或VS调试器?
关于如何确认是否是延迟加载的其他建议?
注意:所以现在我确认Lazy加载正在通过两个ToList调用,一个设置Lazy加载,另一个设置延迟加载.有人可以指点我知道什么时候延迟加载另一个查询是为FK属性发送的?
我目前很难尝试将自己的类文件添加到ASP.NET MVC项目中,因此我的控制器可以引用它.但Visual Studio 2010始终抱怨"找不到类型或名称'产品'(您是否缺少使用指令或汇编引用?)
我不知道在哪里放置我的类文件并尝试将类添加到Models或Controllers目录中,它也不起作用.我的类在正确的命名空间下,我确实在我的Controller中引用了Models命名空间.它可能是明显的东西,但我无法让它工作:(
在做了一些研究后,似乎可以使用Word Interlop来操作Word文档(打开,修改,更改等).像这样:
class Program
{
static void Main(string[] args)
{
Application ap = new Application();
Document doc = ap.Documents.Open(@"C:\temp\TestDoc.docx");
doc.Activate();
}
}
Run Code Online (Sandbox Code Playgroud)
但这样做,MS word应用程序本身与GUI没有显示.我怀疑它根本没有开始.我只能WINWORD.EXE在Windows任务管理器的"进程"选项卡中看到,但不能在"应用程序"选项卡中看到.
我想做的是:
我怎样才能做到这一点?