Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openxt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
openxt
Commits
9bf211c7
There was an error fetching the commit references. Please try again later.
Commit
9bf211c7
authored
4 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
csproj25 bug fix
parent
d59b24c9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/csproj-to-5.go
+21
-8
21 additions, 8 deletions
tools/csproj-to-5.go
with
21 additions
and
8 deletions
tools/csproj-to-5.go
+
21
−
8
View file @
9bf211c7
...
@@ -57,7 +57,7 @@ func main() {
...
@@ -57,7 +57,7 @@ func main() {
// Good luck for old MacOS! They use single \r as newline.
// Good luck for old MacOS! They use single \r as newline.
lines
:=
strings
.
Split
(
strings
.
ReplaceAll
(
string
(
content
),
"
\r\n
"
,
"
\n
"
),
"
\n
"
)
lines
:=
strings
.
Split
(
strings
.
ReplaceAll
(
string
(
content
),
"
\r\n
"
,
"
\n
"
),
"
\n
"
)
resultTxt
:=
""
resultTxt
:=
""
removeEnd
Ref
InNextLine
:=
false
// temporary variable, looks like a workaround
.
removeEnd
OfTag
InNextLine
:=
""
// Empty value indicates no need to remove EOT
.
for
_
,
line
:=
range
lines
{
for
_
,
line
:=
range
lines
{
// We assume that, there's at most one issue in every line.
// We assume that, there's at most one issue in every line.
// That's why this tool only works to well-formatted csproj, instead of any xml.
// That's why this tool only works to well-formatted csproj, instead of any xml.
...
@@ -65,8 +65,16 @@ func main() {
...
@@ -65,8 +65,16 @@ func main() {
if
stringContainsInsensitive
(
line
,
"<compile include="
)
{
if
stringContainsInsensitive
(
line
,
"<compile include="
)
{
if
!
strings
.
Contains
(
line
,
".."
)
{
if
!
strings
.
Contains
(
line
,
".."
)
{
// Remove this line
// Remove this <compile include>!
continue
if
strings
.
Contains
(
line
,
"/>"
)
{
// Just remove this line
continue
}
else
{
// Remove until tag close
if
removeEndOfTagInNextLine
==
""
{
removeEndOfTagInNextLine
=
"</compile>"
}
}
}
}
}
}
...
@@ -99,18 +107,23 @@ func main() {
...
@@ -99,18 +107,23 @@ func main() {
if
stringContainsInsensitive
(
line
,
`"System.ValueTuple"`
)
||
stringContainsInsensitive
(
line
,
`$(PkgSystem_ValueTuple)`
)
{
if
stringContainsInsensitive
(
line
,
`"System.ValueTuple"`
)
||
stringContainsInsensitive
(
line
,
`$(PkgSystem_ValueTuple)`
)
{
// Remove this line.
// Remove this line.
removeEndRefInNextLine
=
!
stringContainsInsensitive
(
line
,
"</Reference>"
)
if
!
stringContainsInsensitive
(
line
,
"</Reference>"
)
{
// We need to remove more lines...
if
removeEndOfTagInNextLine
==
""
{
removeEndOfTagInNextLine
=
"</Reference>"
}
}
continue
;
continue
;
}
}
if
removeEnd
Ref
InNextLine
{
if
removeEnd
OfTag
InNextLine
!=
""
{
pos
:=
stringIndexInsensitive
(
line
,
"</Reference>"
);
pos
:=
stringIndexInsensitive
(
line
,
removeEndOfTagInNextLine
);
if
pos
==
-
1
{
if
pos
==
-
1
{
// this line still not contains </Reference>
// this line still not contains </Reference>
// Skip this line and keep checking next line.
// Skip this line and keep checking next line.
continue
continue
}
else
{
}
else
{
line
=
line
[
pos
+
len
(
"</Reference>"
)
:
]
line
=
line
[
pos
+
len
(
removeEndOfTagInNextLine
)
:
]
removeEnd
Ref
InNextLine
=
false
removeEnd
OfTag
InNextLine
=
""
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment