LoginSignup
2
2

More than 5 years have passed since last update.

MSBuild単体でWebApplicationをビルドする

Last updated at Posted at 2017-03-19

CIサーバーなど、VisualStudioをインストールせずにMSBuild単体でビルドしたい。

MSBuild単体でWebApplicationをビルドするとエラーがでる。

$ msbuild WebApplication.sln

...

Build FAILED.

"C:\Users\TestUser\Desktop\WebApplication\WebApplication.sln" (default target) (1) ->
"C:\Users\TestUser\Desktop\WebApplication\WebApplication\WebApplication.csproj" (default target) (2) ->
  C:\Users\TestUser\Desktop\WebApplication\WebApplication\WebApplication.csproj(84,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17

「Microsoft.WebApplication.targets が無い」と言っているので、VisualStudioがインストールされているPCからコピーしてやれば良い。場所は以下。

C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications

そうすると通る。

$ msbuild WebApplication.sln

...

Done Building Project "C:\Users\TestUser\Desktop\WebApplication\WebApplication\WebApplication.csproj" (default targets).
Done Building Project "C:\Users\TestUser\Desktop\WebApplication\WebApplication.sln" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.78

でもこれ・・・
ライセンスが必要なんじゃ?

http://azure.microsoft.com/ja-jp/documentation/articles/cloud-services-dotnet-continuous-delivery/
にも
「インストール済みの Visual Studio の Microsoft.WebApplication.targets ファイルをビルド サーバーにコピーします。」
とかあるけど。

参考
http://stackoverflow.com/questions/3980909/microsoft-webapplication-targets-was-not-found-on-the-build-server-whats-your

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2