WIX 制作安装MSI程序 提示不符合短文件格式

WIX 制作安装MSI程序 提示不符合短文件格式

 

启动  disable8dot3 

fsutil behavior set disable8dot3 E: 0

启动disable8dot3  CMD设置后,需要把目录重新的复制下,原先创建的就不会改变了,需要重新的复制目录,CMD设置后必须重启服务器。

 

关闭  disable8dot3

fsutil behavior set disable8dot3 E: 1

 

 

修改后的状态,中间一行是短文件格式

 

WIX 制作安装MSI程序 提示不符合短文件格式

 

C#代码修改方式

[DllImport("kernel32.dll")]
static extern uint GetLongPathName(string shortname, StringBuilder longnamebuff, uint buffersize);

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName([MarshalAs(UnmanagedType.LPTStr)] string path,[MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath,int shortPathLength);

/// <summary> 
/// The ToShortPathNameToLongPathName function retrieves the long path form of a specified short input path 
/// </summary> 
/// <param name="shortName">The short name path</param> 
/// <returns>A long name path string</returns> 
public static string ToLongPathName(string shortName)
{
StringBuilder longNameBuffer = new StringBuilder(256);
uint bufferSize = (uint)longNameBuffer.Capacity;

GetLongPathName(shortName, longNameBuffer, bufferSize);

return longNameBuffer.ToString();
}

/// <summary> 
/// The ToLongPathNameToShortPathName function retrieves the short path form of a specified long input path 
/// </summary> 
/// <param name="longName">The long name path</param> 
/// <returns>A short name path string</returns> 
public static string ToShortPathName(string longName)
{
StringBuilder shortNameBuffer = new StringBuilder(256);
int bufferSize = shortNameBuffer.Capacity;

int result = GetShortPathName(longName, shortNameBuffer, bufferSize);
//fsutil behavior set disable8dot3 E: 0 启动disable8dot3 CMD设置后,需要把目录重新的复制下,原先创建的就不会改变了。
return shortNameBuffer.ToString();
}

static void Main(string[] args)
{
string m_shortName = @"E:\U816.0_HotfixSOURCE\package\MSIOBJ\WA\APP\Others\Target\AppServer\Bin\UAP\MerpTemplateDesigners\UFIDA.U8.MA.PrintDesigner.dll";
FileInfo m_fileinfo = new FileInfo(m_shortName);
string shortName = ToShortPathName(m_shortName);

}

 

 

 

UP-U8V16.0-0001-200509-WA.wxs
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The Package/@Platforms attribute has been deprecated. Please use the Platform attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1091 : The Package/@Id attribute has been set. Setting this attribute will allow nonidentical .msi files to have the same package code. This may be a problem because the package code is the primary identifier used by the installer to search for and validate the correct package for a given installation. If a package is changed without changing the package code, the installer may not use the newer package if both are still accessible to the installer. Please remove the Id attribute in order to automatically generate a new package code for each new .msi file.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0044 : The UpgradeVersion element's Minimum or Maximum attribute was not found; one of these is required.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The Directory/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The Directory/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The Directory/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The Directory/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1080 : The Registry element has been deprecated. Please use one of the new elements which replaces its functionality: RegistryKey for creating registry keys, RegistryValue for writing registry values, RemoveRegistryKey for removing registry keys, and RemoveRegistryValue for removing registry values.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1069 : The File/@LongName attribute has been deprecated. Since Windows Installer XML now has the ability to generate short file/directory names, the desired name should be specified in the Name attribute instead. If the name specified in the Name attribute is a short name, then Windows Installer XML will not generate a short name. If the name specified in the Name attribute is a long name and you want to manually specify the short name, please set the short name value in the ShortName attribute.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : warning CNDL1054 : The File/@src attribute has been deprecated. Please use the Source attribute instead.
E:\U816.0_HotfixSOURCE\package\MSI\UP-U8V16.0-0001-200509-WA.wxs(2) : error CNDL0035 : The File/@Name attribute cannot be specified when attribute LongName is present.