C# 使用nant在msbuild上生成.vdproj时出错
我已经习惯于在构建版本中使用nant。但是我已经开始使用asp.NETMVC,我选择使用.vdproj进行安装设置 但是,当我打电话给 < exec program="${dotnet.dir}/msbuild.exe" commandline='"./Wum.sln" /v:q /nologo /p:Configuration=Release' />C# 使用nant在msbuild上生成.vdproj时出错,c#,msbuild,build,nant,vdproj,C#,Msbuild,Build,Nant,Vdproj,我已经习惯于在构建版本中使用nant。但是我已经开始使用asp.NETMVC,我选择使用.vdproj进行安装设置 但是,当我打电话给 < exec program="${dotnet.dir}/msbuild.exe" commandline='"./Wum.sln" /v:q /nologo /p:Configuration=Release' />
如果我使用devenv,我会有问题吗 MSBuild无法生成.vdproj项目。您应该使用Visual Studio(devenv.com)进行此操作。仅供参考。这在.NET 4.0中仍然不受支持。以下是我最近使用devenv as msbuild will not do.vdproj文件进行此操作的方法。本文首先帮助您更新.vdproj文件:
只是扩展一下CRise的文章,通过命令行使用VS2010 devenv构建一个vdproj项目是行不通的。我相信2010年之前的工作很好(见)。。。或者从Visual Studio.NET安装和部署项目移动到将在VS 2010中受支持的WiX。为什么MSBuild不能生成.vdproj项目?MSDN中有完整的参考资料吗?无论如何,Wix
有着非常丰富的知识curve@TheChairmanWix
有非常大的学习曲线,微软在VS 2013、VS 2015和VS 2017中为安装程序项目提供了Visual Studio扩展。看起来有一些问题,我使用的是2008。Microsoft已声明“当前热修复程序的估计值为8月中旬。”@Garrisonnely您是否尝试过任何脚本,如%DevEnv%%BaseSln%“/build”%BuildConfiguration%|%BuildPlatform%“/Project”%BaseVdproj%/Out“vs_errors.txt”
?是否也应用了MSBuild脚本(*。targets
)?
<target name="someTarget">
<!-- full path to setup project and project file (MSI -> vdproj) -->
<property name="DeploymentProjectPath" value="fullPath\proj.vdproj" />
<!-- full path to source project and project file (EXE -> csproj) -->
<property name="DependencyProject" value="fullPath\proj.csproj" />
<script language="C#">
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
//Purpose of script: load the .vdproj file, replace ProductCode and PackageCode with new guids, and ProductVersion with 1.0.SnvRevisionNo., write over .vdproj file
string setupFileName = project.Properties["DeploymentProjectPath"];
string productVersion = string.Format("1.0.{0}", project.Properties["svn.revision"]);
string setupFileContents;
//read in the .vdproj file
using (StreamReader sr = new StreamReader(setupFileName))
{
setupFileContents = sr.ReadToEnd();
}
if (!string.IsNullOrEmpty(setupFileContents))
{
Regex expression2 = new Regex(@"(?:\""ProductCode\"" = \""8.){([\d\w-]+)}");
Regex expression3 = new Regex(@"(?:\""PackageCode\"" = \""8.){([\d\w-]+)}");
Regex expression4 = new Regex(@"(?:\""ProductVersion\"" = \""8.)(\d.\d.\d+)");
setupFileContents = expression2.Replace(setupFileContents,"\"ProductCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}");
setupFileContents = expression3.Replace(setupFileContents,"\"PackageCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}");
setupFileContents = expression4.Replace(setupFileContents,"\"ProductVersion\" = \"8:" + productVersion);
using (TextWriter tw = new StreamWriter(setupFileName, false))
{
tw.WriteLine(setupFileContents);
}
}
}
]]>
</code>
</script>
<!-- must build the dependency first (code project), before building the MSI deployment project -->
<exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DependencyProject}" /out "fullPath\somelog.log"'/>
<exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DeploymentProjectPath}" /out "fullPath\somelog.log"'/>
</target>