也许我来晚了一点,但我遇到了问题,我所做的只是创建和组装只包含一个带有我想要的属性的 AssemblyInfo.cs 源文件。
然后我将项目 AssemblyInfo 添加到我的解决方案中。
然后我实现了一个要在部署时运行的脚本,如下所示:
:: Just prepare and clean before starting
SET DOTNETINSTALLDIR=%FRAMEWORKDIR%\v4.0.30319
rmdir /S /Q "%Depot%\AssetExplorer.Web"
mkdir "%Depot%\AssetExplorer.Web"
:: Compiles the web site
call "%DOTNETINSTALLDIR%\aspnet_compiler" -f -c -u -p "%~1..\Discovery.Web" -v "/AssetExplorer" "%Depot%\AssetExplorer.Web"
:: Time to merge the contents into the assembly
call "%WindowsSDK_ExecutablePath_x86%\aspnet_merge" -o ICM.dll -a "%Depot%\AssetExplorer.Web" -copyattrs "%~1..\AssemblyInfo\obj\Release\AssemblyInfo.dll"
魔法就在
-copyattrs "%~1..\AssemblyInfo\obj\Release\AssemblyInfo.dll",
它从 AssemblyInfo.dll 中获取属性并将它们复制到生成的程序集中。
希望能帮助到你 ;)