使用 MSbuild 自动预编译网站时出现问题

发布于 2024-07-09 17:20:23 字数 491 浏览 5 评论 0原文

总之,

我目前的解决方案包括 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〆一缕阳光ご 2024-07-16 17:20:24

我不确定这是否有效,因为每个构建都会发生这种情况? 我只想在 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

生生漫 2024-07-16 17:20:23

这是网站还是 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 the OutDir 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文