Gitlab CI with C# build











up vote
0
down vote

favorite












I have created a C# project (C# 7.0 & .net framework 4.7.2) and also added some unit tests (NUnit 3.11.0).



This code is stored in a Gitlab repo and I can run the tests and build locally. But now I want to automate this via the Gitlab CI. According to this stackoverflow post and a lot of articles on the internet you should create your own runner on a Windows machine.



But most of those answers are already pretty old and the Gitlab CI can now work with Docker images. But then I arrive at my problem. What image should I use for this runner? I've tried microsoft/dotnet-framework and microsoft/dotnet but those didn't work.



The microsoft/dotnet-framework gives the error message: No such image: microsoft/dotnet-framework



and the microsoft/dotnet images doesn't contain the .net 4.7.2 library so it can't be used for a build.





Gitlab CI + Docker image + C# build?



Is it still not possible to create a Gitlab CI runner with a Docker image for a C# build (console application)? Or am I just doing something wrong here?



My current .gitlab-ci.yml



image: microsoft/dotnet-framework

stages:
- build

before_script:
- 'dotnet restore'

app-build:
stage: build
script:
- 'dotnet build'
only:
- master




Update



Do thanks to @Andreas Zita I now have an Image (dsfnctnl/gitlab-dotnetcore-builder:0.15.0). Unfortunately this gives me the same error as the microsoft/dotnet. This is probebly an error in my build script (or so I hope), but I cannot seem to find what it is.



The error:



$ dotnet restore
Nothing to do. None of the projects specified contain packages to restore.
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProject.csproj]
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProjectTests.csproj]

Build FAILED.









share|improve this question
























  • The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
    – tkausl
    Nov 22 at 15:51










  • dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
    – Andreas Zita
    Nov 22 at 16:00










  • @tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
    – Mr.wiseguy
    Nov 22 at 16:01












  • @AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
    – Mr.wiseguy
    Nov 22 at 16:06












  • The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
    – Matheus Valiente Souza
    Nov 22 at 20:18















up vote
0
down vote

favorite












I have created a C# project (C# 7.0 & .net framework 4.7.2) and also added some unit tests (NUnit 3.11.0).



This code is stored in a Gitlab repo and I can run the tests and build locally. But now I want to automate this via the Gitlab CI. According to this stackoverflow post and a lot of articles on the internet you should create your own runner on a Windows machine.



But most of those answers are already pretty old and the Gitlab CI can now work with Docker images. But then I arrive at my problem. What image should I use for this runner? I've tried microsoft/dotnet-framework and microsoft/dotnet but those didn't work.



The microsoft/dotnet-framework gives the error message: No such image: microsoft/dotnet-framework



and the microsoft/dotnet images doesn't contain the .net 4.7.2 library so it can't be used for a build.





Gitlab CI + Docker image + C# build?



Is it still not possible to create a Gitlab CI runner with a Docker image for a C# build (console application)? Or am I just doing something wrong here?



My current .gitlab-ci.yml



image: microsoft/dotnet-framework

stages:
- build

before_script:
- 'dotnet restore'

app-build:
stage: build
script:
- 'dotnet build'
only:
- master




Update



Do thanks to @Andreas Zita I now have an Image (dsfnctnl/gitlab-dotnetcore-builder:0.15.0). Unfortunately this gives me the same error as the microsoft/dotnet. This is probebly an error in my build script (or so I hope), but I cannot seem to find what it is.



The error:



$ dotnet restore
Nothing to do. None of the projects specified contain packages to restore.
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProject.csproj]
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProjectTests.csproj]

Build FAILED.









share|improve this question
























  • The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
    – tkausl
    Nov 22 at 15:51










  • dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
    – Andreas Zita
    Nov 22 at 16:00










  • @tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
    – Mr.wiseguy
    Nov 22 at 16:01












  • @AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
    – Mr.wiseguy
    Nov 22 at 16:06












  • The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
    – Matheus Valiente Souza
    Nov 22 at 20:18













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have created a C# project (C# 7.0 & .net framework 4.7.2) and also added some unit tests (NUnit 3.11.0).



This code is stored in a Gitlab repo and I can run the tests and build locally. But now I want to automate this via the Gitlab CI. According to this stackoverflow post and a lot of articles on the internet you should create your own runner on a Windows machine.



But most of those answers are already pretty old and the Gitlab CI can now work with Docker images. But then I arrive at my problem. What image should I use for this runner? I've tried microsoft/dotnet-framework and microsoft/dotnet but those didn't work.



The microsoft/dotnet-framework gives the error message: No such image: microsoft/dotnet-framework



