使用 MSbuild 自动预编译网站时出现问题
总之,
我目前的解决方案包括 2 个类库和一个使用 Msbuild 在 teamCity 中构建的网站。 现在我想预编译该网站并将其作为工件提供。 但是,当我尝试使用预编译它时,
<Target Name="PrecompileWeb" DependsOnTargets="Build">
<AspNetCompiler
PhysicalPath="$(BuildDir)\Location\"
TargetPath="$(BuildDir)\Publish"
Force="true"
Debug="true"
/>
</Target>
我会收到一个错误,因为它正在寻找虚拟路径(我没有,因为我想要预编译我对发布网站不感兴趣的文件),如果我放置中的虚拟路径我收到另一个错误(正确地),关于它不是 IIS 下的应用程序
任何想法
All,
I currently have my solution comprising of 2 Class librarys and a Web Site building within teamCity using Msbuild. Now I want to precompile the website and make it available as an artifact. However when i try to Precompile it using
<Target Name="PrecompileWeb" DependsOnTargets="Build">
<AspNetCompiler
PhysicalPath="$(BuildDir)\Location\"
TargetPath="$(BuildDir)\Publish"
Force="true"
Debug="true"
/>
</Target>
I get an error becasue it is looking for a virtual path (which i don't have as all I want to do it precompile the files I am not interested in publishing the site) if I put a dummy path in I get another error (correctly) about it not being an application under IIS
Any ideas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这是否有效,因为每个构建都会发生这种情况? 我只想在 TeamCity 服务器上运行构建而不是本地构建时执行此操作。
本质上我目前
构建了所有必需的解决方案
执行单元测试
为工件
Cheers创建 Zip 文件夹
I am not sure this will work as this will happen on every build? I only want to do this when I run the build on the TeamCity Server not local builds.
Essentially I currently
Build all the required solutions
Execute the unit tests
Create the Zip folder for the artifact
Cheers
这是网站还是 Web 应用程序项目? 如果是后者,则不执行 AspNetCompiler 任务,而是对 csproj/vbproj 文件执行 MSBuild 任务,调用目标
Rebuild;ResolveReferences;_CopyWebApplication
并指定OutDir
属性。如果您使用的是网站,请将 VirtualPath 指定为有效的 IIS 路径。 发生的情况是,当您未指定 VirtualPath 属性时,它会尝试使用 PhysicalPath 和 IIS 来解析它。 我相信这只是 AspNetCompiler 工作方式的一个产物。
Is this a Web Site or Web Application Project? If the latter, instead of doing an AspNetCompiler task, do an MSBuild task to the csproj/vbproj file, calling the targets
Rebuild;ResolveReferences;_CopyWebApplication
and specifying theOutDir
property.If you are using a website, then specify the VirtualPath to be a valid IIS path. What is happening is that, when you don't specify the VirtualPath property, it tries to resolve it using the PhysicalPath and IIS. I believe that's just an artifact of how the AspNetCompiler works.