and the microsoft/dotnet images doesn't contain the .net 4.7.2 library so it can't be used for a build.





Gitlab CI + Docker image + C# build?



Is it still not possible to create a Gitlab CI runner with a Docker image for a C# build (console application)? Or am I just doing something wrong here?



My current .gitlab-ci.yml



image: microsoft/dotnet-framework

stages:
- build

before_script:
- 'dotnet restore'

app-build:
stage: build
script:
- 'dotnet build'
only:
- master




Update



Do thanks to @Andreas Zita I now have an Image (dsfnctnl/gitlab-dotnetcore-builder:0.15.0). Unfortunately this gives me the same error as the microsoft/dotnet. This is probebly an error in my build script (or so I hope), but I cannot seem to find what it is.



The error:



$ dotnet restore
Nothing to do. None of the projects specified contain packages to restore.
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProject.csproj]
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProjectTests.csproj]

Build FAILED.









share|improve this question















I have created a C# project (C# 7.0 & .net framework 4.7.2) and also added some unit tests (NUnit 3.11.0).



This code is stored in a Gitlab repo and I can run the tests and build locally. But now I want to automate this via the Gitlab CI. According to this stackoverflow post and a lot of articles on the internet you should create your own runner on a Windows machine.



But most of those answers are already pretty old and the Gitlab CI can now work with Docker images. But then I arrive at my problem. What image should I use for this runner? I've tried microsoft/dotnet-framework and microsoft/dotnet but those didn't work.



The microsoft/dotnet-framework gives the error message: No such image: microsoft/dotnet-framework



and the microsoft/dotnet images doesn't contain the .net 4.7.2 library so it can't be used for a build.





Gitlab CI + Docker image + C# build?



Is it still not possible to create a Gitlab CI runner with a Docker image for a C# build (console application)? Or am I just doing something wrong here?



My current .gitlab-ci.yml



image: microsoft/dotnet-framework

stages:
- build

before_script:
- 'dotnet restore'

app-build:
stage: build
script:
- 'dotnet build'
only:
- master




Update



Do thanks to @Andreas Zita I now have an Image (dsfnctnl/gitlab-dotnetcore-builder:0.15.0). Unfortunately this gives me the same error as the microsoft/dotnet. This is probebly an error in my build script (or so I hope), but I cannot seem to find what it is.



The error:



$ dotnet restore
Nothing to do. None of the projects specified contain packages to restore.
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProject.csproj]
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProjectTests.csproj]

Build FAILED.






c# .net docker gitlab gitlab-ci






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 16:15

























asked Nov 22 at 15:49









Mr.wiseguy

98921436




98921436












  • The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
    – tkausl
    Nov 22 at 15:51










  • dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
    – Andreas Zita
    Nov 22 at 16:00










  • @tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
    – Mr.wiseguy
    Nov 22 at 16:01












  • @AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
    – Mr.wiseguy
    Nov 22 at 16:06












  • The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
    – Matheus Valiente Souza
    Nov 22 at 20:18


















  • The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
    – tkausl
    Nov 22 at 15:51










  • dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
    – Andreas Zita
    Nov 22 at 16:00










  • @tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
    – Mr.wiseguy
    Nov 22 at 16:01












  • @AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
    – Mr.wiseguy
    Nov 22 at 16:06












  • The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
    – Matheus Valiente Souza
    Nov 22 at 20:18
















The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
– tkausl
Nov 22 at 15:51




The microsoft/ images are windows images. You need to look for a linux-based c# builder image.
– tkausl
Nov 22 at 15:51












dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
– Andreas Zita
Nov 22 at 16:00




dsfnctnl/gitlab-dotnetcore-builder? (I have not tested it)
– Andreas Zita
Nov 22 at 16:00












@tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
– Mr.wiseguy
Nov 22 at 16:01






@tkausl Ah that confirms my Thoughts. Then I should probably look for a Linux image with Mono.
– Mr.wiseguy
Nov 22 at 16:01














@AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
– Mr.wiseguy
Nov 22 at 16:06






@AndreasZita, Thanks! (manifest not found -->) nvm. had to add a specific version number.
– Mr.wiseguy
Nov 22 at 16:06














The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
– Matheus Valiente Souza
Nov 22 at 20:18




The dotnet have images for both platforms, Linux or Windows. But they run dotnet core only.
– Matheus Valiente Souza
Nov 22 at 20:18

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434460%2fgitlab-ci-with-c-sharp-build%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434460%2fgitlab-ci-with-c-sharp-build%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo